diff --git a/CMakeLists.txt b/CMakeLists.txt index 55b1187f..d85628e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,17 +34,10 @@ FIND_PATH(SCINTILLA_WIN32_DIR PlatWin.cxx HINTS ${VCPKG_ROOT_DIR}/share/scintill FIND_PATH(BUGTRAP_DIR BugTrap.h HINTS ${VCPKG_ROOT_DIR}/share/bugtrap/source/Client) FIND_PATH(BUGTRAP_ZLIB_DIR zlib.def HINTS ${VCPKG_ROOT_DIR}/share/bugtrap/source/zlib) -FILE(GLOB CEF_SEARCH_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/third_party/*") -FIND_PATH(CEF_ROOT_DIR - NAMES Release/libcef.lib - PATHS ${CEF_SEARCH_PATHS} -) - MESSAGE("includes") MESSAGE(" - boost: ${Boost_INCLUDE_DIRS}") MESSAGE(" - wtl: ${WTL_INCLUDE_DIR}") MESSAGE(" - Scintilla: ${SCINTILLA_INCLUDE_DIR}") -MESSAGE(" - CEF: ${CEF_ROOT_DIR}") MESSAGE("sources") MESSAGE(" - Scintilla") diff --git a/CMakePresets.json b/CMakePresets.json index 8e00d4a8..edc024b6 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -72,18 +72,21 @@ "name": "VS-16-Debug", "configurePreset": "vcpkg-VS-16", "configuration": "Debug", + "jobs": 4, "nativeToolOptions": ["-m"] }, { "name": "VS-17-Debug", "configurePreset": "vcpkg-VS-17", "configuration": "Debug", + "jobs": 4, "nativeToolOptions": ["-m"] }, { "name": "VS-17-RelWithDebInfo", "configurePreset": "vcpkg-VS-17", "configuration": "RelWithDebInfo", + "jobs": 4, "nativeToolOptions": ["-m"] } ] diff --git a/eclide/CMakeLists.txt b/eclide/CMakeLists.txt index 3d0dd04e..21f26434 100644 --- a/eclide/CMakeLists.txt +++ b/eclide/CMakeLists.txt @@ -118,7 +118,6 @@ INCLUDE_DIRECTORIES ( ${WTL_INCLUDE_DIR} ${SCINTILLA_INCLUDE_DIR} ${BUGTRAP_DIR} - ${CEF_ROOT_DIR} ) ADD_DEFINITIONS( -D_AFXDLL -D_USRDLL ) diff --git a/eclide/QueryBuilder.cpp b/eclide/QueryBuilder.cpp index 4302dc2b..bd3156af 100644 --- a/eclide/QueryBuilder.cpp +++ b/eclide/QueryBuilder.cpp @@ -15,21 +15,6 @@ #include "aboutdlg.h" #include -#include "include/cef_base.h" -#include "include/cef_app.h" - -class CefMfcCefApp : public CefApp, public CefBrowserProcessHandler { -public: - CefMfcCefApp() {} - - virtual CefRefPtr GetBrowserProcessHandler() OVERRIDE { - return this; - } - -private: - IMPLEMENT_REFCOUNTING(CefMfcCefApp); -}; - class CConfigCache { public: @@ -74,14 +59,10 @@ BOOL CQueryBuilderApp::PumpMessage() auto result = CWinAppEx::PumpMessage(); // If there are other messages on queue then return right away - // otherwise CEF has a habit of eating keystrokes not meant for it MSG msg; if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) return result; - // Allow Cef to do his thing - CefDoMessageLoopWork(); - return result; } @@ -118,9 +99,6 @@ BOOL CQueryBuilderApp::InitInstance() InitCtrls.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&InitCtrls); - if (!InitializeCef()) - return FALSE; - CWinAppEx::InitInstance(); // Initialize OLE libraries @@ -233,8 +211,6 @@ int CQueryBuilderApp::ExitInstance() // Terminate ATL _Module.Term(); - UninitializeCef(); - ResetIConfigs(); int retVal = CWinAppEx::ExitInstance(); @@ -265,26 +241,4 @@ void CQueryBuilderApp::LoadCustomState() void CQueryBuilderApp::SaveCustomState() { -} - -bool CQueryBuilderApp::InitializeCef() -{ - m_cefApp = new CefMfcCefApp(); - CefMainArgs mainargs(m_hInstance); - - const auto exit_code = CefExecuteProcess(mainargs, m_cefApp.get(), nullptr); - if (exit_code >= 0) - return false; - - CefSettings settings; - settings.multi_threaded_message_loop = false; - settings.no_sandbox = true; - settings.ignore_certificate_errors = true; - return CefInitialize(mainargs, settings, m_cefApp.get(), nullptr); -} - -void CQueryBuilderApp::UninitializeCef() -{ - CefShutdown(); -} - +} \ No newline at end of file diff --git a/eclide/QueryBuilder.h b/eclide/QueryBuilder.h index e0e952af..eacd4402 100644 --- a/eclide/QueryBuilder.h +++ b/eclide/QueryBuilder.h @@ -8,9 +8,6 @@ #include "..\en_us\resource.h" // main symbols -#include "include/cef_base.h" -#include "include/cef_app.h" - // CQueryBuilderApp: // See QueryBuilder.cpp for the implementation of this class // @@ -42,13 +39,7 @@ class CQueryBuilderApp : public CWinAppEx virtual void SaveCustomState(); afx_msg void OnAppAbout(); - DECLARE_MESSAGE_MAP() - -private: - CefRefPtr m_cefApp; - - bool InitializeCef(); - void UninitializeCef(); + DECLARE_MESSAGE_MAP(); }; diff --git a/eclide/SummaryView.cpp b/eclide/SummaryView.cpp index e587872a..19a660e5 100644 --- a/eclide/SummaryView.cpp +++ b/eclide/SummaryView.cpp @@ -9,14 +9,7 @@ CSummaryView::CSummaryView(IResultSlot *resultSlot) { m_resultSlot = resultSlot; - m_browserEngine = GetIConfig(QUERYBUILDER_CFG)->Get(GLOBAL_BROWSER_ENGINE); - if (m_browserEngine.Compare(_T("IE")) == 0) { - m_view = CreateIEView(); - } else if (m_browserEngine.Compare(_T("Chromium")) == 0) { - m_view = CreateChromiumView(); - } else { - m_view = CreateWebView2View(); - } + m_view = CreateWebView2View(); } CSummaryView::~CSummaryView() @@ -88,12 +81,6 @@ LRESULT CSummaryView::OnBrowserNew(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hW return 0; } -LRESULT CSummaryView::OnBrowserIE(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) -{ - m_view->Navigate(m_FramedUrl, true); - return 0; -} - LRESULT CSummaryView::OnBrowserNewEclWatch(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { int pos = m_FramedUrl.Find(_T("?")); @@ -183,7 +170,6 @@ bool CSummaryView::UpdateUI(CCmdUI * cui) if ( m_view->IsLoaded() ) { UPDATEUI(cui, ID_BROWSER_NEW, true); - UPDATEUI(cui, ID_BROWSER_IE, m_browserEngine.Compare(L"IE") == 0); UPDATEUI(cui, ID_BROWSER_NEW_ECLWATCH, true); UPDATEUI(cui, ID_BROWSER_RESET, true); UPDATEUI(cui, ID_BROWSER_BACK, m_view->BackEnabled()); diff --git a/eclide/SummaryView.h b/eclide/SummaryView.h index f8ef385f..88208936 100644 --- a/eclide/SummaryView.h +++ b/eclide/SummaryView.h @@ -18,7 +18,6 @@ class CSummaryView : CString m_Url; CString m_FramedUrl; IHtmlView *m_view; - CString m_browserEngine; public: enum {IDD = IDD_SUMMARYVIEW}; @@ -40,7 +39,6 @@ class CSummaryView : MESSAGE_HANDLER(WM_FORWARDMSG, OnForwardMsg) MESSAGE_HANDLER_EX(CWM_REFRESH, OnRefresh) COMMAND_ID_HANDLER(ID_BROWSER_NEW, OnBrowserNew) - COMMAND_ID_HANDLER(ID_BROWSER_IE, OnBrowserIE) COMMAND_ID_HANDLER(ID_BROWSER_NEW_ECLWATCH, OnBrowserNewEclWatch) COMMAND_ID_HANDLER(ID_BROWSER_BACK, OnBrowserBack) COMMAND_ID_HANDLER(ID_BROWSER_FORWARD, OnBrowserForward) @@ -60,7 +58,6 @@ class CSummaryView : void DoRefresh(); LRESULT OnRefresh(UINT /*uMsg*/, WPARAM /*bCreated*/, LPARAM /*lParam*/); LRESULT OnBrowserNew(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); - LRESULT OnBrowserIE(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); LRESULT OnBrowserNewEclWatch(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); LRESULT OnBrowserBack(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); LRESULT OnBrowserForward(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/); diff --git a/eclide/mainfrm.cpp b/eclide/mainfrm.cpp index 8535cd27..fe4cdba6 100644 --- a/eclide/mainfrm.cpp +++ b/eclide/mainfrm.cpp @@ -1215,7 +1215,6 @@ void CMainFrame::InitializeRibbon() pPanelNavigation->Add(pButtLaunch); pButtLaunch->AddSubItem(new CMFCRibbonLabel(_T("Launch in external browser"))); pButtLaunch->AddSubItem(new CMFCRibbonButton(ID_BROWSER_NEW, _T("Default browser\nD"), 44)); - pButtLaunch->AddSubItem(new CMFCRibbonButton(ID_BROWSER_IE, _T("Internet Explorer\nI"), 44)); pButtLaunch->AddSubItem(new CMFCRibbonSeparator(true)); pButtLaunch->AddSubItem(new CMFCRibbonButton(ID_BROWSER_NEW_ECLWATCH, _T("ECL Watch homepage\nE"), 44)); pPanelNavigation->Add(new CMFCRibbonSeparator()); diff --git a/en_us/CMakeLists.txt b/en_us/CMakeLists.txt index 192d6488..59c708ba 100644 --- a/en_us/CMakeLists.txt +++ b/en_us/CMakeLists.txt @@ -20,8 +20,6 @@ ADD_LIBRARY (EN_US SHARED ADD_CUSTOM_COMMAND( TARGET EN_US POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CEF_ROOT_DIR}/Release ${EXECUTABLE_OUTPUT_PATH}/$ - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CEF_ROOT_DIR}/Resources ${EXECUTABLE_OUTPUT_PATH}/$ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/docs ${EXECUTABLE_OUTPUT_PATH}/$ ) diff --git a/en_us/en_us.rc b/en_us/en_us.rc index bc727ea4..336a7cf2 100644 --- a/en_us/en_us.rc +++ b/en_us/en_us.rc @@ -277,7 +277,7 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Server &IP:",IDC_STATIC,10,8,49,8 EDITTEXT IDC_EDIT_IPADDRESS,48,7,159,14,ES_AUTOHSCROLL - CONTROL "&SSL",IDC_CHECK_SSL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,214,9,27,10 + CONTROL "&SSL",IDC_CHECK_SSL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,214,9,23,10 CONTROL "A&dvanced",IDC_CHECK_ADVANCED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,239,9,47,10 LTEXT "Topolo&gy Server:",IDC_STATIC_TOPOLOGY,10,28,56,8 EDITTEXT IDC_EDIT_TOPOLOGYSERVER,71,25,208,14,ES_AUTOHSCROLL | WS_DISABLED @@ -326,8 +326,6 @@ BEGIN LTEXT "Limit Result (rows):",IDC_STATIC_LIMITRESULT,162,27,62,8 EDITTEXT IDC_EDIT_LIMITRESULT,228,24,40,14,ES_AUTOHSCROLL | ES_NUMBER CONTROL "",IDC_SPIN_LIMITRESULT,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,268,24,11,14 - LTEXT "&Browser Engine:",IDC_STATIC_BROWSERENGINE,10,45,117,10 - COMBOBOX IDC_COMBO_BROWSERENGINE,71,42,208,14,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP END IDD_PREF_OTHER DIALOGEX 0, 0, 290, 157 diff --git a/en_us/resource.h b/en_us/resource.h index 82ac4b19..e6e16d19 100644 --- a/en_us/resource.h +++ b/en_us/resource.h @@ -550,7 +550,6 @@ #define IDC_BUTTON_MATCH 549 #define IDC_EDIT_ECLWATCH 550 #define IDC_STATIC_BROWSERENGINE 551 -#define IDC_COMBO_BROWSERENGINE 552 #define ID_COL_PANE 32772 #define ID_WINDOW_MANAGER 32773 #define ID_ROW_PANE 32774 @@ -760,7 +759,6 @@ #define ID_ADVANCED_SETTABSIZE 33019 #define ID_WORKUNIT_OPENGRAPH 33020 #define ID_WORKUNIT_VIEWEXCEPTIONS 33021 -#define ID_BROWSER_IE 33022 #define ID_APPLY 33023 #define ID_SORTING_DEGROUP 33024 #define ID_FILE_NEWWORKSPACE 33025 @@ -879,7 +877,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 61415 #define _APS_NEXT_COMMAND_VALUE 33135 -#define _APS_NEXT_CONTROL_VALUE 553 +#define _APS_NEXT_CONTROL_VALUE 552 #define _APS_NEXT_SYMED_VALUE 61503 #endif #endif diff --git a/third_party/cef/Debug/lib/libcef_dll_wrapper.lib b/third_party/cef/Debug/lib/libcef_dll_wrapper.lib deleted file mode 100644 index bcf6fd27..00000000 Binary files a/third_party/cef/Debug/lib/libcef_dll_wrapper.lib and /dev/null differ diff --git a/third_party/cef/Debug/libcef.lib b/third_party/cef/Debug/libcef.lib deleted file mode 100644 index cd5f1d43..00000000 Binary files a/third_party/cef/Debug/libcef.lib and /dev/null differ diff --git a/third_party/cef/Release/chrome_elf.dll b/third_party/cef/Release/chrome_elf.dll deleted file mode 100644 index 60a1763b..00000000 Binary files a/third_party/cef/Release/chrome_elf.dll and /dev/null differ diff --git a/third_party/cef/Release/d3dcompiler_47.dll b/third_party/cef/Release/d3dcompiler_47.dll deleted file mode 100644 index dbfe9cee..00000000 Binary files a/third_party/cef/Release/d3dcompiler_47.dll and /dev/null differ diff --git a/third_party/cef/Release/libEGL.dll b/third_party/cef/Release/libEGL.dll deleted file mode 100644 index 23d81917..00000000 Binary files a/third_party/cef/Release/libEGL.dll and /dev/null differ diff --git a/third_party/cef/Release/libGLESv2.dll b/third_party/cef/Release/libGLESv2.dll deleted file mode 100644 index 3f2e4152..00000000 Binary files a/third_party/cef/Release/libGLESv2.dll and /dev/null differ diff --git a/third_party/cef/Release/libcef.dll b/third_party/cef/Release/libcef.dll deleted file mode 100644 index bf486dd4..00000000 Binary files a/third_party/cef/Release/libcef.dll and /dev/null differ diff --git a/third_party/cef/Release/libcef.lib b/third_party/cef/Release/libcef.lib deleted file mode 100644 index cd5f1d43..00000000 Binary files a/third_party/cef/Release/libcef.lib and /dev/null differ diff --git a/third_party/cef/Release/natives_blob.bin b/third_party/cef/Release/natives_blob.bin deleted file mode 100644 index a1c048d2..00000000 Binary files a/third_party/cef/Release/natives_blob.bin and /dev/null differ diff --git a/third_party/cef/Release/snapshot_blob.bin b/third_party/cef/Release/snapshot_blob.bin deleted file mode 100644 index 67593c5c..00000000 Binary files a/third_party/cef/Release/snapshot_blob.bin and /dev/null differ diff --git a/third_party/cef/Release/swiftshader/libEGL.dll b/third_party/cef/Release/swiftshader/libEGL.dll deleted file mode 100644 index 7817109e..00000000 Binary files a/third_party/cef/Release/swiftshader/libEGL.dll and /dev/null differ diff --git a/third_party/cef/Release/swiftshader/libGLESv2.dll b/third_party/cef/Release/swiftshader/libGLESv2.dll deleted file mode 100644 index a6d0f9be..00000000 Binary files a/third_party/cef/Release/swiftshader/libGLESv2.dll and /dev/null differ diff --git a/third_party/cef/Release/v8_context_snapshot.bin b/third_party/cef/Release/v8_context_snapshot.bin deleted file mode 100644 index 25bd0536..00000000 Binary files a/third_party/cef/Release/v8_context_snapshot.bin and /dev/null differ diff --git a/third_party/cef/Resources/cef.pak b/third_party/cef/Resources/cef.pak deleted file mode 100644 index 82b9d37d..00000000 Binary files a/third_party/cef/Resources/cef.pak and /dev/null differ diff --git a/third_party/cef/Resources/cef_100_percent.pak b/third_party/cef/Resources/cef_100_percent.pak deleted file mode 100644 index a6a0a558..00000000 Binary files a/third_party/cef/Resources/cef_100_percent.pak and /dev/null differ diff --git a/third_party/cef/Resources/cef_200_percent.pak b/third_party/cef/Resources/cef_200_percent.pak deleted file mode 100644 index d50d412e..00000000 Binary files a/third_party/cef/Resources/cef_200_percent.pak and /dev/null differ diff --git a/third_party/cef/Resources/cef_extensions.pak b/third_party/cef/Resources/cef_extensions.pak deleted file mode 100644 index eb135d71..00000000 Binary files a/third_party/cef/Resources/cef_extensions.pak and /dev/null differ diff --git a/third_party/cef/Resources/devtools_resources.pak b/third_party/cef/Resources/devtools_resources.pak deleted file mode 100644 index 127ec001..00000000 Binary files a/third_party/cef/Resources/devtools_resources.pak and /dev/null differ diff --git a/third_party/cef/Resources/icudtl.dat b/third_party/cef/Resources/icudtl.dat deleted file mode 100644 index 1004bf9f..00000000 Binary files a/third_party/cef/Resources/icudtl.dat and /dev/null differ diff --git a/third_party/cef/Resources/locales/en-US.pak b/third_party/cef/Resources/locales/en-US.pak deleted file mode 100644 index 1ae5cc18..00000000 Binary files a/third_party/cef/Resources/locales/en-US.pak and /dev/null differ diff --git a/third_party/cef/include/base/cef_atomic_ref_count.h b/third_party/cef/include/base/cef_atomic_ref_count.h deleted file mode 100644 index 4d677797..00000000 --- a/third_party/cef/include/base/cef_atomic_ref_count.h +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// This is a low level implementation of atomic semantics for reference -// counting. Please use cef_ref_counted.h directly instead. -// -// The Chromium implementation includes annotations to avoid some false -// positives when using data race detection tools. Annotations are not -// currently supported by the CEF implementation. - -#ifndef CEF_INCLUDE_BASE_CEF_ATOMIC_REF_COUNT_H_ -#define CEF_INCLUDE_BASE_CEF_ATOMIC_REF_COUNT_H_ -#pragma once - -#if defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/atomic_ref_count.h" - -// Used when declaring a base::AtomicRefCount value. This is an object type with -// Chromium headers. -#define ATOMIC_DECLARATION (0) - -// Maintaining compatibility with AtompicRefCount* functions that were removed -// from Chromium in http://crrev.com/ee96d561. -namespace base { - -// Increment a reference count by 1. -inline void AtomicRefCountInc(volatile AtomicRefCount* ptr) { - const_cast(ptr)->Increment(); -} - -// Decrement a reference count by 1 and return whether the result is non-zero. -// Insert barriers to ensure that state written before the reference count -// became zero will be visible to a thread that has just made the count zero. -inline bool AtomicRefCountDec(volatile AtomicRefCount* ptr) { - return const_cast(ptr)->Decrement(); -} - -// Return whether the reference count is one. If the reference count is used -// in the conventional way, a refrerence count of 1 implies that the current -// thread owns the reference and no other thread shares it. This call performs -// the test for a reference count of one, and performs the memory barrier -// needed for the owning thread to act on the object, knowing that it has -// exclusive access to the object. -inline bool AtomicRefCountIsOne(volatile AtomicRefCount* ptr) { - return const_cast(ptr)->IsOne(); -} - -// Return whether the reference count is zero. With conventional object -// referencing counting, the object will be destroyed, so the reference count -// should never be zero. Hence this is generally used for a debug check. -inline bool AtomicRefCountIsZero(volatile AtomicRefCount* ptr) { - return const_cast(ptr)->IsZero(); -} - -} // namespace base - -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include "include/base/cef_atomicops.h" - -// Annotations are not currently supported. -#define ANNOTATE_HAPPENS_BEFORE(obj) /* empty */ -#define ANNOTATE_HAPPENS_AFTER(obj) /* empty */ - -// Used when declaring a base::AtomicRefCount value. This is an integer/ptr type -// with CEF headers. -#define ATOMIC_DECLARATION = 0 - -namespace base { - -typedef subtle::Atomic32 AtomicRefCount; - -// Increment a reference count by "increment", which must exceed 0. -inline void AtomicRefCountIncN(volatile AtomicRefCount* ptr, - AtomicRefCount increment) { - subtle::NoBarrier_AtomicIncrement(ptr, increment); -} - -// Decrement a reference count by "decrement", which must exceed 0, -// and return whether the result is non-zero. -// Insert barriers to ensure that state written before the reference count -// became zero will be visible to a thread that has just made the count zero. -inline bool AtomicRefCountDecN(volatile AtomicRefCount* ptr, - AtomicRefCount decrement) { - ANNOTATE_HAPPENS_BEFORE(ptr); - bool res = (subtle::Barrier_AtomicIncrement(ptr, -decrement) != 0); - if (!res) { - ANNOTATE_HAPPENS_AFTER(ptr); - } - return res; -} - -// Increment a reference count by 1. -inline void AtomicRefCountInc(volatile AtomicRefCount* ptr) { - base::AtomicRefCountIncN(ptr, 1); -} - -// Decrement a reference count by 1 and return whether the result is non-zero. -// Insert barriers to ensure that state written before the reference count -// became zero will be visible to a thread that has just made the count zero. -inline bool AtomicRefCountDec(volatile AtomicRefCount* ptr) { - return base::AtomicRefCountDecN(ptr, 1); -} - -// Return whether the reference count is one. If the reference count is used -// in the conventional way, a refrerence count of 1 implies that the current -// thread owns the reference and no other thread shares it. This call performs -// the test for a reference count of one, and performs the memory barrier -// needed for the owning thread to act on the object, knowing that it has -// exclusive access to the object. -inline bool AtomicRefCountIsOne(volatile AtomicRefCount* ptr) { - bool res = (subtle::Acquire_Load(ptr) == 1); - if (res) { - ANNOTATE_HAPPENS_AFTER(ptr); - } - return res; -} - -// Return whether the reference count is zero. With conventional object -// referencing counting, the object will be destroyed, so the reference count -// should never be zero. Hence this is generally used for a debug check. -inline bool AtomicRefCountIsZero(volatile AtomicRefCount* ptr) { - bool res = (subtle::Acquire_Load(ptr) == 0); - if (res) { - ANNOTATE_HAPPENS_AFTER(ptr); - } - return res; -} - -} // namespace base - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_ATOMIC_REF_COUNT_H_ diff --git a/third_party/cef/include/base/cef_atomicops.h b/third_party/cef/include/base/cef_atomicops.h deleted file mode 100644 index 96aebabf..00000000 --- a/third_party/cef/include/base/cef_atomicops.h +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// For atomic operations on reference counts, see cef_atomic_ref_count.h. - -// The routines exported by this module are subtle. If you use them, even if -// you get the code right, it will depend on careful reasoning about atomicity -// and memory ordering; it will be less readable, and harder to maintain. If -// you plan to use these routines, you should have a good reason, such as solid -// evidence that performance would otherwise suffer, or there being no -// alternative. You should assume only properties explicitly guaranteed by the -// specifications in this file. You are almost certainly _not_ writing code -// just for the x86; if you assume x86 semantics, x86 hardware bugs and -// implementations on other archtectures will cause your code to break. If you -// do not know what you are doing, avoid these routines, and use a Mutex. -// -// It is incorrect to make direct assignments to/from an atomic variable. -// You should use one of the Load or Store routines. The NoBarrier -// versions are provided when no barriers are needed: -// NoBarrier_Store() -// NoBarrier_Load() -// Although there are currently no compiler enforcement, you are encouraged -// to use these. -// - -#ifndef CEF_INCLUDE_BASE_CEF_ATOMICOPS_H_ -#define CEF_INCLUDE_BASE_CEF_ATOMICOPS_H_ -#pragma once - -#if defined(BASE_ATOMICOPS_H_) -// Do nothing if the Chromium header has already been included. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/atomicops.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include - -#include "include/base/cef_build.h" - -#if defined(OS_WIN) && defined(ARCH_CPU_64_BITS) -// windows.h #defines this (only on x64). This causes problems because the -// public API also uses MemoryBarrier at the public name for this fence. So, on -// X64, undef it, and call its documented -// (http://msdn.microsoft.com/en-us/library/windows/desktop/ms684208.aspx) -// implementation directly. -#undef MemoryBarrier -#endif - -namespace base { -namespace subtle { - -typedef int32_t Atomic32; -#ifdef ARCH_CPU_64_BITS -// We need to be able to go between Atomic64 and AtomicWord implicitly. This -// means Atomic64 and AtomicWord should be the same type on 64-bit. -#if defined(__ILP32__) || defined(OS_NACL) -// NaCl's intptr_t is not actually 64-bits on 64-bit! -// http://code.google.com/p/nativeclient/issues/detail?id=1162 -typedef int64_t Atomic64; -#else -typedef intptr_t Atomic64; -#endif -#endif - -// Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or -// Atomic64 routines below, depending on your architecture. -typedef intptr_t AtomicWord; - -// Atomically execute: -// result = *ptr; -// if (*ptr == old_value) -// *ptr = new_value; -// return result; -// -// I.e., replace "*ptr" with "new_value" if "*ptr" used to be "old_value". -// Always return the old value of "*ptr" -// -// This routine implies no memory barriers. -Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value); - -// Atomically store new_value into *ptr, returning the previous value held in -// *ptr. This routine implies no memory barriers. -Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, Atomic32 new_value); - -// Atomically increment *ptr by "increment". Returns the new value of -// *ptr with the increment applied. This routine implies no memory barriers. -Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, Atomic32 increment); - -Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, Atomic32 increment); - -// These following lower-level operations are typically useful only to people -// implementing higher-level synchronization operations like spinlocks, -// mutexes, and condition-variables. They combine CompareAndSwap(), a load, or -// a store with appropriate memory-ordering instructions. "Acquire" operations -// ensure that no later memory access can be reordered ahead of the operation. -// "Release" operations ensure that no previous memory access can be reordered -// after the operation. "Barrier" operations have both "Acquire" and "Release" -// semantics. A MemoryBarrier() has "Barrier" semantics, but does no memory -// access. -Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value); -Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value); - -void MemoryBarrier(); -void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value); -void Acquire_Store(volatile Atomic32* ptr, Atomic32 value); -void Release_Store(volatile Atomic32* ptr, Atomic32 value); - -Atomic32 NoBarrier_Load(volatile const Atomic32* ptr); -Atomic32 Acquire_Load(volatile const Atomic32* ptr); -Atomic32 Release_Load(volatile const Atomic32* ptr); - -// 64-bit atomic operations (only available on 64-bit processors). -#ifdef ARCH_CPU_64_BITS -Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, - Atomic64 old_value, - Atomic64 new_value); -Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, Atomic64 new_value); -Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment); -Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, Atomic64 increment); - -Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, - Atomic64 old_value, - Atomic64 new_value); -Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr, - Atomic64 old_value, - Atomic64 new_value); -void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value); -void Acquire_Store(volatile Atomic64* ptr, Atomic64 value); -void Release_Store(volatile Atomic64* ptr, Atomic64 value); -Atomic64 NoBarrier_Load(volatile const Atomic64* ptr); -Atomic64 Acquire_Load(volatile const Atomic64* ptr); -Atomic64 Release_Load(volatile const Atomic64* ptr); -#endif // ARCH_CPU_64_BITS - -} // namespace subtle -} // namespace base - -// Include our platform specific implementation. -#if defined(OS_WIN) && defined(COMPILER_MSVC) && defined(ARCH_CPU_X86_FAMILY) -#include "include/base/internal/cef_atomicops_x86_msvc.h" -#elif defined(OS_MACOSX) -#include "include/base/internal/cef_atomicops_mac.h" -#elif defined(COMPILER_GCC) && defined(ARCH_CPU_X86_FAMILY) -#include "include/base/internal/cef_atomicops_x86_gcc.h" -#elif defined(COMPILER_GCC) && defined(__ARM_ARCH) -#include "include/base/internal/cef_atomicops_arm_gcc.h" -#else -#error "Atomic operations are not supported on your platform" -#endif - -// On some platforms we need additional declarations to make -// AtomicWord compatible with our other Atomic* types. -#if defined(OS_MACOSX) || defined(OS_OPENBSD) -#include "include/base/internal/cef_atomicops_atomicword_compat.h" -#endif - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_ATOMICOPS_H_ diff --git a/third_party/cef/include/base/cef_basictypes.h b/third_party/cef/include/base/cef_basictypes.h deleted file mode 100644 index e38f4f72..00000000 --- a/third_party/cef/include/base/cef_basictypes.h +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef CEF_INCLUDE_BASE_CEF_BASICTYPES_H_ -#define CEF_INCLUDE_BASE_CEF_BASICTYPES_H_ -#pragma once - -#include // For UINT_MAX -#include // For size_t - -#include "include/base/cef_build.h" - -// The NSPR system headers define 64-bit as |long| when possible, except on -// Mac OS X. In order to not have typedef mismatches, we do the same on LP64. -// -// On Mac OS X, |long long| is used for 64-bit types for compatibility with -// format macros even in the LP64 model. -#if defined(__LP64__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) -typedef long int64; -typedef unsigned long uint64; -#else -typedef long long int64; -typedef unsigned long long uint64; -#endif - -// TODO: Remove these type guards. These are to avoid conflicts with -// obsolete/protypes.h in the Gecko SDK. -#ifndef _INT32 -#define _INT32 -typedef int int32; -#endif - -// TODO: Remove these type guards. These are to avoid conflicts with -// obsolete/protypes.h in the Gecko SDK. -#ifndef _UINT32 -#define _UINT32 -typedef unsigned int uint32; -#endif - -#ifndef _INT16 -#define _INT16 -typedef short int16; -#endif - -#ifndef _UINT16 -#define _UINT16 -typedef unsigned short uint16; -#endif - -// UTF-16 character type. -// This should be kept synchronized with base/strings/string16.h -#ifndef char16 -#if defined(WCHAR_T_IS_UTF16) -typedef wchar_t char16; -#elif defined(WCHAR_T_IS_UTF32) -typedef unsigned short char16; -#endif -#endif - -#endif // CEF_INCLUDE_BASE_CEF_BASICTYPES_H_ diff --git a/third_party/cef/include/base/cef_bind.h b/third_party/cef/include/base/cef_bind.h deleted file mode 100644 index 77c9c557..00000000 --- a/third_party/cef/include/base/cef_bind.h +++ /dev/null @@ -1,575 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef CEF_INCLUDE_BASE_CEF_BIND_H_ -#define CEF_INCLUDE_BASE_CEF_BIND_H_ -#pragma once - -#if defined(BASE_BIND_H_) -// Do nothing if the Chromium header has already been included. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/bind.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include "include/base/internal/cef_bind_internal.h" -#include "include/base/internal/cef_callback_internal.h" - -// ----------------------------------------------------------------------------- -// Usage documentation -// ----------------------------------------------------------------------------- -// -// See base/cef_callback.h for documentation. -// -// -// ----------------------------------------------------------------------------- -// Implementation notes -// ----------------------------------------------------------------------------- -// -// If you're reading the implementation, before proceeding further, you should -// read the top comment of base/bind_internal.h for a definition of common -// terms and concepts. -// -// RETURN TYPES -// -// Though Bind()'s result is meant to be stored in a Callback<> type, it -// cannot actually return the exact type without requiring a large amount -// of extra template specializations. The problem is that in order to -// discern the correct specialization of Callback<>, Bind would need to -// unwrap the function signature to determine the signature's arity, and -// whether or not it is a method. -// -// Each unique combination of (arity, function_type, num_prebound) where -// function_type is one of {function, method, const_method} would require -// one specialization. We eventually have to do a similar number of -// specializations anyways in the implementation (see the Invoker<>, -// classes). However, it is avoidable in Bind if we return the result -// via an indirection like we do below. -// -// TODO(ajwong): We might be able to avoid this now, but need to test. -// -// It is possible to move most of the COMPILE_ASSERT asserts into BindState<>, -// but it feels a little nicer to have the asserts here so people do not -// need to crack open bind_internal.h. On the other hand, it makes Bind() -// harder to read. - -namespace base { - -template -base::Callback::RunnableType, - typename cef_internal::FunctorTraits::RunType, - void()>::UnboundRunType> -Bind(Functor functor) { - // Typedefs for how to store and run the functor. - typedef - typename cef_internal::FunctorTraits::RunnableType RunnableType; - typedef typename cef_internal::FunctorTraits::RunType RunType; - - typedef cef_internal::BindState BindState; - - return Callback( - new BindState(cef_internal::MakeRunnable(functor))); -} - -template -base::Callback::RunnableType, - typename cef_internal::FunctorTraits::RunType, - void(typename cef_internal::CallbackParamTraits::StorageType)>:: - UnboundRunType> -Bind(Functor functor, const P1& p1) { - // Typedefs for how to store and run the functor. - typedef - typename cef_internal::FunctorTraits::RunnableType RunnableType; - typedef typename cef_internal::FunctorTraits::RunType RunType; - - // Use RunnableType::RunType instead of RunType above because our - // checks should below for bound references need to know what the actual - // functor is going to interpret the argument as. - typedef cef_internal::FunctionTraits - BoundFunctorTraits; - - // Do not allow binding a non-const reference parameter. Non-const reference - // parameters are disallowed by the Google style guide. Also, binding a - // non-const reference parameter can make for subtle bugs because the - // invoked function will receive a reference to the stored copy of the - // argument and not the original. - COMPILE_ASSERT( - !(is_non_const_reference::value), - do_not_bind_functions_with_nonconst_ref); - - // For methods, we need to be careful for parameter 1. We do not require - // a scoped_refptr because BindState<> itself takes care of AddRef() for - // methods. We also disallow binding of an array as the method's target - // object. - COMPILE_ASSERT(cef_internal::HasIsMethodTag::value || - !cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p1_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::HasIsMethodTag::value || - !is_array::value, - first_bound_argument_to_method_cannot_be_array); - typedef cef_internal::BindState< - RunnableType, RunType, - void(typename cef_internal::CallbackParamTraits::StorageType)> - BindState; - - return Callback( - new BindState(cef_internal::MakeRunnable(functor), p1)); -} - -template -base::Callback::RunnableType, - typename cef_internal::FunctorTraits::RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)>:: - UnboundRunType> -Bind(Functor functor, const P1& p1, const P2& p2) { - // Typedefs for how to store and run the functor. - typedef - typename cef_internal::FunctorTraits::RunnableType RunnableType; - typedef typename cef_internal::FunctorTraits::RunType RunType; - - // Use RunnableType::RunType instead of RunType above because our - // checks should below for bound references need to know what the actual - // functor is going to interpret the argument as. - typedef cef_internal::FunctionTraits - BoundFunctorTraits; - - // Do not allow binding a non-const reference parameter. Non-const reference - // parameters are disallowed by the Google style guide. Also, binding a - // non-const reference parameter can make for subtle bugs because the - // invoked function will receive a reference to the stored copy of the - // argument and not the original. - COMPILE_ASSERT( - !(is_non_const_reference::value || - is_non_const_reference::value), - do_not_bind_functions_with_nonconst_ref); - - // For methods, we need to be careful for parameter 1. We do not require - // a scoped_refptr because BindState<> itself takes care of AddRef() for - // methods. We also disallow binding of an array as the method's target - // object. - COMPILE_ASSERT(cef_internal::HasIsMethodTag::value || - !cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p1_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::HasIsMethodTag::value || - !is_array::value, - first_bound_argument_to_method_cannot_be_array); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p2_is_refcounted_type_and_needs_scoped_refptr); - typedef cef_internal::BindState< - RunnableType, RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)> - BindState; - - return Callback( - new BindState(cef_internal::MakeRunnable(functor), p1, p2)); -} - -template -base::Callback::RunnableType, - typename cef_internal::FunctorTraits::RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)>:: - UnboundRunType> -Bind(Functor functor, const P1& p1, const P2& p2, const P3& p3) { - // Typedefs for how to store and run the functor. - typedef - typename cef_internal::FunctorTraits::RunnableType RunnableType; - typedef typename cef_internal::FunctorTraits::RunType RunType; - - // Use RunnableType::RunType instead of RunType above because our - // checks should below for bound references need to know what the actual - // functor is going to interpret the argument as. - typedef cef_internal::FunctionTraits - BoundFunctorTraits; - - // Do not allow binding a non-const reference parameter. Non-const reference - // parameters are disallowed by the Google style guide. Also, binding a - // non-const reference parameter can make for subtle bugs because the - // invoked function will receive a reference to the stored copy of the - // argument and not the original. - COMPILE_ASSERT( - !(is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value), - do_not_bind_functions_with_nonconst_ref); - - // For methods, we need to be careful for parameter 1. We do not require - // a scoped_refptr because BindState<> itself takes care of AddRef() for - // methods. We also disallow binding of an array as the method's target - // object. - COMPILE_ASSERT(cef_internal::HasIsMethodTag::value || - !cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p1_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::HasIsMethodTag::value || - !is_array::value, - first_bound_argument_to_method_cannot_be_array); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p2_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p3_is_refcounted_type_and_needs_scoped_refptr); - typedef cef_internal::BindState< - RunnableType, RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)> - BindState; - - return Callback( - new BindState(cef_internal::MakeRunnable(functor), p1, p2, p3)); -} - -template -base::Callback::RunnableType, - typename cef_internal::FunctorTraits::RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)>:: - UnboundRunType> -Bind(Functor functor, const P1& p1, const P2& p2, const P3& p3, const P4& p4) { - // Typedefs for how to store and run the functor. - typedef - typename cef_internal::FunctorTraits::RunnableType RunnableType; - typedef typename cef_internal::FunctorTraits::RunType RunType; - - // Use RunnableType::RunType instead of RunType above because our - // checks should below for bound references need to know what the actual - // functor is going to interpret the argument as. - typedef cef_internal::FunctionTraits - BoundFunctorTraits; - - // Do not allow binding a non-const reference parameter. Non-const reference - // parameters are disallowed by the Google style guide. Also, binding a - // non-const reference parameter can make for subtle bugs because the - // invoked function will receive a reference to the stored copy of the - // argument and not the original. - COMPILE_ASSERT( - !(is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value), - do_not_bind_functions_with_nonconst_ref); - - // For methods, we need to be careful for parameter 1. We do not require - // a scoped_refptr because BindState<> itself takes care of AddRef() for - // methods. We also disallow binding of an array as the method's target - // object. - COMPILE_ASSERT(cef_internal::HasIsMethodTag::value || - !cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p1_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::HasIsMethodTag::value || - !is_array::value, - first_bound_argument_to_method_cannot_be_array); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p2_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p3_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p4_is_refcounted_type_and_needs_scoped_refptr); - typedef cef_internal::BindState< - RunnableType, RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)> - BindState; - - return Callback( - new BindState(cef_internal::MakeRunnable(functor), p1, p2, p3, p4)); -} - -template -base::Callback::RunnableType, - typename cef_internal::FunctorTraits::RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)>:: - UnboundRunType> -Bind(Functor functor, - const P1& p1, - const P2& p2, - const P3& p3, - const P4& p4, - const P5& p5) { - // Typedefs for how to store and run the functor. - typedef - typename cef_internal::FunctorTraits::RunnableType RunnableType; - typedef typename cef_internal::FunctorTraits::RunType RunType; - - // Use RunnableType::RunType instead of RunType above because our - // checks should below for bound references need to know what the actual - // functor is going to interpret the argument as. - typedef cef_internal::FunctionTraits - BoundFunctorTraits; - - // Do not allow binding a non-const reference parameter. Non-const reference - // parameters are disallowed by the Google style guide. Also, binding a - // non-const reference parameter can make for subtle bugs because the - // invoked function will receive a reference to the stored copy of the - // argument and not the original. - COMPILE_ASSERT( - !(is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value), - do_not_bind_functions_with_nonconst_ref); - - // For methods, we need to be careful for parameter 1. We do not require - // a scoped_refptr because BindState<> itself takes care of AddRef() for - // methods. We also disallow binding of an array as the method's target - // object. - COMPILE_ASSERT(cef_internal::HasIsMethodTag::value || - !cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p1_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::HasIsMethodTag::value || - !is_array::value, - first_bound_argument_to_method_cannot_be_array); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p2_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p3_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p4_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p5_is_refcounted_type_and_needs_scoped_refptr); - typedef cef_internal::BindState< - RunnableType, RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)> - BindState; - - return Callback( - new BindState(cef_internal::MakeRunnable(functor), p1, p2, p3, p4, p5)); -} - -template -base::Callback::RunnableType, - typename cef_internal::FunctorTraits::RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)>:: - UnboundRunType> -Bind(Functor functor, - const P1& p1, - const P2& p2, - const P3& p3, - const P4& p4, - const P5& p5, - const P6& p6) { - // Typedefs for how to store and run the functor. - typedef - typename cef_internal::FunctorTraits::RunnableType RunnableType; - typedef typename cef_internal::FunctorTraits::RunType RunType; - - // Use RunnableType::RunType instead of RunType above because our - // checks should below for bound references need to know what the actual - // functor is going to interpret the argument as. - typedef cef_internal::FunctionTraits - BoundFunctorTraits; - - // Do not allow binding a non-const reference parameter. Non-const reference - // parameters are disallowed by the Google style guide. Also, binding a - // non-const reference parameter can make for subtle bugs because the - // invoked function will receive a reference to the stored copy of the - // argument and not the original. - COMPILE_ASSERT( - !(is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value), - do_not_bind_functions_with_nonconst_ref); - - // For methods, we need to be careful for parameter 1. We do not require - // a scoped_refptr because BindState<> itself takes care of AddRef() for - // methods. We also disallow binding of an array as the method's target - // object. - COMPILE_ASSERT(cef_internal::HasIsMethodTag::value || - !cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p1_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::HasIsMethodTag::value || - !is_array::value, - first_bound_argument_to_method_cannot_be_array); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p2_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p3_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p4_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p5_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p6_is_refcounted_type_and_needs_scoped_refptr); - typedef cef_internal::BindState< - RunnableType, RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)> - BindState; - - return Callback(new BindState( - cef_internal::MakeRunnable(functor), p1, p2, p3, p4, p5, p6)); -} - -template -base::Callback::RunnableType, - typename cef_internal::FunctorTraits::RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)>:: - UnboundRunType> -Bind(Functor functor, - const P1& p1, - const P2& p2, - const P3& p3, - const P4& p4, - const P5& p5, - const P6& p6, - const P7& p7) { - // Typedefs for how to store and run the functor. - typedef - typename cef_internal::FunctorTraits::RunnableType RunnableType; - typedef typename cef_internal::FunctorTraits::RunType RunType; - - // Use RunnableType::RunType instead of RunType above because our - // checks should below for bound references need to know what the actual - // functor is going to interpret the argument as. - typedef cef_internal::FunctionTraits - BoundFunctorTraits; - - // Do not allow binding a non-const reference parameter. Non-const reference - // parameters are disallowed by the Google style guide. Also, binding a - // non-const reference parameter can make for subtle bugs because the - // invoked function will receive a reference to the stored copy of the - // argument and not the original. - COMPILE_ASSERT( - !(is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value || - is_non_const_reference::value), - do_not_bind_functions_with_nonconst_ref); - - // For methods, we need to be careful for parameter 1. We do not require - // a scoped_refptr because BindState<> itself takes care of AddRef() for - // methods. We also disallow binding of an array as the method's target - // object. - COMPILE_ASSERT(cef_internal::HasIsMethodTag::value || - !cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p1_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::HasIsMethodTag::value || - !is_array::value, - first_bound_argument_to_method_cannot_be_array); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p2_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p3_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p4_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p5_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p6_is_refcounted_type_and_needs_scoped_refptr); - COMPILE_ASSERT(!cef_internal::NeedsScopedRefptrButGetsRawPtr::value, - p7_is_refcounted_type_and_needs_scoped_refptr); - typedef cef_internal::BindState< - RunnableType, RunType, - void(typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType, - typename cef_internal::CallbackParamTraits::StorageType)> - BindState; - - return Callback(new BindState( - cef_internal::MakeRunnable(functor), p1, p2, p3, p4, p5, p6, p7)); -} - -} // namespace base - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_BIND_H_ diff --git a/third_party/cef/include/base/cef_bind_helpers.h b/third_party/cef/include/base/cef_bind_helpers.h deleted file mode 100644 index 2b4798b2..00000000 --- a/third_party/cef/include/base/cef_bind_helpers.h +++ /dev/null @@ -1,579 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// This defines a set of argument wrappers and related factory methods that -// can be used specify the refcounting and reference semantics of arguments -// that are bound by the Bind() function in base/bind.h. -// -// It also defines a set of simple functions and utilities that people want -// when using Callback<> and Bind(). -// -// -// ARGUMENT BINDING WRAPPERS -// -// The wrapper functions are base::Unretained(), base::Owned(), base::Passed(), -// base::ConstRef(), and base::IgnoreResult(). -// -// Unretained() allows Bind() to bind a non-refcounted class, and to disable -// refcounting on arguments that are refcounted objects. -// -// Owned() transfers ownership of an object to the Callback resulting from -// bind; the object will be deleted when the Callback is deleted. -// -// Passed() is for transferring movable-but-not-copyable types (eg. scoped_ptr) -// through a Callback. Logically, this signifies a destructive transfer of -// the state of the argument into the target function. Invoking -// Callback::Run() twice on a Callback that was created with a Passed() -// argument will CHECK() because the first invocation would have already -// transferred ownership to the target function. -// -// ConstRef() allows binding a constant reference to an argument rather -// than a copy. -// -// IgnoreResult() is used to adapt a function or Callback with a return type to -// one with a void return. This is most useful if you have a function with, -// say, a pesky ignorable bool return that you want to use with PostTask or -// something else that expect a Callback with a void return. -// -// EXAMPLE OF Unretained(): -// -// class Foo { -// public: -// void func() { cout << "Foo:f" << endl; } -// }; -// -// // In some function somewhere. -// Foo foo; -// Closure foo_callback = -// Bind(&Foo::func, Unretained(&foo)); -// foo_callback.Run(); // Prints "Foo:f". -// -// Without the Unretained() wrapper on |&foo|, the above call would fail -// to compile because Foo does not support the AddRef() and Release() methods. -// -// -// EXAMPLE OF Owned(): -// -// void foo(int* arg) { cout << *arg << endl } -// -// int* pn = new int(1); -// Closure foo_callback = Bind(&foo, Owned(pn)); -// -// foo_callback.Run(); // Prints "1" -// foo_callback.Run(); // Prints "1" -// *n = 2; -// foo_callback.Run(); // Prints "2" -// -// foo_callback.Reset(); // |pn| is deleted. Also will happen when -// // |foo_callback| goes out of scope. -// -// Without Owned(), someone would have to know to delete |pn| when the last -// reference to the Callback is deleted. -// -// -// EXAMPLE OF ConstRef(): -// -// void foo(int arg) { cout << arg << endl } -// -// int n = 1; -// Closure no_ref = Bind(&foo, n); -// Closure has_ref = Bind(&foo, ConstRef(n)); -// -// no_ref.Run(); // Prints "1" -// has_ref.Run(); // Prints "1" -// -// n = 2; -// no_ref.Run(); // Prints "1" -// has_ref.Run(); // Prints "2" -// -// Note that because ConstRef() takes a reference on |n|, |n| must outlive all -// its bound callbacks. -// -// -// EXAMPLE OF IgnoreResult(): -// -// int DoSomething(int arg) { cout << arg << endl; } -// -// // Assign to a Callback with a void return type. -// Callback cb = Bind(IgnoreResult(&DoSomething)); -// cb->Run(1); // Prints "1". -// -// // Prints "1" on |ml|. -// ml->PostTask(FROM_HERE, Bind(IgnoreResult(&DoSomething), 1); -// -// -// EXAMPLE OF Passed(): -// -// void TakesOwnership(scoped_ptr arg) { } -// scoped_ptr CreateFoo() { return scoped_ptr(new Foo()); } -// -// scoped_ptr f(new Foo()); -// -// // |cb| is given ownership of Foo(). |f| is now NULL. -// // You can use f.Pass() in place of &f, but it's more verbose. -// Closure cb = Bind(&TakesOwnership, Passed(&f)); -// -// // Run was never called so |cb| still owns Foo() and deletes -// // it on Reset(). -// cb.Reset(); -// -// // |cb| is given a new Foo created by CreateFoo(). -// cb = Bind(&TakesOwnership, Passed(CreateFoo())); -// -// // |arg| in TakesOwnership() is given ownership of Foo(). |cb| -// // no longer owns Foo() and, if reset, would not delete Foo(). -// cb.Run(); // Foo() is now transferred to |arg| and deleted. -// cb.Run(); // This CHECK()s since Foo() already been used once. -// -// Passed() is particularly useful with PostTask() when you are transferring -// ownership of an argument into a task, but don't necessarily know if the -// task will always be executed. This can happen if the task is cancellable -// or if it is posted to a MessageLoopProxy. -// -// -// SIMPLE FUNCTIONS AND UTILITIES. -// -// DoNothing() - Useful for creating a Closure that does nothing when called. -// DeletePointer() - Useful for creating a Closure that will delete a -// pointer when invoked. Only use this when necessary. -// In most cases MessageLoop::DeleteSoon() is a better -// fit. - -#ifndef CEF_INCLUDE_BASE_CEF_BIND_HELPERS_H_ -#define CEF_INCLUDE_BASE_CEF_BIND_HELPERS_H_ -#pragma once - -#if defined(BASE_BIND_HELPERS_H_) -// Do nothing if the Chromium header has already been included. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/bind_helpers.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include "include/base/cef_basictypes.h" -#include "include/base/cef_callback.h" -#include "include/base/cef_template_util.h" -#include "include/base/cef_weak_ptr.h" - -namespace base { -namespace cef_internal { - -// Use the Substitution Failure Is Not An Error (SFINAE) trick to inspect T -// for the existence of AddRef() and Release() functions of the correct -// signature. -// -// http://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error -// http://stackoverflow.com/questions/257288/is-it-possible-to-write-a-c-template-to-check-for-a-functions-existence -// http://stackoverflow.com/questions/4358584/sfinae-approach-comparison -// http://stackoverflow.com/questions/1966362/sfinae-to-check-for-inherited-member-functions -// -// The last link in particular show the method used below. -// -// For SFINAE to work with inherited methods, we need to pull some extra tricks -// with multiple inheritance. In the more standard formulation, the overloads -// of Check would be: -// -// template -// Yes NotTheCheckWeWant(Helper<&C::TargetFunc>*); -// -// template -// No NotTheCheckWeWant(...); -// -// static const bool value = sizeof(NotTheCheckWeWant(0)) == sizeof(Yes); -// -// The problem here is that template resolution will not match -// C::TargetFunc if TargetFunc does not exist directly in C. That is, if -// TargetFunc in inherited from an ancestor, &C::TargetFunc will not match, -// |value| will be false. This formulation only checks for whether or -// not TargetFunc exist directly in the class being introspected. -// -// To get around this, we play a dirty trick with multiple inheritance. -// First, We create a class BaseMixin that declares each function that we -// want to probe for. Then we create a class Base that inherits from both T -// (the class we wish to probe) and BaseMixin. Note that the function -// signature in BaseMixin does not need to match the signature of the function -// we are probing for; thus it's easiest to just use void(void). -// -// Now, if TargetFunc exists somewhere in T, then &Base::TargetFunc has an -// ambiguous resolution between BaseMixin and T. This lets us write the -// following: -// -// template -// No GoodCheck(Helper<&C::TargetFunc>*); -// -// template -// Yes GoodCheck(...); -// -// static const bool value = sizeof(GoodCheck(0)) == sizeof(Yes); -// -// Notice here that the variadic version of GoodCheck() returns Yes here -// instead of No like the previous one. Also notice that we calculate |value| -// by specializing GoodCheck() on Base instead of T. -// -// We've reversed the roles of the variadic, and Helper overloads. -// GoodCheck(Helper<&C::TargetFunc>*), when C = Base, fails to be a valid -// substitution if T::TargetFunc exists. Thus GoodCheck(0) will resolve -// to the variadic version if T has TargetFunc. If T::TargetFunc does not -// exist, then &C::TargetFunc is not ambiguous, and the overload resolution -// will prefer GoodCheck(Helper<&C::TargetFunc>*). -// -// This method of SFINAE will correctly probe for inherited names, but it cannot -// typecheck those names. It's still a good enough sanity check though. -// -// Works on gcc-4.2, gcc-4.4, and Visual Studio 2008. -// -// TODO(ajwong): Move to ref_counted.h or template_util.h when we've vetted -// this works well. -// -// TODO(ajwong): Make this check for Release() as well. -// See http://crbug.com/82038. -template -class SupportsAddRefAndRelease { - typedef char Yes[1]; - typedef char No[2]; - - struct BaseMixin { - void AddRef(); - }; - -// MSVC warns when you try to use Base if T has a private destructor, the -// common pattern for refcounted types. It does this even though no attempt to -// instantiate Base is made. We disable the warning for this definition. -#if defined(OS_WIN) -#pragma warning(push) -#pragma warning(disable : 4624) -#endif - struct Base : public T, public BaseMixin {}; -#if defined(OS_WIN) -#pragma warning(pop) -#endif - - template - struct Helper {}; - - template - static No& Check(Helper<&C::AddRef>*); - - template - static Yes& Check(...); - - public: - static const bool value = sizeof(Check(0)) == sizeof(Yes); -}; - -// Helpers to assert that arguments of a recounted type are bound with a -// scoped_refptr. -template -struct UnsafeBindtoRefCountedArgHelper : false_type {}; - -template -struct UnsafeBindtoRefCountedArgHelper - : integral_constant::value> {}; - -template -struct UnsafeBindtoRefCountedArg : false_type {}; - -template -struct UnsafeBindtoRefCountedArg - : UnsafeBindtoRefCountedArgHelper::value, T> {}; - -template -class HasIsMethodTag { - typedef char Yes[1]; - typedef char No[2]; - - template - static Yes& Check(typename U::IsMethod*); - - template - static No& Check(...); - - public: - static const bool value = sizeof(Check(0)) == sizeof(Yes); -}; - -template -class UnretainedWrapper { - public: - explicit UnretainedWrapper(T* o) : ptr_(o) {} - T* get() const { return ptr_; } - - private: - T* ptr_; -}; - -template -class ConstRefWrapper { - public: - explicit ConstRefWrapper(const T& o) : ptr_(&o) {} - const T& get() const { return *ptr_; } - - private: - const T* ptr_; -}; - -template -struct IgnoreResultHelper { - explicit IgnoreResultHelper(T functor) : functor_(functor) {} - - T functor_; -}; - -template -struct IgnoreResultHelper> { - explicit IgnoreResultHelper(const Callback& functor) : functor_(functor) {} - - const Callback& functor_; -}; - -// An alternate implementation is to avoid the destructive copy, and instead -// specialize ParamTraits<> for OwnedWrapper<> to change the StorageType to -// a class that is essentially a scoped_ptr<>. -// -// The current implementation has the benefit though of leaving ParamTraits<> -// fully in callback_internal.h as well as avoiding type conversions during -// storage. -template -class OwnedWrapper { - public: - explicit OwnedWrapper(T* o) : ptr_(o) {} - ~OwnedWrapper() { delete ptr_; } - T* get() const { return ptr_; } - OwnedWrapper(const OwnedWrapper& other) { - ptr_ = other.ptr_; - other.ptr_ = NULL; - } - - private: - mutable T* ptr_; -}; - -// PassedWrapper is a copyable adapter for a scoper that ignores const. -// -// It is needed to get around the fact that Bind() takes a const reference to -// all its arguments. Because Bind() takes a const reference to avoid -// unnecessary copies, it is incompatible with movable-but-not-copyable -// types; doing a destructive "move" of the type into Bind() would violate -// the const correctness. -// -// This conundrum cannot be solved without either C++11 rvalue references or -// a O(2^n) blowup of Bind() templates to handle each combination of regular -// types and movable-but-not-copyable types. Thus we introduce a wrapper type -// that is copyable to transmit the correct type information down into -// BindState<>. Ignoring const in this type makes sense because it is only -// created when we are explicitly trying to do a destructive move. -// -// Two notes: -// 1) PassedWrapper supports any type that has a "Pass()" function. -// This is intentional. The whitelisting of which specific types we -// support is maintained by CallbackParamTraits<>. -// 2) is_valid_ is distinct from NULL because it is valid to bind a "NULL" -// scoper to a Callback and allow the Callback to execute once. -template -class PassedWrapper { - public: - explicit PassedWrapper(T scoper) : is_valid_(true), scoper_(scoper.Pass()) {} - PassedWrapper(const PassedWrapper& other) - : is_valid_(other.is_valid_), scoper_(other.scoper_.Pass()) {} - T Pass() const { - CHECK(is_valid_); - is_valid_ = false; - return scoper_.Pass(); - } - - private: - mutable bool is_valid_; - mutable T scoper_; -}; - -// Unwrap the stored parameters for the wrappers above. -template -struct UnwrapTraits { - typedef const T& ForwardType; - static ForwardType Unwrap(const T& o) { return o; } -}; - -template -struct UnwrapTraits> { - typedef T* ForwardType; - static ForwardType Unwrap(UnretainedWrapper unretained) { - return unretained.get(); - } -}; - -template -struct UnwrapTraits> { - typedef const T& ForwardType; - static ForwardType Unwrap(ConstRefWrapper const_ref) { - return const_ref.get(); - } -}; - -template -struct UnwrapTraits> { - typedef T* ForwardType; - static ForwardType Unwrap(const scoped_refptr& o) { return o.get(); } -}; - -template -struct UnwrapTraits> { - typedef const WeakPtr& ForwardType; - static ForwardType Unwrap(const WeakPtr& o) { return o; } -}; - -template -struct UnwrapTraits> { - typedef T* ForwardType; - static ForwardType Unwrap(const OwnedWrapper& o) { return o.get(); } -}; - -template -struct UnwrapTraits> { - typedef T ForwardType; - static T Unwrap(PassedWrapper& o) { return o.Pass(); } -}; - -// Utility for handling different refcounting semantics in the Bind() -// function. -template -struct MaybeRefcount; - -template -struct MaybeRefcount { - static void AddRef(const T&) {} - static void Release(const T&) {} -}; - -template -struct MaybeRefcount { - static void AddRef(const T*) {} - static void Release(const T*) {} -}; - -template -struct MaybeRefcount { - static void AddRef(const T&) {} - static void Release(const T&) {} -}; - -template -struct MaybeRefcount { - static void AddRef(T* o) { o->AddRef(); } - static void Release(T* o) { o->Release(); } -}; - -// No need to additionally AddRef() and Release() since we are storing a -// scoped_refptr<> inside the storage object already. -template -struct MaybeRefcount> { - static void AddRef(const scoped_refptr& o) {} - static void Release(const scoped_refptr& o) {} -}; - -template -struct MaybeRefcount { - static void AddRef(const T* o) { o->AddRef(); } - static void Release(const T* o) { o->Release(); } -}; - -// IsWeakMethod is a helper that determine if we are binding a WeakPtr<> to a -// method. It is used internally by Bind() to select the correct -// InvokeHelper that will no-op itself in the event the WeakPtr<> for -// the target object is invalidated. -// -// P1 should be the type of the object that will be received of the method. -template -struct IsWeakMethod : public false_type {}; - -template -struct IsWeakMethod> : public true_type {}; - -template -struct IsWeakMethod>> : public true_type {}; - -} // namespace cef_internal - -template -static inline cef_internal::UnretainedWrapper Unretained(T* o) { - return cef_internal::UnretainedWrapper(o); -} - -template -static inline cef_internal::ConstRefWrapper ConstRef(const T& o) { - return cef_internal::ConstRefWrapper(o); -} - -template -static inline cef_internal::OwnedWrapper Owned(T* o) { - return cef_internal::OwnedWrapper(o); -} - -// We offer 2 syntaxes for calling Passed(). The first takes a temporary and -// is best suited for use with the return value of a function. The second -// takes a pointer to the scoper and is just syntactic sugar to avoid having -// to write Passed(scoper.Pass()). -template -static inline cef_internal::PassedWrapper Passed(T scoper) { - return cef_internal::PassedWrapper(scoper.Pass()); -} -template -static inline cef_internal::PassedWrapper Passed(T* scoper) { - return cef_internal::PassedWrapper(scoper->Pass()); -} - -template -static inline cef_internal::IgnoreResultHelper IgnoreResult(T data) { - return cef_internal::IgnoreResultHelper(data); -} - -template -static inline cef_internal::IgnoreResultHelper> IgnoreResult( - const Callback& data) { - return cef_internal::IgnoreResultHelper>(data); -} - -void DoNothing(); - -template -void DeletePointer(T* obj) { - delete obj; -} - -} // namespace base - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_BIND_HELPERS_H_ diff --git a/third_party/cef/include/base/cef_build.h b/third_party/cef/include/base/cef_build.h deleted file mode 100644 index 5f3a8639..00000000 --- a/third_party/cef/include/base/cef_build.h +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef CEF_INCLUDE_BASE_CEF_BUILD_H_ -#define CEF_INCLUDE_BASE_CEF_BUILD_H_ -#pragma once - -#if defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/compiler_specific.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#if defined(_WIN32) -#ifndef OS_WIN -#define OS_WIN 1 -#endif -#elif defined(__APPLE__) -#ifndef OS_MACOSX -#define OS_MACOSX 1 -#endif -#elif defined(__linux__) -#ifndef OS_LINUX -#define OS_LINUX 1 -#endif -#else -#error Please add support for your platform in cef_build.h -#endif - -// For access to standard POSIXish features, use OS_POSIX instead of a -// more specific macro. -#if defined(OS_MACOSX) || defined(OS_LINUX) -#ifndef OS_POSIX -#define OS_POSIX 1 -#endif -#endif - -// Compiler detection. -#if defined(__GNUC__) -#ifndef COMPILER_GCC -#define COMPILER_GCC 1 -#endif -#elif defined(_MSC_VER) -#ifndef COMPILER_MSVC -#define COMPILER_MSVC 1 -#endif -#else -#error Please add support for your compiler in cef_build.h -#endif - -// Processor architecture detection. For more info on what's defined, see: -// http://msdn.microsoft.com/en-us/library/b0084kay.aspx -// http://www.agner.org/optimize/calling_conventions.pdf -// or with gcc, run: "echo | gcc -E -dM -" -#if defined(_M_X64) || defined(__x86_64__) -#define ARCH_CPU_X86_FAMILY 1 -#define ARCH_CPU_X86_64 1 -#define ARCH_CPU_64_BITS 1 -#define ARCH_CPU_LITTLE_ENDIAN 1 -#elif defined(_M_IX86) || defined(__i386__) -#define ARCH_CPU_X86_FAMILY 1 -#define ARCH_CPU_X86 1 -#define ARCH_CPU_32_BITS 1 -#define ARCH_CPU_LITTLE_ENDIAN 1 -#elif defined(__ARMEL__) -#define ARCH_CPU_ARM_FAMILY 1 -#define ARCH_CPU_ARMEL 1 -#define ARCH_CPU_32_BITS 1 -#define ARCH_CPU_LITTLE_ENDIAN 1 -#elif defined(__aarch64__) -#define ARCH_CPU_ARM_FAMILY 1 -#define ARCH_CPU_ARM64 1 -#define ARCH_CPU_64_BITS 1 -#define ARCH_CPU_LITTLE_ENDIAN 1 -#elif defined(__pnacl__) -#define ARCH_CPU_32_BITS 1 -#define ARCH_CPU_LITTLE_ENDIAN 1 -#elif defined(__MIPSEL__) -#define ARCH_CPU_MIPS_FAMILY 1 -#define ARCH_CPU_MIPSEL 1 -#define ARCH_CPU_32_BITS 1 -#define ARCH_CPU_LITTLE_ENDIAN 1 -#else -#error Please add support for your architecture in cef_build.h -#endif - -// Type detection for wchar_t. -#if defined(OS_WIN) -#define WCHAR_T_IS_UTF16 -#elif defined(OS_POSIX) && defined(COMPILER_GCC) && defined(__WCHAR_MAX__) && \ - (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff) -#define WCHAR_T_IS_UTF32 -#elif defined(OS_POSIX) && defined(COMPILER_GCC) && defined(__WCHAR_MAX__) && \ - (__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff) -// On Posix, we'll detect short wchar_t, but projects aren't guaranteed to -// compile in this mode (in particular, Chrome doesn't). This is intended for -// other projects using base who manage their own dependencies and make sure -// short wchar works for them. -#define WCHAR_T_IS_UTF16 -#else -#error Please add support for your compiler in cef_build.h -#endif - -// Annotate a function indicating the caller must examine the return value. -// Use like: -// int foo() WARN_UNUSED_RESULT; -// To explicitly ignore a result, see |ignore_result()| in . -#ifndef WARN_UNUSED_RESULT -#if defined(COMPILER_GCC) -#define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) -#else -#define WARN_UNUSED_RESULT -#endif -#endif // WARN_UNUSED_RESULT - -// Annotate a typedef or function indicating it's ok if it's not used. -// Use like: -// typedef Foo Bar ALLOW_UNUSED_TYPE; -#ifndef ALLOW_UNUSED_TYPE -#if defined(COMPILER_GCC) -#define ALLOW_UNUSED_TYPE __attribute__((unused)) -#else -#define ALLOW_UNUSED_TYPE -#endif -#endif // ALLOW_UNUSED_TYPE - -// Annotate a variable indicating it's ok if the variable is not used. -// (Typically used to silence a compiler warning when the assignment -// is important for some other reason.) -// Use like: -// int x = ...; -// ALLOW_UNUSED_LOCAL(x); -#ifndef ALLOW_UNUSED_LOCAL -#define ALLOW_UNUSED_LOCAL(x) false ? (void)x : (void)0 -#endif - -// Sanitizers annotations. -#if defined(__has_attribute) -#if __has_attribute(no_sanitize) -#define NO_SANITIZE(what) __attribute__((no_sanitize(what))) -#endif -#endif -#if !defined(NO_SANITIZE) -#define NO_SANITIZE(what) -#endif - -#endif // !USING_CHROMIUM_INCLUDES - -// Annotate a virtual method indicating it must be overriding a virtual method -// in the parent class. -// Use like: -// void foo() OVERRIDE; -// NOTE: This define should only be used in classes exposed to the client since -// C++11 support may not be enabled in client applications. CEF internal classes -// should use the `override` keyword directly. -#ifndef OVERRIDE -#if defined(__clang__) -#define OVERRIDE override -#elif defined(COMPILER_MSVC) && _MSC_VER >= 1600 -// Visual Studio 2010 and later support override. -#define OVERRIDE override -#elif defined(COMPILER_GCC) && __cplusplus >= 201103 && \ - (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40700 -// GCC 4.7 supports explicit virtual overrides when C++11 support is enabled. -#define OVERRIDE override -#else -#define OVERRIDE -#endif -#endif // OVERRIDE - -// Check for C++11 template alias support which was added in VS2013 and GCC4.7. -// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf -#if __cplusplus > 199711L || (defined(_MSC_VER) && _MSC_VER >= 1800) || \ - (defined(__GNUC__) && \ - (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ >= 40700)) -#define HAS_CPP11_TEMPLATE_ALIAS_SUPPORT -#endif - -#endif // CEF_INCLUDE_BASE_CEF_BUILD_H_ diff --git a/third_party/cef/include/base/cef_callback.h b/third_party/cef/include/base/cef_callback.h deleted file mode 100644 index 16e238a9..00000000 --- a/third_party/cef/include/base/cef_callback.h +++ /dev/null @@ -1,801 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef CEF_INCLUDE_BASE_CEF_CALLBACK_H_ -#define CEF_INCLUDE_BASE_CEF_CALLBACK_H_ -#pragma once - -#if defined(BASE_CALLBACK_H_) -// Do nothing if the Chromium header has already been included. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/callback.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include "include/base/cef_callback_forward.h" -#include "include/base/cef_template_util.h" -#include "include/base/internal/cef_callback_internal.h" - -// NOTE: Header files that do not require the full definition of Callback or -// Closure should #include "base/cef_callback_forward.h" instead of this file. - -// ----------------------------------------------------------------------------- -// Introduction -// ----------------------------------------------------------------------------- -// -// The templated Callback class is a generalized function object. Together -// with the Bind() function in bind.h, they provide a type-safe method for -// performing partial application of functions. -// -// Partial application (or "currying") is the process of binding a subset of -// a function's arguments to produce another function that takes fewer -// arguments. This can be used to pass around a unit of delayed execution, -// much like lexical closures are used in other languages. For example, it -// is used in Chromium code to schedule tasks on different MessageLoops. -// -// A callback with no unbound input parameters (base::Callback) -// is called a base::Closure. Note that this is NOT the same as what other -// languages refer to as a closure -- it does not retain a reference to its -// enclosing environment. -// -// MEMORY MANAGEMENT AND PASSING -// -// The Callback objects themselves should be passed by const-reference, and -// stored by copy. They internally store their state via a refcounted class -// and thus do not need to be deleted. -// -// The reason to pass via a const-reference is to avoid unnecessary -// AddRef/Release pairs to the internal state. -// -// -// ----------------------------------------------------------------------------- -// Quick reference for basic stuff -// ----------------------------------------------------------------------------- -// -// BINDING A BARE FUNCTION -// -// int Return5() { return 5; } -// base::Callback func_cb = base::Bind(&Return5); -// LOG(INFO) << func_cb.Run(); // Prints 5. -// -// BINDING A CLASS METHOD -// -// The first argument to bind is the member function to call, the second is -// the object on which to call it. -// -// class Ref : public base::RefCountedThreadSafe { -// public: -// int Foo() { return 3; } -// void PrintBye() { LOG(INFO) << "bye."; } -// }; -// scoped_refptr ref = new Ref(); -// base::Callback ref_cb = base::Bind(&Ref::Foo, ref); -// LOG(INFO) << ref_cb.Run(); // Prints out 3. -// -// By default the object must support RefCounted or you will get a compiler -// error. If you're passing between threads, be sure it's -// RefCountedThreadSafe! See "Advanced binding of member functions" below if -// you don't want to use reference counting. -// -// RUNNING A CALLBACK -// -// Callbacks can be run with their "Run" method, which has the same -// signature as the template argument to the callback. -// -// void DoSomething(const base::Callback& callback) { -// callback.Run(5, "hello"); -// } -// -// Callbacks can be run more than once (they don't get deleted or marked when -// run). However, this precludes using base::Passed (see below). -// -// void DoSomething(const base::Callback& callback) { -// double myresult = callback.Run(3.14159); -// myresult += callback.Run(2.71828); -// } -// -// PASSING UNBOUND INPUT PARAMETERS -// -// Unbound parameters are specified at the time a callback is Run(). They are -// specified in the Callback template type: -// -// void MyFunc(int i, const std::string& str) {} -// base::Callback cb = base::Bind(&MyFunc); -// cb.Run(23, "hello, world"); -// -// PASSING BOUND INPUT PARAMETERS -// -// Bound parameters are specified when you create thee callback as arguments -// to Bind(). They will be passed to the function and the Run()ner of the -// callback doesn't see those values or even know that the function it's -// calling. -// -// void MyFunc(int i, const std::string& str) {} -// base::Callback cb = base::Bind(&MyFunc, 23, "hello world"); -// cb.Run(); -// -// A callback with no unbound input parameters (base::Callback) -// is called a base::Closure. So we could have also written: -// -// base::Closure cb = base::Bind(&MyFunc, 23, "hello world"); -// -// When calling member functions, bound parameters just go after the object -// pointer. -// -// base::Closure cb = base::Bind(&MyClass::MyFunc, this, 23, "hello world"); -// -// PARTIAL BINDING OF PARAMETERS -// -// You can specify some parameters when you create the callback, and specify -// the rest when you execute the callback. -// -// void MyFunc(int i, const std::string& str) {} -// base::Callback cb = base::Bind(&MyFunc, 23); -// cb.Run("hello world"); -// -// When calling a function bound parameters are first, followed by unbound -// parameters. -// -// -// ----------------------------------------------------------------------------- -// Quick reference for advanced binding -// ----------------------------------------------------------------------------- -// -// BINDING A CLASS METHOD WITH WEAK POINTERS -// -// base::Bind(&MyClass::Foo, GetWeakPtr()); -// -// The callback will not be run if the object has already been destroyed. -// DANGER: weak pointers are not threadsafe, so don't use this -// when passing between threads! -// -// BINDING A CLASS METHOD WITH MANUAL LIFETIME MANAGEMENT -// -// base::Bind(&MyClass::Foo, base::Unretained(this)); -// -// This disables all lifetime management on the object. You're responsible -// for making sure the object is alive at the time of the call. You break it, -// you own it! -// -// BINDING A CLASS METHOD AND HAVING THE CALLBACK OWN THE CLASS -// -// MyClass* myclass = new MyClass; -// base::Bind(&MyClass::Foo, base::Owned(myclass)); -// -// The object will be deleted when the callback is destroyed, even if it's -// not run (like if you post a task during shutdown). Potentially useful for -// "fire and forget" cases. -// -// IGNORING RETURN VALUES -// -// Sometimes you want to call a function that returns a value in a callback -// that doesn't expect a return value. -// -// int DoSomething(int arg) { cout << arg << endl; } -// base::Callback) cb = -// base::Bind(base::IgnoreResult(&DoSomething)); -// -// -// ----------------------------------------------------------------------------- -// Quick reference for binding parameters to Bind() -// ----------------------------------------------------------------------------- -// -// Bound parameters are specified as arguments to Bind() and are passed to the -// function. A callback with no parameters or no unbound parameters is called a -// Closure (base::Callback and base::Closure are the same thing). -// -// PASSING PARAMETERS OWNED BY THE CALLBACK -// -// void Foo(int* arg) { cout << *arg << endl; } -// int* pn = new int(1); -// base::Closure foo_callback = base::Bind(&foo, base::Owned(pn)); -// -// The parameter will be deleted when the callback is destroyed, even if it's -// not run (like if you post a task during shutdown). -// -// PASSING PARAMETERS AS A scoped_ptr -// -// void TakesOwnership(scoped_ptr arg) {} -// scoped_ptr f(new Foo); -// // f becomes null during the following call. -// base::Closure cb = base::Bind(&TakesOwnership, base::Passed(&f)); -// -// Ownership of the parameter will be with the callback until the it is run, -// when ownership is passed to the callback function. This means the callback -// can only be run once. If the callback is never run, it will delete the -// object when it's destroyed. -// -// PASSING PARAMETERS AS A scoped_refptr -// -// void TakesOneRef(scoped_refptr arg) {} -// scoped_refptr f(new Foo) -// base::Closure cb = base::Bind(&TakesOneRef, f); -// -// This should "just work." The closure will take a reference as long as it -// is alive, and another reference will be taken for the called function. -// -// PASSING PARAMETERS BY REFERENCE -// -// Const references are *copied* unless ConstRef is used. Example: -// -// void foo(const int& arg) { printf("%d %p\n", arg, &arg); } -// int n = 1; -// base::Closure has_copy = base::Bind(&foo, n); -// base::Closure has_ref = base::Bind(&foo, base::ConstRef(n)); -// n = 2; -// foo(n); // Prints "2 0xaaaaaaaaaaaa" -// has_copy.Run(); // Prints "1 0xbbbbbbbbbbbb" -// has_ref.Run(); // Prints "2 0xaaaaaaaaaaaa" -// -// Normally parameters are copied in the closure. DANGER: ConstRef stores a -// const reference instead, referencing the original parameter. This means -// that you must ensure the object outlives the callback! -// -// -// ----------------------------------------------------------------------------- -// Implementation notes -// ----------------------------------------------------------------------------- -// -// WHERE IS THIS DESIGN FROM: -// -// The design Callback and Bind is heavily influenced by C++'s -// tr1::function/tr1::bind, and by the "Google Callback" system used inside -// Google. -// -// -// HOW THE IMPLEMENTATION WORKS: -// -// There are three main components to the system: -// 1) The Callback classes. -// 2) The Bind() functions. -// 3) The arguments wrappers (e.g., Unretained() and ConstRef()). -// -// The Callback classes represent a generic function pointer. Internally, -// it stores a refcounted piece of state that represents the target function -// and all its bound parameters. Each Callback specialization has a templated -// constructor that takes an BindState<>*. In the context of the constructor, -// the static type of this BindState<> pointer uniquely identifies the -// function it is representing, all its bound parameters, and a Run() method -// that is capable of invoking the target. -// -// Callback's constructor takes the BindState<>* that has the full static type -// and erases the target function type as well as the types of the bound -// parameters. It does this by storing a pointer to the specific Run() -// function, and upcasting the state of BindState<>* to a -// BindStateBase*. This is safe as long as this BindStateBase pointer -// is only used with the stored Run() pointer. -// -// To BindState<> objects are created inside the Bind() functions. -// These functions, along with a set of internal templates, are responsible for -// -// - Unwrapping the function signature into return type, and parameters -// - Determining the number of parameters that are bound -// - Creating the BindState storing the bound parameters -// - Performing compile-time asserts to avoid error-prone behavior -// - Returning an Callback<> with an arity matching the number of unbound -// parameters and that knows the correct refcounting semantics for the -// target object if we are binding a method. -// -// The Bind functions do the above using type-inference, and template -// specializations. -// -// By default Bind() will store copies of all bound parameters, and attempt -// to refcount a target object if the function being bound is a class method. -// These copies are created even if the function takes parameters as const -// references. (Binding to non-const references is forbidden, see bind.h.) -// -// To change this behavior, we introduce a set of argument wrappers -// (e.g., Unretained(), and ConstRef()). These are simple container templates -// that are passed by value, and wrap a pointer to argument. See the -// file-level comment in base/bind_helpers.h for more info. -// -// These types are passed to the Unwrap() functions, and the MaybeRefcount() -// functions respectively to modify the behavior of Bind(). The Unwrap() -// and MaybeRefcount() functions change behavior by doing partial -// specialization based on whether or not a parameter is a wrapper type. -// -// ConstRef() is similar to tr1::cref. Unretained() is specific to Chromium. -// -// -// WHY NOT TR1 FUNCTION/BIND? -// -// Direct use of tr1::function and tr1::bind was considered, but ultimately -// rejected because of the number of copy constructors invocations involved -// in the binding of arguments during construction, and the forwarding of -// arguments during invocation. These copies will no longer be an issue in -// C++0x because C++0x will support rvalue reference allowing for the compiler -// to avoid these copies. However, waiting for C++0x is not an option. -// -// Measured with valgrind on gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5), the -// tr1::bind call itself will invoke a non-trivial copy constructor three times -// for each bound parameter. Also, each when passing a tr1::function, each -// bound argument will be copied again. -// -// In addition to the copies taken at binding and invocation, copying a -// tr1::function causes a copy to be made of all the bound parameters and -// state. -// -// Furthermore, in Chromium, it is desirable for the Callback to take a -// reference on a target object when representing a class method call. This -// is not supported by tr1. -// -// Lastly, tr1::function and tr1::bind has a more general and flexible API. -// This includes things like argument reordering by use of -// tr1::bind::placeholder, support for non-const reference parameters, and some -// limited amount of subtyping of the tr1::function object (e.g., -// tr1::function is convertible to tr1::function). -// -// These are not features that are required in Chromium. Some of them, such as -// allowing for reference parameters, and subtyping of functions, may actually -// become a source of errors. Removing support for these features actually -// allows for a simpler implementation, and a terser Currying API. -// -// -// WHY NOT GOOGLE CALLBACKS? -// -// The Google callback system also does not support refcounting. Furthermore, -// its implementation has a number of strange edge cases with respect to type -// conversion of its arguments. In particular, the argument's constness must -// at times match exactly the function signature, or the type-inference might -// break. Given the above, writing a custom solution was easier. -// -// -// MISSING FUNCTIONALITY -// - Invoking the return of Bind. Bind(&foo).Run() does not work; -// - Binding arrays to functions that take a non-const pointer. -// Example: -// void Foo(const char* ptr); -// void Bar(char* ptr); -// Bind(&Foo, "test"); -// Bind(&Bar, "test"); // This fails because ptr is not const. - -namespace base { - -// First, we forward declare the Callback class template. This informs the -// compiler that the template only has 1 type parameter which is the function -// signature that the Callback is representing. -// -// After this, create template specializations for 0-7 parameters. Note that -// even though the template typelist grows, the specialization still -// only has one type: the function signature. -// -// If you are thinking of forward declaring Callback in your own header file, -// please include "base/callback_forward.h" instead. -template -class Callback; - -namespace cef_internal { -template -struct BindState; -} // namespace cef_internal - -template -class Callback : public cef_internal::CallbackBase { - public: - typedef R(RunType)(); - - Callback() : CallbackBase(NULL) {} - - // Note that this constructor CANNOT be explicit, and that Bind() CANNOT - // return the exact Callback<> type. See base/bind.h for details. - template - Callback( - cef_internal::BindState* bind_state) - : CallbackBase(bind_state) { - // Force the assignment to a local variable of PolymorphicInvoke - // so the compiler will typecheck that the passed in Run() method has - // the correct type. - PolymorphicInvoke invoke_func = - &cef_internal::BindState::InvokerType::Run; - polymorphic_invoke_ = reinterpret_cast(invoke_func); - } - - bool Equals(const Callback& other) const { - return CallbackBase::Equals(other); - } - - R Run() const { - PolymorphicInvoke f = - reinterpret_cast(polymorphic_invoke_); - - return f(bind_state_.get()); - } - - private: - typedef R (*PolymorphicInvoke)(cef_internal::BindStateBase*); -}; - -template -class Callback : public cef_internal::CallbackBase { - public: - typedef R(RunType)(A1); - - Callback() : CallbackBase(NULL) {} - - // Note that this constructor CANNOT be explicit, and that Bind() CANNOT - // return the exact Callback<> type. See base/bind.h for details. - template - Callback( - cef_internal::BindState* bind_state) - : CallbackBase(bind_state) { - // Force the assignment to a local variable of PolymorphicInvoke - // so the compiler will typecheck that the passed in Run() method has - // the correct type. - PolymorphicInvoke invoke_func = - &cef_internal::BindState::InvokerType::Run; - polymorphic_invoke_ = reinterpret_cast(invoke_func); - } - - bool Equals(const Callback& other) const { - return CallbackBase::Equals(other); - } - - R Run(typename cef_internal::CallbackParamTraits::ForwardType a1) const { - PolymorphicInvoke f = - reinterpret_cast(polymorphic_invoke_); - - return f(bind_state_.get(), cef_internal::CallbackForward(a1)); - } - - private: - typedef R (*PolymorphicInvoke)( - cef_internal::BindStateBase*, - typename cef_internal::CallbackParamTraits::ForwardType); -}; - -template -class Callback : public cef_internal::CallbackBase { - public: - typedef R(RunType)(A1, A2); - - Callback() : CallbackBase(NULL) {} - - // Note that this constructor CANNOT be explicit, and that Bind() CANNOT - // return the exact Callback<> type. See base/bind.h for details. - template - Callback( - cef_internal::BindState* bind_state) - : CallbackBase(bind_state) { - // Force the assignment to a local variable of PolymorphicInvoke - // so the compiler will typecheck that the passed in Run() method has - // the correct type. - PolymorphicInvoke invoke_func = - &cef_internal::BindState::InvokerType::Run; - polymorphic_invoke_ = reinterpret_cast(invoke_func); - } - - bool Equals(const Callback& other) const { - return CallbackBase::Equals(other); - } - - R Run(typename cef_internal::CallbackParamTraits::ForwardType a1, - typename cef_internal::CallbackParamTraits::ForwardType a2) const { - PolymorphicInvoke f = - reinterpret_cast(polymorphic_invoke_); - - return f(bind_state_.get(), cef_internal::CallbackForward(a1), - cef_internal::CallbackForward(a2)); - } - - private: - typedef R (*PolymorphicInvoke)( - cef_internal::BindStateBase*, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType); -}; - -template -class Callback : public cef_internal::CallbackBase { - public: - typedef R(RunType)(A1, A2, A3); - - Callback() : CallbackBase(NULL) {} - - // Note that this constructor CANNOT be explicit, and that Bind() CANNOT - // return the exact Callback<> type. See base/bind.h for details. - template - Callback( - cef_internal::BindState* bind_state) - : CallbackBase(bind_state) { - // Force the assignment to a local variable of PolymorphicInvoke - // so the compiler will typecheck that the passed in Run() method has - // the correct type. - PolymorphicInvoke invoke_func = - &cef_internal::BindState::InvokerType::Run; - polymorphic_invoke_ = reinterpret_cast(invoke_func); - } - - bool Equals(const Callback& other) const { - return CallbackBase::Equals(other); - } - - R Run(typename cef_internal::CallbackParamTraits::ForwardType a1, - typename cef_internal::CallbackParamTraits::ForwardType a2, - typename cef_internal::CallbackParamTraits::ForwardType a3) const { - PolymorphicInvoke f = - reinterpret_cast(polymorphic_invoke_); - - return f(bind_state_.get(), cef_internal::CallbackForward(a1), - cef_internal::CallbackForward(a2), - cef_internal::CallbackForward(a3)); - } - - private: - typedef R (*PolymorphicInvoke)( - cef_internal::BindStateBase*, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType); -}; - -template -class Callback : public cef_internal::CallbackBase { - public: - typedef R(RunType)(A1, A2, A3, A4); - - Callback() : CallbackBase(NULL) {} - - // Note that this constructor CANNOT be explicit, and that Bind() CANNOT - // return the exact Callback<> type. See base/bind.h for details. - template - Callback( - cef_internal::BindState* bind_state) - : CallbackBase(bind_state) { - // Force the assignment to a local variable of PolymorphicInvoke - // so the compiler will typecheck that the passed in Run() method has - // the correct type. - PolymorphicInvoke invoke_func = - &cef_internal::BindState::InvokerType::Run; - polymorphic_invoke_ = reinterpret_cast(invoke_func); - } - - bool Equals(const Callback& other) const { - return CallbackBase::Equals(other); - } - - R Run(typename cef_internal::CallbackParamTraits::ForwardType a1, - typename cef_internal::CallbackParamTraits::ForwardType a2, - typename cef_internal::CallbackParamTraits::ForwardType a3, - typename cef_internal::CallbackParamTraits::ForwardType a4) const { - PolymorphicInvoke f = - reinterpret_cast(polymorphic_invoke_); - - return f(bind_state_.get(), cef_internal::CallbackForward(a1), - cef_internal::CallbackForward(a2), - cef_internal::CallbackForward(a3), - cef_internal::CallbackForward(a4)); - } - - private: - typedef R (*PolymorphicInvoke)( - cef_internal::BindStateBase*, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType); -}; - -template -class Callback : public cef_internal::CallbackBase { - public: - typedef R(RunType)(A1, A2, A3, A4, A5); - - Callback() : CallbackBase(NULL) {} - - // Note that this constructor CANNOT be explicit, and that Bind() CANNOT - // return the exact Callback<> type. See base/bind.h for details. - template - Callback( - cef_internal::BindState* bind_state) - : CallbackBase(bind_state) { - // Force the assignment to a local variable of PolymorphicInvoke - // so the compiler will typecheck that the passed in Run() method has - // the correct type. - PolymorphicInvoke invoke_func = - &cef_internal::BindState::InvokerType::Run; - polymorphic_invoke_ = reinterpret_cast(invoke_func); - } - - bool Equals(const Callback& other) const { - return CallbackBase::Equals(other); - } - - R Run(typename cef_internal::CallbackParamTraits::ForwardType a1, - typename cef_internal::CallbackParamTraits::ForwardType a2, - typename cef_internal::CallbackParamTraits::ForwardType a3, - typename cef_internal::CallbackParamTraits::ForwardType a4, - typename cef_internal::CallbackParamTraits::ForwardType a5) const { - PolymorphicInvoke f = - reinterpret_cast(polymorphic_invoke_); - - return f( - bind_state_.get(), cef_internal::CallbackForward(a1), - cef_internal::CallbackForward(a2), cef_internal::CallbackForward(a3), - cef_internal::CallbackForward(a4), cef_internal::CallbackForward(a5)); - } - - private: - typedef R (*PolymorphicInvoke)( - cef_internal::BindStateBase*, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType); -}; - -template -class Callback : public cef_internal::CallbackBase { - public: - typedef R(RunType)(A1, A2, A3, A4, A5, A6); - - Callback() : CallbackBase(NULL) {} - - // Note that this constructor CANNOT be explicit, and that Bind() CANNOT - // return the exact Callback<> type. See base/bind.h for details. - template - Callback( - cef_internal::BindState* bind_state) - : CallbackBase(bind_state) { - // Force the assignment to a local variable of PolymorphicInvoke - // so the compiler will typecheck that the passed in Run() method has - // the correct type. - PolymorphicInvoke invoke_func = - &cef_internal::BindState::InvokerType::Run; - polymorphic_invoke_ = reinterpret_cast(invoke_func); - } - - bool Equals(const Callback& other) const { - return CallbackBase::Equals(other); - } - - R Run(typename cef_internal::CallbackParamTraits::ForwardType a1, - typename cef_internal::CallbackParamTraits::ForwardType a2, - typename cef_internal::CallbackParamTraits::ForwardType a3, - typename cef_internal::CallbackParamTraits::ForwardType a4, - typename cef_internal::CallbackParamTraits::ForwardType a5, - typename cef_internal::CallbackParamTraits::ForwardType a6) const { - PolymorphicInvoke f = - reinterpret_cast(polymorphic_invoke_); - - return f( - bind_state_.get(), cef_internal::CallbackForward(a1), - cef_internal::CallbackForward(a2), cef_internal::CallbackForward(a3), - cef_internal::CallbackForward(a4), cef_internal::CallbackForward(a5), - cef_internal::CallbackForward(a6)); - } - - private: - typedef R (*PolymorphicInvoke)( - cef_internal::BindStateBase*, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType); -}; - -template -class Callback - : public cef_internal::CallbackBase { - public: - typedef R(RunType)(A1, A2, A3, A4, A5, A6, A7); - - Callback() : CallbackBase(NULL) {} - - // Note that this constructor CANNOT be explicit, and that Bind() CANNOT - // return the exact Callback<> type. See base/bind.h for details. - template - Callback( - cef_internal::BindState* bind_state) - : CallbackBase(bind_state) { - // Force the assignment to a local variable of PolymorphicInvoke - // so the compiler will typecheck that the passed in Run() method has - // the correct type. - PolymorphicInvoke invoke_func = - &cef_internal::BindState::InvokerType::Run; - polymorphic_invoke_ = reinterpret_cast(invoke_func); - } - - bool Equals(const Callback& other) const { - return CallbackBase::Equals(other); - } - - R Run(typename cef_internal::CallbackParamTraits::ForwardType a1, - typename cef_internal::CallbackParamTraits::ForwardType a2, - typename cef_internal::CallbackParamTraits::ForwardType a3, - typename cef_internal::CallbackParamTraits::ForwardType a4, - typename cef_internal::CallbackParamTraits::ForwardType a5, - typename cef_internal::CallbackParamTraits::ForwardType a6, - typename cef_internal::CallbackParamTraits::ForwardType a7) const { - PolymorphicInvoke f = - reinterpret_cast(polymorphic_invoke_); - - return f( - bind_state_.get(), cef_internal::CallbackForward(a1), - cef_internal::CallbackForward(a2), cef_internal::CallbackForward(a3), - cef_internal::CallbackForward(a4), cef_internal::CallbackForward(a5), - cef_internal::CallbackForward(a6), cef_internal::CallbackForward(a7)); - } - - private: - typedef R (*PolymorphicInvoke)( - cef_internal::BindStateBase*, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType, - typename cef_internal::CallbackParamTraits::ForwardType); -}; - -// Syntactic sugar to make Callbacks easier to declare since it -// will be used in a lot of APIs with delayed execution. -typedef Callback Closure; - -} // namespace base - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_CALLBACK_H_ diff --git a/third_party/cef/include/base/cef_callback_forward.h b/third_party/cef/include/base/cef_callback_forward.h deleted file mode 100644 index d604d7cf..00000000 --- a/third_party/cef/include/base/cef_callback_forward.h +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef INCLUDE_BASE_CEF_CALLBACK_FORWARD_H_ -#define INCLUDE_BASE_CEF_CALLBACK_FORWARD_H_ -#pragma once - -#if defined(BASE_CALLBACK_FORWARD_H_) -// Do nothing if the Chromium header has already been included. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/callback_forward.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -namespace base { - -template -class Callback; - -typedef Callback Closure; - -} // namespace base - -#endif // !!USING_CHROMIUM_INCLUDES - -#endif // INCLUDE_BASE_CEF_CALLBACK_FORWARD_H_ diff --git a/third_party/cef/include/base/cef_callback_helpers.h b/third_party/cef/include/base/cef_callback_helpers.h deleted file mode 100644 index ebe074a1..00000000 --- a/third_party/cef/include/base/cef_callback_helpers.h +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// This defines helpful methods for dealing with Callbacks. Because Callbacks -// are implemented using templates, with a class per callback signature, adding -// methods to Callback<> itself is unattractive (lots of extra code gets -// generated). Instead, consider adding methods here. -// -// ResetAndReturn(&cb) is like cb.Reset() but allows executing a callback (via a -// copy) after the original callback is Reset(). This can be handy if Run() -// reads/writes the variable holding the Callback. - -#ifndef CEF_INCLUDE_BASE_CEF_CALLBACK_HELPERS_H_ -#define CEF_INCLUDE_BASE_CEF_CALLBACK_HELPERS_H_ -#pragma once - -#if defined(BASE_CALLBACK_HELPERS_H_) -// Do nothing if the Chromium header has already been included. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/callback_helpers.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include "include/base/cef_basictypes.h" -#include "include/base/cef_build.h" -#include "include/base/cef_callback.h" -#include "include/base/cef_macros.h" - -namespace base { - -template -base::Callback ResetAndReturn(base::Callback* cb) { - base::Callback ret(*cb); - cb->Reset(); - return ret; -} - -// ScopedClosureRunner is akin to scoped_ptr for Closures. It ensures that the -// Closure is executed and deleted no matter how the current scope exits. -class ScopedClosureRunner { - public: - ScopedClosureRunner(); - explicit ScopedClosureRunner(const Closure& closure); - ~ScopedClosureRunner(); - - void Reset(); - void Reset(const Closure& closure); - Closure Release() WARN_UNUSED_RESULT; - - private: - Closure closure_; - - DISALLOW_COPY_AND_ASSIGN(ScopedClosureRunner); -}; - -} // namespace base - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_CALLBACK_HELPERS_H_ diff --git a/third_party/cef/include/base/cef_callback_list.h b/third_party/cef/include/base/cef_callback_list.h deleted file mode 100644 index e0ef3665..00000000 --- a/third_party/cef/include/base/cef_callback_list.h +++ /dev/null @@ -1,449 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2013 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef CEF_INCLUDE_BASE_CEF_CALLBACK_LIST_H_ -#define CEF_INCLUDE_BASE_CEF_CALLBACK_LIST_H_ -#pragma once - -#if defined(BASE_CALLBACK_LIST_H_) -// Do nothing if the Chromium header has already been included. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/callback_list.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include - -#include "include/base/cef_basictypes.h" -#include "include/base/cef_build.h" -#include "include/base/cef_callback.h" -#include "include/base/cef_logging.h" -#include "include/base/cef_macros.h" -#include "include/base/cef_scoped_ptr.h" -#include "include/base/internal/cef_callback_internal.h" - -// OVERVIEW: -// -// A container for a list of callbacks. Unlike a normal STL vector or list, -// this container can be modified during iteration without invalidating the -// iterator. It safely handles the case of a callback removing itself -// or another callback from the list while callbacks are being run. -// -// TYPICAL USAGE: -// -// class MyWidget { -// public: -// ... -// -// typedef base::Callback OnFooCallback; -// -// scoped_ptr::Subscription> -// RegisterCallback(const OnFooCallback& cb) { -// return callback_list_.Add(cb); -// } -// -// private: -// void NotifyFoo(const Foo& foo) { -// callback_list_.Notify(foo); -// } -// -// base::CallbackList callback_list_; -// -// DISALLOW_COPY_AND_ASSIGN(MyWidget); -// }; -// -// -// class MyWidgetListener { -// public: -// MyWidgetListener::MyWidgetListener() { -// foo_subscription_ = MyWidget::GetCurrent()->RegisterCallback( -// base::Bind(&MyWidgetListener::OnFoo, this))); -// } -// -// MyWidgetListener::~MyWidgetListener() { -// // Subscription gets deleted automatically and will deregister -// // the callback in the process. -// } -// -// private: -// void OnFoo(const Foo& foo) { -// // Do something. -// } -// -// scoped_ptr::Subscription> -// foo_subscription_; -// -// DISALLOW_COPY_AND_ASSIGN(MyWidgetListener); -// }; - -namespace base { - -namespace cef_internal { - -template -class CallbackListBase { - public: - class Subscription { - public: - Subscription(CallbackListBase* list, - typename std::list::iterator iter) - : list_(list), iter_(iter) {} - - ~Subscription() { - if (list_->active_iterator_count_) { - iter_->Reset(); - } else { - list_->callbacks_.erase(iter_); - if (!list_->removal_callback_.is_null()) - list_->removal_callback_.Run(); - } - } - - private: - CallbackListBase* list_; - typename std::list::iterator iter_; - - DISALLOW_COPY_AND_ASSIGN(Subscription); - }; - - // Add a callback to the list. The callback will remain registered until the - // returned Subscription is destroyed, which must occur before the - // CallbackList is destroyed. - scoped_ptr Add(const CallbackType& cb) WARN_UNUSED_RESULT { - DCHECK(!cb.is_null()); - return scoped_ptr( - new Subscription(this, callbacks_.insert(callbacks_.end(), cb))); - } - - // Sets a callback which will be run when a subscription list is changed. - void set_removal_callback(const Closure& callback) { - removal_callback_ = callback; - } - - // Returns true if there are no subscriptions. This is only valid to call when - // not looping through the list. - bool empty() { - DCHECK_EQ(0, active_iterator_count_); - return callbacks_.empty(); - } - - protected: - // An iterator class that can be used to access the list of callbacks. - class Iterator { - public: - explicit Iterator(CallbackListBase* list) - : list_(list), list_iter_(list_->callbacks_.begin()) { - ++list_->active_iterator_count_; - } - - Iterator(const Iterator& iter) - : list_(iter.list_), list_iter_(iter.list_iter_) { - ++list_->active_iterator_count_; - } - - ~Iterator() { - if (list_ && --list_->active_iterator_count_ == 0) { - list_->Compact(); - } - } - - CallbackType* GetNext() { - while ((list_iter_ != list_->callbacks_.end()) && list_iter_->is_null()) - ++list_iter_; - - CallbackType* cb = NULL; - if (list_iter_ != list_->callbacks_.end()) { - cb = &(*list_iter_); - ++list_iter_; - } - return cb; - } - - private: - CallbackListBase* list_; - typename std::list::iterator list_iter_; - }; - - CallbackListBase() : active_iterator_count_(0) {} - - ~CallbackListBase() { - DCHECK_EQ(0, active_iterator_count_); - DCHECK_EQ(0U, callbacks_.size()); - } - - // Returns an instance of a CallbackListBase::Iterator which can be used - // to run callbacks. - Iterator GetIterator() { return Iterator(this); } - - // Compact the list: remove any entries which were NULLed out during - // iteration. - void Compact() { - typename std::list::iterator it = callbacks_.begin(); - bool updated = false; - while (it != callbacks_.end()) { - if ((*it).is_null()) { - updated = true; - it = callbacks_.erase(it); - } else { - ++it; - } - - if (updated && !removal_callback_.is_null()) - removal_callback_.Run(); - } - } - - private: - std::list callbacks_; - int active_iterator_count_; - Closure removal_callback_; - - DISALLOW_COPY_AND_ASSIGN(CallbackListBase); -}; - -} // namespace cef_internal - -template -class CallbackList; - -template <> -class CallbackList - : public cef_internal::CallbackListBase> { - public: - typedef Callback CallbackType; - - CallbackList() {} - - void Notify() { - cef_internal::CallbackListBase::Iterator it = - this->GetIterator(); - CallbackType* cb; - while ((cb = it.GetNext()) != NULL) { - cb->Run(); - } - } - - private: - DISALLOW_COPY_AND_ASSIGN(CallbackList); -}; - -template -class CallbackList - : public cef_internal::CallbackListBase> { - public: - typedef Callback CallbackType; - - CallbackList() {} - - void Notify(typename cef_internal::CallbackParamTraits::ForwardType a1) { - typename cef_internal::CallbackListBase::Iterator it = - this->GetIterator(); - CallbackType* cb; - while ((cb = it.GetNext()) != NULL) { - cb->Run(a1); - } - } - - private: - DISALLOW_COPY_AND_ASSIGN(CallbackList); -}; - -template -class CallbackList - : public cef_internal::CallbackListBase> { - public: - typedef Callback CallbackType; - - CallbackList() {} - - void Notify(typename cef_internal::CallbackParamTraits::ForwardType a1, - typename cef_internal::CallbackParamTraits::ForwardType a2) { - typename cef_internal::CallbackListBase::Iterator it = - this->GetIterator(); - CallbackType* cb; - while ((cb = it.GetNext()) != NULL) { - cb->Run(a1, a2); - } - } - - private: - DISALLOW_COPY_AND_ASSIGN(CallbackList); -}; - -template -class CallbackList - : public cef_internal::CallbackListBase> { - public: - typedef Callback CallbackType; - - CallbackList() {} - - void Notify(typename cef_internal::CallbackParamTraits::ForwardType a1, - typename cef_internal::CallbackParamTraits::ForwardType a2, - typename cef_internal::CallbackParamTraits::ForwardType a3) { - typename cef_internal::CallbackListBase::Iterator it = - this->GetIterator(); - CallbackType* cb; - while ((cb = it.GetNext()) != NULL) { - cb->Run(a1, a2, a3); - } - } - - private: - DISALLOW_COPY_AND_ASSIGN(CallbackList); -}; - -template -class CallbackList - : public cef_internal::CallbackListBase> { - public: - typedef Callback CallbackType; - - CallbackList() {} - - void Notify(typename cef_internal::CallbackParamTraits::ForwardType a1, - typename cef_internal::CallbackParamTraits::ForwardType a2, - typename cef_internal::CallbackParamTraits::ForwardType a3, - typename cef_internal::CallbackParamTraits::ForwardType a4) { - typename cef_internal::CallbackListBase::Iterator it = - this->GetIterator(); - CallbackType* cb; - while ((cb = it.GetNext()) != NULL) { - cb->Run(a1, a2, a3, a4); - } - } - - private: - DISALLOW_COPY_AND_ASSIGN(CallbackList); -}; - -template -class CallbackList - : public cef_internal::CallbackListBase< - Callback> { - public: - typedef Callback CallbackType; - - CallbackList() {} - - void Notify(typename cef_internal::CallbackParamTraits::ForwardType a1, - typename cef_internal::CallbackParamTraits::ForwardType a2, - typename cef_internal::CallbackParamTraits::ForwardType a3, - typename cef_internal::CallbackParamTraits::ForwardType a4, - typename cef_internal::CallbackParamTraits::ForwardType a5) { - typename cef_internal::CallbackListBase::Iterator it = - this->GetIterator(); - CallbackType* cb; - while ((cb = it.GetNext()) != NULL) { - cb->Run(a1, a2, a3, a4, a5); - } - } - - private: - DISALLOW_COPY_AND_ASSIGN(CallbackList); -}; - -template -class CallbackList - : public cef_internal::CallbackListBase< - Callback> { - public: - typedef Callback CallbackType; - - CallbackList() {} - - void Notify(typename cef_internal::CallbackParamTraits::ForwardType a1, - typename cef_internal::CallbackParamTraits::ForwardType a2, - typename cef_internal::CallbackParamTraits::ForwardType a3, - typename cef_internal::CallbackParamTraits::ForwardType a4, - typename cef_internal::CallbackParamTraits::ForwardType a5, - typename cef_internal::CallbackParamTraits::ForwardType a6) { - typename cef_internal::CallbackListBase::Iterator it = - this->GetIterator(); - CallbackType* cb; - while ((cb = it.GetNext()) != NULL) { - cb->Run(a1, a2, a3, a4, a5, a6); - } - } - - private: - DISALLOW_COPY_AND_ASSIGN(CallbackList); -}; - -template -class CallbackList - : public cef_internal::CallbackListBase< - Callback> { - public: - typedef Callback CallbackType; - - CallbackList() {} - - void Notify(typename cef_internal::CallbackParamTraits::ForwardType a1, - typename cef_internal::CallbackParamTraits::ForwardType a2, - typename cef_internal::CallbackParamTraits::ForwardType a3, - typename cef_internal::CallbackParamTraits::ForwardType a4, - typename cef_internal::CallbackParamTraits::ForwardType a5, - typename cef_internal::CallbackParamTraits::ForwardType a6, - typename cef_internal::CallbackParamTraits::ForwardType a7) { - typename cef_internal::CallbackListBase::Iterator it = - this->GetIterator(); - CallbackType* cb; - while ((cb = it.GetNext()) != NULL) { - cb->Run(a1, a2, a3, a4, a5, a6, a7); - } - } - - private: - DISALLOW_COPY_AND_ASSIGN(CallbackList); -}; - -} // namespace base - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_CALLBACK_LIST_H_ diff --git a/third_party/cef/include/base/cef_cancelable_callback.h b/third_party/cef/include/base/cef_cancelable_callback.h deleted file mode 100644 index febce3a3..00000000 --- a/third_party/cef/include/base/cef_cancelable_callback.h +++ /dev/null @@ -1,293 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// CancelableCallback is a wrapper around base::Callback that allows -// cancellation of a callback. CancelableCallback takes a reference on the -// wrapped callback until this object is destroyed or Reset()/Cancel() are -// called. -// -// NOTE: -// -// Calling CancelableCallback::Cancel() brings the object back to its natural, -// default-constructed state, i.e., CancelableCallback::callback() will return -// a null callback. -// -// THREAD-SAFETY: -// -// CancelableCallback objects must be created on, posted to, cancelled on, and -// destroyed on the same thread. -// -// -// EXAMPLE USAGE: -// -// In the following example, the test is verifying that RunIntensiveTest() -// Quit()s the message loop within 4 seconds. The cancelable callback is posted -// to the message loop, the intensive test runs, the message loop is run, -// then the callback is cancelled. -// -// void TimeoutCallback(const std::string& timeout_message) { -// FAIL() << timeout_message; -// MessageLoop::current()->QuitWhenIdle(); -// } -// -// CancelableClosure timeout(base::Bind(&TimeoutCallback, "Test timed out.")); -// MessageLoop::current()->PostDelayedTask(FROM_HERE, timeout.callback(), -// 4000) // 4 seconds to run. -// RunIntensiveTest(); -// MessageLoop::current()->Run(); -// timeout.Cancel(); // Hopefully this is hit before the timeout callback runs. -// - -#ifndef CEF_INCLUDE_BASE_CEF_CANCELABLE_CALLBACK_H_ -#define CEF_INCLUDE_BASE_CEF_CANCELABLE_CALLBACK_H_ -#pragma once - -#if defined(BASE_CANCELABLE_CALLBACK_H_) -// Do nothing if the Chromium header has already been included. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/cancelable_callback.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include "include/base/cef_bind.h" -#include "include/base/cef_build.h" -#include "include/base/cef_callback.h" -#include "include/base/cef_logging.h" -#include "include/base/cef_macros.h" -#include "include/base/cef_weak_ptr.h" -#include "include/base/internal/cef_callback_internal.h" - -namespace base { - -template -class CancelableCallback; - -template <> -class CancelableCallback { - public: - CancelableCallback() : weak_factory_(this) {} - - // |callback| must not be null. - explicit CancelableCallback(const base::Callback& callback) - : weak_factory_(this), callback_(callback) { - DCHECK(!callback.is_null()); - InitializeForwarder(); - } - - ~CancelableCallback() {} - - // Cancels and drops the reference to the wrapped callback. - void Cancel() { - weak_factory_.InvalidateWeakPtrs(); - forwarder_.Reset(); - callback_.Reset(); - } - - // Returns true if the wrapped callback has been cancelled. - bool IsCancelled() const { return callback_.is_null(); } - - // Sets |callback| as the closure that may be cancelled. |callback| may not - // be null. Outstanding and any previously wrapped callbacks are cancelled. - void Reset(const base::Callback& callback) { - DCHECK(!callback.is_null()); - - // Outstanding tasks (e.g., posted to a message loop) must not be called. - Cancel(); - - // |forwarder_| is no longer valid after Cancel(), so re-bind. - InitializeForwarder(); - - callback_ = callback; - } - - // Returns a callback that can be disabled by calling Cancel(). - const base::Callback& callback() const { return forwarder_; } - - private: - void Forward() { callback_.Run(); } - - // Helper method to bind |forwarder_| using a weak pointer from - // |weak_factory_|. - void InitializeForwarder() { - forwarder_ = base::Bind(&CancelableCallback::Forward, - weak_factory_.GetWeakPtr()); - } - - // Used to ensure Forward() is not run when this object is destroyed. - base::WeakPtrFactory> weak_factory_; - - // The wrapper closure. - base::Callback forwarder_; - - // The stored closure that may be cancelled. - base::Callback callback_; - - DISALLOW_COPY_AND_ASSIGN(CancelableCallback); -}; - -template -class CancelableCallback { - public: - CancelableCallback() : weak_factory_(this) {} - - // |callback| must not be null. - explicit CancelableCallback(const base::Callback& callback) - : weak_factory_(this), callback_(callback) { - DCHECK(!callback.is_null()); - InitializeForwarder(); - } - - ~CancelableCallback() {} - - // Cancels and drops the reference to the wrapped callback. - void Cancel() { - weak_factory_.InvalidateWeakPtrs(); - forwarder_.Reset(); - callback_.Reset(); - } - - // Returns true if the wrapped callback has been cancelled. - bool IsCancelled() const { return callback_.is_null(); } - - // Sets |callback| as the closure that may be cancelled. |callback| may not - // be null. Outstanding and any previously wrapped callbacks are cancelled. - void Reset(const base::Callback& callback) { - DCHECK(!callback.is_null()); - - // Outstanding tasks (e.g., posted to a message loop) must not be called. - Cancel(); - - // |forwarder_| is no longer valid after Cancel(), so re-bind. - InitializeForwarder(); - - callback_ = callback; - } - - // Returns a callback that can be disabled by calling Cancel(). - const base::Callback& callback() const { return forwarder_; } - - private: - void Forward(A1 a1) const { callback_.Run(a1); } - - // Helper method to bind |forwarder_| using a weak pointer from - // |weak_factory_|. - void InitializeForwarder() { - forwarder_ = base::Bind(&CancelableCallback::Forward, - weak_factory_.GetWeakPtr()); - } - - // Used to ensure Forward() is not run when this object is destroyed. - base::WeakPtrFactory> weak_factory_; - - // The wrapper closure. - base::Callback forwarder_; - - // The stored closure that may be cancelled. - base::Callback callback_; - - DISALLOW_COPY_AND_ASSIGN(CancelableCallback); -}; - -template -class CancelableCallback { - public: - CancelableCallback() : weak_factory_(this) {} - - // |callback| must not be null. - explicit CancelableCallback(const base::Callback& callback) - : weak_factory_(this), callback_(callback) { - DCHECK(!callback.is_null()); - InitializeForwarder(); - } - - ~CancelableCallback() {} - - // Cancels and drops the reference to the wrapped callback. - void Cancel() { - weak_factory_.InvalidateWeakPtrs(); - forwarder_.Reset(); - callback_.Reset(); - } - - // Returns true if the wrapped callback has been cancelled. - bool IsCancelled() const { return callback_.is_null(); } - - // Sets |callback| as the closure that may be cancelled. |callback| may not - // be null. Outstanding and any previously wrapped callbacks are cancelled. - void Reset(const base::Callback& callback) { - DCHECK(!callback.is_null()); - - // Outstanding tasks (e.g., posted to a message loop) must not be called. - Cancel(); - - // |forwarder_| is no longer valid after Cancel(), so re-bind. - InitializeForwarder(); - - callback_ = callback; - } - - // Returns a callback that can be disabled by calling Cancel(). - const base::Callback& callback() const { return forwarder_; } - - private: - void Forward(A1 a1, A2 a2) const { callback_.Run(a1, a2); } - - // Helper method to bind |forwarder_| using a weak pointer from - // |weak_factory_|. - void InitializeForwarder() { - forwarder_ = base::Bind(&CancelableCallback::Forward, - weak_factory_.GetWeakPtr()); - } - - // Used to ensure Forward() is not run when this object is destroyed. - base::WeakPtrFactory> weak_factory_; - - // The wrapper closure. - base::Callback forwarder_; - - // The stored closure that may be cancelled. - base::Callback callback_; - - DISALLOW_COPY_AND_ASSIGN(CancelableCallback); -}; - -typedef CancelableCallback CancelableClosure; - -} // namespace base - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_CANCELABLE_CALLBACK_H_ diff --git a/third_party/cef/include/base/cef_lock.h b/third_party/cef/include/base/cef_lock.h deleted file mode 100644 index 6909bd6f..00000000 --- a/third_party/cef/include/base/cef_lock.h +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef CEF_INCLUDE_BASE_CEF_LOCK_H_ -#define CEF_INCLUDE_BASE_CEF_LOCK_H_ -#pragma once - -#if defined(BASE_SYNCHRONIZATION_LOCK_H_) -// Do nothing if the Chromium header has already been included. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/synchronization/lock.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include "include/base/cef_logging.h" -#include "include/base/cef_macros.h" -#include "include/base/cef_platform_thread.h" -#include "include/base/internal/cef_lock_impl.h" - -namespace base { -namespace cef_internal { - -// A convenient wrapper for an OS specific critical section. The only real -// intelligence in this class is in debug mode for the support for the -// AssertAcquired() method. -class Lock { - public: -#if !DCHECK_IS_ON() // Optimized wrapper implementation - Lock() : lock_() {} - ~Lock() {} - void Acquire() { lock_.Lock(); } - void Release() { lock_.Unlock(); } - - // If the lock is not held, take it and return true. If the lock is already - // held by another thread, immediately return false. This must not be called - // by a thread already holding the lock (what happens is undefined and an - // assertion may fail). - bool Try() { return lock_.Try(); } - - // Null implementation if not debug. - void AssertAcquired() const {} -#else - Lock(); - ~Lock(); - - // NOTE: Although windows critical sections support recursive locks, we do not - // allow this, and we will commonly fire a DCHECK() if a thread attempts to - // acquire the lock a second time (while already holding it). - void Acquire() { - lock_.Lock(); - CheckUnheldAndMark(); - } - void Release() { - CheckHeldAndUnmark(); - lock_.Unlock(); - } - - bool Try() { - bool rv = lock_.Try(); - if (rv) { - CheckUnheldAndMark(); - } - return rv; - } - - void AssertAcquired() const; -#endif // !DCHECK_IS_ON() - - private: -#if DCHECK_IS_ON() - // Members and routines taking care of locks assertions. - // Note that this checks for recursive locks and allows them - // if the variable is set. This is allowed by the underlying implementation - // on windows but not on Posix, so we're doing unneeded checks on Posix. - // It's worth it to share the code. - void CheckHeldAndUnmark(); - void CheckUnheldAndMark(); - - // All private data is implicitly protected by lock_. - // Be VERY careful to only access members under that lock. - base::PlatformThreadRef owning_thread_ref_; -#endif // DCHECK_IS_ON() - - // Platform specific underlying lock implementation. - LockImpl lock_; - - DISALLOW_COPY_AND_ASSIGN(Lock); -}; - -// A helper class that acquires the given Lock while the AutoLock is in scope. -class AutoLock { - public: - struct AlreadyAcquired {}; - - explicit AutoLock(Lock& lock) : lock_(lock) { lock_.Acquire(); } - - AutoLock(Lock& lock, const AlreadyAcquired&) : lock_(lock) { - lock_.AssertAcquired(); - } - - ~AutoLock() { - lock_.AssertAcquired(); - lock_.Release(); - } - - private: - Lock& lock_; - DISALLOW_COPY_AND_ASSIGN(AutoLock); -}; - -// AutoUnlock is a helper that will Release() the |lock| argument in the -// constructor, and re-Acquire() it in the destructor. -class AutoUnlock { - public: - explicit AutoUnlock(Lock& lock) : lock_(lock) { - // We require our caller to have the lock. - lock_.AssertAcquired(); - lock_.Release(); - } - - ~AutoUnlock() { lock_.Acquire(); } - - private: - Lock& lock_; - DISALLOW_COPY_AND_ASSIGN(AutoUnlock); -}; - -} // namespace cef_internal - -// Implement classes in the cef_internal namespace and then expose them to the -// base namespace. This avoids conflicts with the base.lib implementation when -// linking sandbox support on Windows. -using cef_internal::Lock; -using cef_internal::AutoLock; -using cef_internal::AutoUnlock; - -} // namespace base - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_LOCK_H_ diff --git a/third_party/cef/include/base/cef_logging.h b/third_party/cef/include/base/cef_logging.h deleted file mode 100644 index 8d8bb889..00000000 --- a/third_party/cef/include/base/cef_logging.h +++ /dev/null @@ -1,760 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file are only available to applications that link -// against the libcef_dll_wrapper target. -// -// WARNING: Logging macros should not be used in the main/browser process before -// calling CefInitialize or in sub-processes before calling CefExecuteProcess. -// -// Instructions -// ------------ -// -// Make a bunch of macros for logging. The way to log things is to stream -// things to LOG(). E.g., -// -// LOG(INFO) << "Found " << num_cookies << " cookies"; -// -// You can also do conditional logging: -// -// LOG_IF(INFO, num_cookies > 10) << "Got lots of cookies"; -// -// The CHECK(condition) macro is active in both debug and release builds and -// effectively performs a LOG(FATAL) which terminates the process and -// generates a crashdump unless a debugger is attached. -// -// There are also "debug mode" logging macros like the ones above: -// -// DLOG(INFO) << "Found cookies"; -// -// DLOG_IF(INFO, num_cookies > 10) << "Got lots of cookies"; -// -// All "debug mode" logging is compiled away to nothing for non-debug mode -// compiles. LOG_IF and development flags also work well together -// because the code can be compiled away sometimes. -// -// We also have -// -// LOG_ASSERT(assertion); -// DLOG_ASSERT(assertion); -// -// which is syntactic sugar for {,D}LOG_IF(FATAL, assert fails) << assertion; -// -// There are "verbose level" logging macros. They look like -// -// VLOG(1) << "I'm printed when you run the program with --v=1 or more"; -// VLOG(2) << "I'm printed when you run the program with --v=2 or more"; -// -// These always log at the INFO log level (when they log at all). -// The verbose logging can also be turned on module-by-module. For instance, -// --vmodule=profile=2,icon_loader=1,browser_*=3,*/chromeos/*=4 --v=0 -// will cause: -// a. VLOG(2) and lower messages to be printed from profile.{h,cc} -// b. VLOG(1) and lower messages to be printed from icon_loader.{h,cc} -// c. VLOG(3) and lower messages to be printed from files prefixed with -// "browser" -// d. VLOG(4) and lower messages to be printed from files under a -// "chromeos" directory. -// e. VLOG(0) and lower messages to be printed from elsewhere -// -// The wildcarding functionality shown by (c) supports both '*' (match -// 0 or more characters) and '?' (match any single character) -// wildcards. Any pattern containing a forward or backward slash will -// be tested against the whole pathname and not just the module. -// E.g., "*/foo/bar/*=2" would change the logging level for all code -// in source files under a "foo/bar" directory. -// -// There's also VLOG_IS_ON(n) "verbose level" condition macro. To be used as -// -// if (VLOG_IS_ON(2)) { -// // do some logging preparation and logging -// // that can't be accomplished with just VLOG(2) << ...; -// } -// -// There is also a VLOG_IF "verbose level" condition macro for sample -// cases, when some extra computation and preparation for logs is not -// needed. -// -// VLOG_IF(1, (size > 1024)) -// << "I'm printed when size is more than 1024 and when you run the " -// "program with --v=1 or more"; -// -// We also override the standard 'assert' to use 'DLOG_ASSERT'. -// -// Lastly, there is: -// -// PLOG(ERROR) << "Couldn't do foo"; -// DPLOG(ERROR) << "Couldn't do foo"; -// PLOG_IF(ERROR, cond) << "Couldn't do foo"; -// DPLOG_IF(ERROR, cond) << "Couldn't do foo"; -// PCHECK(condition) << "Couldn't do foo"; -// DPCHECK(condition) << "Couldn't do foo"; -// -// which append the last system error to the message in string form (taken from -// GetLastError() on Windows and errno on POSIX). -// -// The supported severity levels for macros that allow you to specify one -// are (in increasing order of severity) INFO, WARNING, ERROR, and FATAL. -// -// Very important: logging a message at the FATAL severity level causes -// the program to terminate (after the message is logged). -// -// There is the special severity of DFATAL, which logs FATAL in debug mode, -// ERROR in normal mode. -// - -#ifndef CEF_INCLUDE_BASE_CEF_LOGGING_H_ -#define CEF_INCLUDE_BASE_CEF_LOGGING_H_ -#pragma once - -#if defined(DCHECK) -// Do nothing if the macros provided by this header already exist. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. - -// Always define the DCHECK_IS_ON macro which is used from other CEF headers. -#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) -#define DCHECK_IS_ON() 0 -#else -#define DCHECK_IS_ON() 1 -#endif - -#elif defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/logging.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include -#include -#include -#include - -#include "include/base/cef_build.h" -#include "include/base/cef_macros.h" -#include "include/internal/cef_logging_internal.h" - -namespace cef { -namespace logging { - -// Gets the current log level. -inline int GetMinLogLevel() { - return cef_get_min_log_level(); -} - -// Gets the current vlog level for the given file (usually taken from -// __FILE__). Note that |N| is the size *with* the null terminator. -template -int GetVlogLevel(const char (&file)[N]) { - return cef_get_vlog_level(file, N); -} - -typedef int LogSeverity; -const LogSeverity LOG_VERBOSE = -1; // This is level 1 verbosity -// Note: the log severities are used to index into the array of names, -// see log_severity_names. -const LogSeverity LOG_INFO = 0; -const LogSeverity LOG_WARNING = 1; -const LogSeverity LOG_ERROR = 2; -const LogSeverity LOG_FATAL = 3; -const LogSeverity LOG_NUM_SEVERITIES = 4; - -// LOG_DFATAL is LOG_FATAL in debug mode, ERROR in normal mode -#ifdef NDEBUG -const LogSeverity LOG_DFATAL = LOG_ERROR; -#else -const LogSeverity LOG_DFATAL = LOG_FATAL; -#endif - -// A few definitions of macros that don't generate much code. These are used -// by LOG() and LOG_IF, etc. Since these are used all over our code, it's -// better to have compact code for these operations. -#define COMPACT_GOOGLE_LOG_EX_INFO(ClassName, ...) \ - cef::logging::ClassName(__FILE__, __LINE__, cef::logging::LOG_INFO, \ - ##__VA_ARGS__) -#define COMPACT_GOOGLE_LOG_EX_WARNING(ClassName, ...) \ - cef::logging::ClassName(__FILE__, __LINE__, cef::logging::LOG_WARNING, \ - ##__VA_ARGS__) -#define COMPACT_GOOGLE_LOG_EX_ERROR(ClassName, ...) \ - cef::logging::ClassName(__FILE__, __LINE__, cef::logging::LOG_ERROR, \ - ##__VA_ARGS__) -#define COMPACT_GOOGLE_LOG_EX_FATAL(ClassName, ...) \ - cef::logging::ClassName(__FILE__, __LINE__, cef::logging::LOG_FATAL, \ - ##__VA_ARGS__) -#define COMPACT_GOOGLE_LOG_EX_DFATAL(ClassName, ...) \ - cef::logging::ClassName(__FILE__, __LINE__, cef::logging::LOG_DFATAL, \ - ##__VA_ARGS__) - -#define COMPACT_GOOGLE_LOG_INFO COMPACT_GOOGLE_LOG_EX_INFO(LogMessage) -#define COMPACT_GOOGLE_LOG_WARNING COMPACT_GOOGLE_LOG_EX_WARNING(LogMessage) -#define COMPACT_GOOGLE_LOG_ERROR COMPACT_GOOGLE_LOG_EX_ERROR(LogMessage) -#define COMPACT_GOOGLE_LOG_FATAL COMPACT_GOOGLE_LOG_EX_FATAL(LogMessage) -#define COMPACT_GOOGLE_LOG_DFATAL COMPACT_GOOGLE_LOG_EX_DFATAL(LogMessage) - -#if defined(OS_WIN) -// wingdi.h defines ERROR to be 0. When we call LOG(ERROR), it gets -// substituted with 0, and it expands to COMPACT_GOOGLE_LOG_0. To allow us -// to keep using this syntax, we define this macro to do the same thing -// as COMPACT_GOOGLE_LOG_ERROR, and also define ERROR the same way that -// the Windows SDK does for consistency. -#define ERROR 0 -#define COMPACT_GOOGLE_LOG_EX_0(ClassName, ...) \ - COMPACT_GOOGLE_LOG_EX_ERROR(ClassName, ##__VA_ARGS__) -#define COMPACT_GOOGLE_LOG_0 COMPACT_GOOGLE_LOG_ERROR -// Needed for LOG_IS_ON(ERROR). -const LogSeverity LOG_0 = LOG_ERROR; -#endif - -// As special cases, we can assume that LOG_IS_ON(FATAL) always holds. Also, -// LOG_IS_ON(DFATAL) always holds in debug mode. In particular, CHECK()s will -// always fire if they fail. -#define LOG_IS_ON(severity) \ - ((::cef::logging::LOG_##severity) >= ::cef::logging::GetMinLogLevel()) - -// We can't do any caching tricks with VLOG_IS_ON() like the -// google-glog version since it requires GCC extensions. This means -// that using the v-logging functions in conjunction with --vmodule -// may be slow. -#define VLOG_IS_ON(verboselevel) \ - ((verboselevel) <= ::cef::logging::GetVlogLevel(__FILE__)) - -// Helper macro which avoids evaluating the arguments to a stream if -// the condition doesn't hold. -#define LAZY_STREAM(stream, condition) \ - !(condition) ? (void)0 : ::cef::logging::LogMessageVoidify() & (stream) - -// We use the preprocessor's merging operator, "##", so that, e.g., -// LOG(INFO) becomes the token COMPACT_GOOGLE_LOG_INFO. There's some funny -// subtle difference between ostream member streaming functions (e.g., -// ostream::operator<<(int) and ostream non-member streaming functions -// (e.g., ::operator<<(ostream&, string&): it turns out that it's -// impossible to stream something like a string directly to an unnamed -// ostream. We employ a neat hack by calling the stream() member -// function of LogMessage which seems to avoid the problem. -#define LOG_STREAM(severity) COMPACT_GOOGLE_LOG_##severity.stream() - -#define LOG(severity) LAZY_STREAM(LOG_STREAM(severity), LOG_IS_ON(severity)) -#define LOG_IF(severity, condition) \ - LAZY_STREAM(LOG_STREAM(severity), LOG_IS_ON(severity) && (condition)) - -#define SYSLOG(severity) LOG(severity) -#define SYSLOG_IF(severity, condition) LOG_IF(severity, condition) - -// The VLOG macros log with negative verbosities. -#define VLOG_STREAM(verbose_level) \ - cef::logging::LogMessage(__FILE__, __LINE__, -verbose_level).stream() - -#define VLOG(verbose_level) \ - LAZY_STREAM(VLOG_STREAM(verbose_level), VLOG_IS_ON(verbose_level)) - -#define VLOG_IF(verbose_level, condition) \ - LAZY_STREAM(VLOG_STREAM(verbose_level), \ - VLOG_IS_ON(verbose_level) && (condition)) - -#if defined(OS_WIN) -#define VPLOG_STREAM(verbose_level) \ - cef::logging::Win32ErrorLogMessage(__FILE__, __LINE__, -verbose_level, \ - ::cef::logging::GetLastSystemErrorCode()) \ - .stream() -#elif defined(OS_POSIX) -#define VPLOG_STREAM(verbose_level) \ - cef::logging::ErrnoLogMessage(__FILE__, __LINE__, -verbose_level, \ - ::cef::logging::GetLastSystemErrorCode()) \ - .stream() -#endif - -#define VPLOG(verbose_level) \ - LAZY_STREAM(VPLOG_STREAM(verbose_level), VLOG_IS_ON(verbose_level)) - -#define VPLOG_IF(verbose_level, condition) \ - LAZY_STREAM(VPLOG_STREAM(verbose_level), \ - VLOG_IS_ON(verbose_level) && (condition)) - -// TODO(akalin): Add more VLOG variants, e.g. VPLOG. - -#define LOG_ASSERT(condition) \ - LOG_IF(FATAL, !(condition)) << "Assert failed: " #condition ". " -#define SYSLOG_ASSERT(condition) \ - SYSLOG_IF(FATAL, !(condition)) << "Assert failed: " #condition ". " - -#if defined(OS_WIN) -#define PLOG_STREAM(severity) \ - COMPACT_GOOGLE_LOG_EX_##severity(Win32ErrorLogMessage, \ - ::cef::logging::GetLastSystemErrorCode()) \ - .stream() -#elif defined(OS_POSIX) -#define PLOG_STREAM(severity) \ - COMPACT_GOOGLE_LOG_EX_##severity(ErrnoLogMessage, \ - ::cef::logging::GetLastSystemErrorCode()) \ - .stream() -#endif - -#define PLOG(severity) LAZY_STREAM(PLOG_STREAM(severity), LOG_IS_ON(severity)) - -#define PLOG_IF(severity, condition) \ - LAZY_STREAM(PLOG_STREAM(severity), LOG_IS_ON(severity) && (condition)) - -// The actual stream used isn't important. -#define EAT_STREAM_PARAMETERS \ - true ? (void)0 : ::cef::logging::LogMessageVoidify() & LOG_STREAM(FATAL) - -// CHECK dies with a fatal error if condition is not true. It is *not* -// controlled by NDEBUG, so the check will be executed regardless of -// compilation mode. -// -// We make sure CHECK et al. always evaluates their arguments, as -// doing CHECK(FunctionWithSideEffect()) is a common idiom. - -#define CHECK(condition) \ - LAZY_STREAM(LOG_STREAM(FATAL), !(condition)) \ - << "Check failed: " #condition ". " - -#define PCHECK(condition) \ - LAZY_STREAM(PLOG_STREAM(FATAL), !(condition)) \ - << "Check failed: " #condition ". " - -// Helper macro for binary operators. -// Don't use this macro directly in your code, use CHECK_EQ et al below. -// -// TODO(akalin): Rewrite this so that constructs like if (...) -// CHECK_EQ(...) else { ... } work properly. -#define CHECK_OP(name, op, val1, val2) \ - if (std::string* _result = cef::logging::Check##name##Impl( \ - (val1), (val2), #val1 " " #op " " #val2)) \ - cef::logging::LogMessage(__FILE__, __LINE__, _result).stream() - -// Build the error message string. This is separate from the "Impl" -// function template because it is not performance critical and so can -// be out of line, while the "Impl" code should be inline. Caller -// takes ownership of the returned string. -template -std::string* MakeCheckOpString(const t1& v1, const t2& v2, const char* names) { - std::ostringstream ss; - ss << names << " (" << v1 << " vs. " << v2 << ")"; - std::string* msg = new std::string(ss.str()); - return msg; -} - -// MSVC doesn't like complex extern templates and DLLs. -#if !defined(COMPILER_MSVC) -// Commonly used instantiations of MakeCheckOpString<>. Explicitly instantiated -// in logging.cc. -extern template std::string* MakeCheckOpString(const int&, - const int&, - const char* names); -extern template std::string* MakeCheckOpString( - const unsigned long&, - const unsigned long&, - const char* names); -extern template std::string* MakeCheckOpString( - const unsigned long&, - const unsigned int&, - const char* names); -extern template std::string* MakeCheckOpString( - const unsigned int&, - const unsigned long&, - const char* names); -extern template std::string* MakeCheckOpString( - const std::string&, - const std::string&, - const char* name); -#endif - -// Helper functions for CHECK_OP macro. -// The (int, int) specialization works around the issue that the compiler -// will not instantiate the template version of the function on values of -// unnamed enum type - see comment below. -#define DEFINE_CHECK_OP_IMPL(name, op) \ - template \ - inline std::string* Check##name##Impl(const t1& v1, const t2& v2, \ - const char* names) { \ - if (v1 op v2) \ - return NULL; \ - else \ - return MakeCheckOpString(v1, v2, names); \ - } \ - inline std::string* Check##name##Impl(int v1, int v2, const char* names) { \ - if (v1 op v2) \ - return NULL; \ - else \ - return MakeCheckOpString(v1, v2, names); \ - } -DEFINE_CHECK_OP_IMPL(EQ, ==) -DEFINE_CHECK_OP_IMPL(NE, !=) -DEFINE_CHECK_OP_IMPL(LE, <=) -DEFINE_CHECK_OP_IMPL(LT, <) -DEFINE_CHECK_OP_IMPL(GE, >=) -DEFINE_CHECK_OP_IMPL(GT, >) -#undef DEFINE_CHECK_OP_IMPL - -#define CHECK_EQ(val1, val2) CHECK_OP(EQ, ==, val1, val2) -#define CHECK_NE(val1, val2) CHECK_OP(NE, !=, val1, val2) -#define CHECK_LE(val1, val2) CHECK_OP(LE, <=, val1, val2) -#define CHECK_LT(val1, val2) CHECK_OP(LT, <, val1, val2) -#define CHECK_GE(val1, val2) CHECK_OP(GE, >=, val1, val2) -#define CHECK_GT(val1, val2) CHECK_OP(GT, >, val1, val2) - -#if defined(NDEBUG) -#define ENABLE_DLOG 0 -#else -#define ENABLE_DLOG 1 -#endif - -#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) -#define DCHECK_IS_ON() 0 -#else -#define DCHECK_IS_ON() 1 -#endif - -// Definitions for DLOG et al. - -#if ENABLE_DLOG - -#define DLOG_IS_ON(severity) LOG_IS_ON(severity) -#define DLOG_IF(severity, condition) LOG_IF(severity, condition) -#define DLOG_ASSERT(condition) LOG_ASSERT(condition) -#define DPLOG_IF(severity, condition) PLOG_IF(severity, condition) -#define DVLOG_IF(verboselevel, condition) VLOG_IF(verboselevel, condition) -#define DVPLOG_IF(verboselevel, condition) VPLOG_IF(verboselevel, condition) - -#else // ENABLE_DLOG - -// If ENABLE_DLOG is off, we want to avoid emitting any references to -// |condition| (which may reference a variable defined only if NDEBUG -// is not defined). Contrast this with DCHECK et al., which has -// different behavior. - -#define DLOG_IS_ON(severity) false -#define DLOG_IF(severity, condition) EAT_STREAM_PARAMETERS -#define DLOG_ASSERT(condition) EAT_STREAM_PARAMETERS -#define DPLOG_IF(severity, condition) EAT_STREAM_PARAMETERS -#define DVLOG_IF(verboselevel, condition) EAT_STREAM_PARAMETERS -#define DVPLOG_IF(verboselevel, condition) EAT_STREAM_PARAMETERS - -#endif // ENABLE_DLOG - -// DEBUG_MODE is for uses like -// if (DEBUG_MODE) foo.CheckThatFoo(); -// instead of -// #ifndef NDEBUG -// foo.CheckThatFoo(); -// #endif -// -// We tie its state to ENABLE_DLOG. -enum { DEBUG_MODE = ENABLE_DLOG }; - -#undef ENABLE_DLOG - -#define DLOG(severity) LAZY_STREAM(LOG_STREAM(severity), DLOG_IS_ON(severity)) - -#define DPLOG(severity) LAZY_STREAM(PLOG_STREAM(severity), DLOG_IS_ON(severity)) - -#define DVLOG(verboselevel) DVLOG_IF(verboselevel, VLOG_IS_ON(verboselevel)) - -#define DVPLOG(verboselevel) DVPLOG_IF(verboselevel, VLOG_IS_ON(verboselevel)) - -// Definitions for DCHECK et al. - -#if DCHECK_IS_ON() - -#define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ - COMPACT_GOOGLE_LOG_EX_FATAL(ClassName, ##__VA_ARGS__) -#define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_FATAL -const LogSeverity LOG_DCHECK = LOG_FATAL; - -#else // DCHECK_IS_ON() - -// These are just dummy values. -#define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \ - COMPACT_GOOGLE_LOG_EX_INFO(ClassName, ##__VA_ARGS__) -#define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_INFO -const LogSeverity LOG_DCHECK = LOG_INFO; - -#endif // DCHECK_IS_ON() - -// DCHECK et al. make sure to reference |condition| regardless of -// whether DCHECKs are enabled; this is so that we don't get unused -// variable warnings if the only use of a variable is in a DCHECK. -// This behavior is different from DLOG_IF et al. - -#define DCHECK(condition) \ - LAZY_STREAM(LOG_STREAM(DCHECK), DCHECK_IS_ON() && !(condition)) \ - << "Check failed: " #condition ". " - -#define DPCHECK(condition) \ - LAZY_STREAM(PLOG_STREAM(DCHECK), DCHECK_IS_ON() && !(condition)) \ - << "Check failed: " #condition ". " - -// Helper macro for binary operators. -// Don't use this macro directly in your code, use DCHECK_EQ et al below. -#define DCHECK_OP(name, op, val1, val2) \ - if (DCHECK_IS_ON()) \ - if (std::string* _result = cef::logging::Check##name##Impl( \ - (val1), (val2), #val1 " " #op " " #val2)) \ - cef::logging::LogMessage(__FILE__, __LINE__, ::cef::logging::LOG_DCHECK, \ - _result) \ - .stream() - -// Equality/Inequality checks - compare two values, and log a -// LOG_DCHECK message including the two values when the result is not -// as expected. The values must have operator<<(ostream, ...) -// defined. -// -// You may append to the error message like so: -// DCHECK_NE(1, 2) << ": The world must be ending!"; -// -// We are very careful to ensure that each argument is evaluated exactly -// once, and that anything which is legal to pass as a function argument is -// legal here. In particular, the arguments may be temporary expressions -// which will end up being destroyed at the end of the apparent statement, -// for example: -// DCHECK_EQ(string("abc")[1], 'b'); -// -// WARNING: These may not compile correctly if one of the arguments is a pointer -// and the other is NULL. To work around this, simply static_cast NULL to the -// type of the desired pointer. - -#define DCHECK_EQ(val1, val2) DCHECK_OP(EQ, ==, val1, val2) -#define DCHECK_NE(val1, val2) DCHECK_OP(NE, !=, val1, val2) -#define DCHECK_LE(val1, val2) DCHECK_OP(LE, <=, val1, val2) -#define DCHECK_LT(val1, val2) DCHECK_OP(LT, <, val1, val2) -#define DCHECK_GE(val1, val2) DCHECK_OP(GE, >=, val1, val2) -#define DCHECK_GT(val1, val2) DCHECK_OP(GT, >, val1, val2) - -#if defined(NDEBUG) && defined(OS_CHROMEOS) -#define NOTREACHED() \ - LOG(ERROR) << "NOTREACHED() hit in " << __FUNCTION__ << ". " -#else -#define NOTREACHED() DCHECK(false) -#endif - -// Redefine the standard assert to use our nice log files -#undef assert -#define assert(x) DLOG_ASSERT(x) - -// This class more or less represents a particular log message. You -// create an instance of LogMessage and then stream stuff to it. -// When you finish streaming to it, ~LogMessage is called and the -// full message gets streamed to the appropriate destination. -// -// You shouldn't actually use LogMessage's constructor to log things, -// though. You should use the LOG() macro (and variants thereof) -// above. -class LogMessage { - public: - // Used for LOG(severity). - LogMessage(const char* file, int line, LogSeverity severity); - - // Used for CHECK_EQ(), etc. Takes ownership of the given string. - // Implied severity = LOG_FATAL. - LogMessage(const char* file, int line, std::string* result); - - // Used for DCHECK_EQ(), etc. Takes ownership of the given string. - LogMessage(const char* file, - int line, - LogSeverity severity, - std::string* result); - - ~LogMessage(); - - std::ostream& stream() { return stream_; } - - private: - LogSeverity severity_; - std::ostringstream stream_; - - // The file and line information passed in to the constructor. - const char* file_; - const int line_; - -#if defined(OS_WIN) - // Stores the current value of GetLastError in the constructor and restores - // it in the destructor by calling SetLastError. - // This is useful since the LogMessage class uses a lot of Win32 calls - // that will lose the value of GLE and the code that called the log function - // will have lost the thread error value when the log call returns. - class SaveLastError { - public: - SaveLastError(); - ~SaveLastError(); - - unsigned long get_error() const { return last_error_; } - - protected: - unsigned long last_error_; - }; - - SaveLastError last_error_; -#endif - - DISALLOW_COPY_AND_ASSIGN(LogMessage); -}; - -// A non-macro interface to the log facility; (useful -// when the logging level is not a compile-time constant). -inline void LogAtLevel(int const log_level, std::string const& msg) { - LogMessage(__FILE__, __LINE__, log_level).stream() << msg; -} - -// This class is used to explicitly ignore values in the conditional -// logging macros. This avoids compiler warnings like "value computed -// is not used" and "statement has no effect". -class LogMessageVoidify { - public: - LogMessageVoidify() {} - // This has to be an operator with a precedence lower than << but - // higher than ?: - void operator&(std::ostream&) {} -}; - -#if defined(OS_WIN) -typedef unsigned long SystemErrorCode; -#elif defined(OS_POSIX) -typedef int SystemErrorCode; -#endif - -// Alias for ::GetLastError() on Windows and errno on POSIX. Avoids having to -// pull in windows.h just for GetLastError() and DWORD. -SystemErrorCode GetLastSystemErrorCode(); -std::string SystemErrorCodeToString(SystemErrorCode error_code); - -#if defined(OS_WIN) -// Appends a formatted system message of the GetLastError() type. -class Win32ErrorLogMessage { - public: - Win32ErrorLogMessage(const char* file, - int line, - LogSeverity severity, - SystemErrorCode err); - - // Appends the error message before destructing the encapsulated class. - ~Win32ErrorLogMessage(); - - std::ostream& stream() { return log_message_.stream(); } - - private: - SystemErrorCode err_; - LogMessage log_message_; - - DISALLOW_COPY_AND_ASSIGN(Win32ErrorLogMessage); -}; -#elif defined(OS_POSIX) -// Appends a formatted system message of the errno type -class ErrnoLogMessage { - public: - ErrnoLogMessage(const char* file, - int line, - LogSeverity severity, - SystemErrorCode err); - - // Appends the error message before destructing the encapsulated class. - ~ErrnoLogMessage(); - - std::ostream& stream() { return log_message_.stream(); } - - private: - SystemErrorCode err_; - LogMessage log_message_; - - DISALLOW_COPY_AND_ASSIGN(ErrnoLogMessage); -}; -#endif // OS_WIN - -} // namespace logging -} // namespace cef - -// These functions are provided as a convenience for logging, which is where we -// use streams (it is against Google style to use streams in other places). It -// is designed to allow you to emit non-ASCII Unicode strings to the log file, -// which is normally ASCII. It is relatively slow, so try not to use it for -// common cases. Non-ASCII characters will be converted to UTF-8 by these -// operators. -std::ostream& operator<<(std::ostream& out, const wchar_t* wstr); -inline std::ostream& operator<<(std::ostream& out, const std::wstring& wstr) { - return out << wstr.c_str(); -} - -// The NOTIMPLEMENTED() macro annotates codepaths which have -// not been implemented yet. -// -// The implementation of this macro is controlled by NOTIMPLEMENTED_POLICY: -// 0 -- Do nothing (stripped by compiler) -// 1 -- Warn at compile time -// 2 -- Fail at compile time -// 3 -- Fail at runtime (DCHECK) -// 4 -- [default] LOG(ERROR) at runtime -// 5 -- LOG(ERROR) at runtime, only once per call-site - -#ifndef NOTIMPLEMENTED_POLICY -#if defined(OS_ANDROID) && defined(OFFICIAL_BUILD) -#define NOTIMPLEMENTED_POLICY 0 -#else -// Select default policy: LOG(ERROR) -#define NOTIMPLEMENTED_POLICY 4 -#endif -#endif - -#if defined(COMPILER_GCC) -// On Linux, with GCC, we can use __PRETTY_FUNCTION__ to get the demangled name -// of the current function in the NOTIMPLEMENTED message. -#define NOTIMPLEMENTED_MSG "Not implemented reached in " << __PRETTY_FUNCTION__ -#else -#define NOTIMPLEMENTED_MSG "NOT IMPLEMENTED" -#endif - -#if NOTIMPLEMENTED_POLICY == 0 -#define NOTIMPLEMENTED() EAT_STREAM_PARAMETERS -#elif NOTIMPLEMENTED_POLICY == 1 -// TODO, figure out how to generate a warning -#define NOTIMPLEMENTED() COMPILE_ASSERT(false, NOT_IMPLEMENTED) -#elif NOTIMPLEMENTED_POLICY == 2 -#define NOTIMPLEMENTED() COMPILE_ASSERT(false, NOT_IMPLEMENTED) -#elif NOTIMPLEMENTED_POLICY == 3 -#define NOTIMPLEMENTED() NOTREACHED() -#elif NOTIMPLEMENTED_POLICY == 4 -#define NOTIMPLEMENTED() LOG(ERROR) << NOTIMPLEMENTED_MSG -#elif NOTIMPLEMENTED_POLICY == 5 -#define NOTIMPLEMENTED() \ - do { \ - static bool logged_once = false; \ - LOG_IF(ERROR, !logged_once) << NOTIMPLEMENTED_MSG; \ - logged_once = true; \ - } while (0); \ - EAT_STREAM_PARAMETERS -#endif - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_LOGGING_H_ diff --git a/third_party/cef/include/base/cef_macros.h b/third_party/cef/include/base/cef_macros.h deleted file mode 100644 index e714529c..00000000 --- a/third_party/cef/include/base/cef_macros.h +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef CEF_INCLUDE_BASE_CEF_MACROS_H_ -#define CEF_INCLUDE_BASE_CEF_MACROS_H_ -#pragma once - -#if defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/macros.h" - -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include // For size_t. -#include "include/base/cef_build.h" // For COMPILER_MSVC - -#if !defined(arraysize) - -// The arraysize(arr) macro returns the # of elements in an array arr. -// The expression is a compile-time constant, and therefore can be -// used in defining new arrays, for example. If you use arraysize on -// a pointer by mistake, you will get a compile-time error. -// -// One caveat is that arraysize() doesn't accept any array of an -// anonymous type or a type defined inside a function. In these rare -// cases, you have to use the unsafe ARRAYSIZE_UNSAFE() macro below. This is -// due to a limitation in C++'s template system. The limitation might -// eventually be removed, but it hasn't happened yet. - -// This template function declaration is used in defining arraysize. -// Note that the function doesn't need an implementation, as we only -// use its type. -template -char (&ArraySizeHelper(T (&array)[N]))[N]; - -// That gcc wants both of these prototypes seems mysterious. VC, for -// its part, can't decide which to use (another mystery). Matching of -// template overloads: the final frontier. -#ifndef _MSC_VER -template -char (&ArraySizeHelper(const T (&array)[N]))[N]; -#endif - -#define arraysize(array) (sizeof(ArraySizeHelper(array))) - -#endif // !arraysize - -#if !defined(DISALLOW_COPY_AND_ASSIGN) - -// A macro to disallow the copy constructor and operator= functions -// This should be used in the private: declarations for a class -#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ - TypeName(const TypeName&); \ - void operator=(const TypeName&) - -#endif // !DISALLOW_COPY_AND_ASSIGN - -#if !defined(DISALLOW_IMPLICIT_CONSTRUCTORS) - -// A macro to disallow all the implicit constructors, namely the -// default constructor, copy constructor and operator= functions. -// -// This should be used in the private: declarations for a class -// that wants to prevent anyone from instantiating it. This is -// especially useful for classes containing only static methods. -#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ - TypeName(); \ - DISALLOW_COPY_AND_ASSIGN(TypeName) - -#endif // !DISALLOW_IMPLICIT_CONSTRUCTORS - -#if !defined(COMPILE_ASSERT) - -// The COMPILE_ASSERT macro can be used to verify that a compile time -// expression is true. For example, you could use it to verify the -// size of a static array: -// -// COMPILE_ASSERT(ARRAYSIZE_UNSAFE(content_type_names) == CONTENT_NUM_TYPES, -// content_type_names_incorrect_size); -// -// or to make sure a struct is smaller than a certain size: -// -// COMPILE_ASSERT(sizeof(foo) < 128, foo_too_large); -// -// The second argument to the macro is the name of the variable. If -// the expression is false, most compilers will issue a warning/error -// containing the name of the variable. - -#if __cplusplus >= 201103L - -// Under C++11, just use static_assert. -#define COMPILE_ASSERT(expr, msg) static_assert(expr, #msg) - -#else - -namespace cef { - -template -struct CompileAssert {}; - -} // namespace cef - -#define COMPILE_ASSERT(expr, msg) \ - typedef cef::CompileAssert<(bool(expr))> \ - msg[bool(expr) ? 1 : -1] ALLOW_UNUSED_TYPE - -// Implementation details of COMPILE_ASSERT: -// -// - COMPILE_ASSERT works by defining an array type that has -1 -// elements (and thus is invalid) when the expression is false. -// -// - The simpler definition -// -// #define COMPILE_ASSERT(expr, msg) typedef char msg[(expr) ? 1 : -1] -// -// does not work, as gcc supports variable-length arrays whose sizes -// are determined at run-time (this is gcc's extension and not part -// of the C++ standard). As a result, gcc fails to reject the -// following code with the simple definition: -// -// int foo; -// COMPILE_ASSERT(foo, msg); // not supposed to compile as foo is -// // not a compile-time constant. -// -// - By using the type CompileAssert<(bool(expr))>, we ensures that -// expr is a compile-time constant. (Template arguments must be -// determined at compile-time.) -// -// - The outer parentheses in CompileAssert<(bool(expr))> are necessary -// to work around a bug in gcc 3.4.4 and 4.0.1. If we had written -// -// CompileAssert -// -// instead, these compilers will refuse to compile -// -// COMPILE_ASSERT(5 > 0, some_message); -// -// (They seem to think the ">" in "5 > 0" marks the end of the -// template argument list.) -// -// - The array size is (bool(expr) ? 1 : -1), instead of simply -// -// ((expr) ? 1 : -1). -// -// This is to avoid running into a bug in MS VC 7.1, which -// causes ((0.0) ? 1 : -1) to incorrectly evaluate to 1. - -#endif // !(__cplusplus >= 201103L) - -#endif // !defined(COMPILE_ASSERT) - -#endif // !USING_CHROMIUM_INCLUDES - -#if !defined(MSVC_PUSH_DISABLE_WARNING) && defined(COMPILER_MSVC) - -// MSVC_PUSH_DISABLE_WARNING pushes |n| onto a stack of warnings to be disabled. -// The warning remains disabled until popped by MSVC_POP_WARNING. -#define MSVC_PUSH_DISABLE_WARNING(n) \ - __pragma(warning(push)) __pragma(warning(disable : n)) - -// MSVC_PUSH_WARNING_LEVEL pushes |n| as the global warning level. The level -// remains in effect until popped by MSVC_POP_WARNING(). Use 0 to disable all -// warnings. -#define MSVC_PUSH_WARNING_LEVEL(n) __pragma(warning(push, n)) - -// Pop effects of innermost MSVC_PUSH_* macro. -#define MSVC_POP_WARNING() __pragma(warning(pop)) - -#endif // !defined(MSVC_PUSH_DISABLE_WARNING) && defined(COMPILER_MSVC) - -#if !defined(ALLOW_THIS_IN_INITIALIZER_LIST) -#if defined(COMPILER_MSVC) -// Allows |this| to be passed as an argument in constructor initializer lists. -// This uses push/pop instead of the seemingly simpler suppress feature to avoid -// having the warning be disabled for more than just |code|. -// -// Example usage: -// Foo::Foo() : x(NULL), ALLOW_THIS_IN_INITIALIZER_LIST(y(this)), z(3) {} -// -// Compiler warning C4355: 'this': used in base member initializer list: -// http://msdn.microsoft.com/en-us/library/3c594ae3(VS.80).aspx -#define ALLOW_THIS_IN_INITIALIZER_LIST(code) \ - MSVC_PUSH_DISABLE_WARNING(4355) \ - code MSVC_POP_WARNING() -#else // !COMPILER_MSVC -#define ALLOW_THIS_IN_INITIALIZER_LIST(code) code -#endif // !COMPILER_MSVC -#endif // !ALLOW_THIS_IN_INITIALIZER_LIST - -#endif // CEF_INCLUDE_BASE_CEF_MACROS_H_ diff --git a/third_party/cef/include/base/cef_move.h b/third_party/cef/include/base/cef_move.h deleted file mode 100644 index da47d2d3..00000000 --- a/third_party/cef/include/base/cef_move.h +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef CEF_INCLUDE_BASE_CEF_MOVE_H_ -#define CEF_INCLUDE_BASE_CEF_MOVE_H_ - -#if defined(MOVE_ONLY_TYPE_FOR_CPP_03) -// Do nothing if the macro in this header has already been defined. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/move.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -// Macro with the boilerplate that makes a type move-only in C++03. -// -// USAGE -// -// This macro should be used instead of DISALLOW_COPY_AND_ASSIGN to create -// a "move-only" type. Unlike DISALLOW_COPY_AND_ASSIGN, this macro should be -// the first line in a class declaration. -// -// A class using this macro must call .Pass() (or somehow be an r-value already) -// before it can be: -// -// * Passed as a function argument -// * Used as the right-hand side of an assignment -// * Returned from a function -// -// Each class will still need to define their own "move constructor" and "move -// operator=" to make this useful. Here's an example of the macro, the move -// constructor, and the move operator= from the scoped_ptr class: -// -// template -// class scoped_ptr { -// MOVE_ONLY_TYPE_FOR_CPP_03(scoped_ptr, RValue) -// public: -// scoped_ptr(RValue& other) : ptr_(other.release()) { } -// scoped_ptr& operator=(RValue& other) { -// swap(other); -// return *this; -// } -// }; -// -// Note that the constructor must NOT be marked explicit. -// -// For consistency, the second parameter to the macro should always be RValue -// unless you have a strong reason to do otherwise. It is only exposed as a -// macro parameter so that the move constructor and move operator= don't look -// like they're using a phantom type. -// -// -// HOW THIS WORKS -// -// For a thorough explanation of this technique, see: -// -// http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Move_Constructor -// -// The summary is that we take advantage of 2 properties: -// -// 1) non-const references will not bind to r-values. -// 2) C++ can apply one user-defined conversion when initializing a -// variable. -// -// The first lets us disable the copy constructor and assignment operator -// by declaring private version of them with a non-const reference parameter. -// -// For l-values, direct initialization still fails like in -// DISALLOW_COPY_AND_ASSIGN because the copy constructor and assignment -// operators are private. -// -// For r-values, the situation is different. The copy constructor and -// assignment operator are not viable due to (1), so we are trying to call -// a non-existent constructor and non-existing operator= rather than a private -// one. Since we have not committed an error quite yet, we can provide an -// alternate conversion sequence and a constructor. We add -// -// * a private struct named "RValue" -// * a user-defined conversion "operator RValue()" -// * a "move constructor" and "move operator=" that take the RValue& as -// their sole parameter. -// -// Only r-values will trigger this sequence and execute our "move constructor" -// or "move operator=." L-values will match the private copy constructor and -// operator= first giving a "private in this context" error. This combination -// gives us a move-only type. -// -// For signaling a destructive transfer of data from an l-value, we provide a -// method named Pass() which creates an r-value for the current instance -// triggering the move constructor or move operator=. -// -// Other ways to get r-values is to use the result of an expression like a -// function call. -// -// Here's an example with comments explaining what gets triggered where: -// -// class Foo { -// MOVE_ONLY_TYPE_FOR_CPP_03(Foo, RValue); -// -// public: -// ... API ... -// Foo(RValue other); // Move constructor. -// Foo& operator=(RValue rhs); // Move operator= -// }; -// -// Foo MakeFoo(); // Function that returns a Foo. -// -// Foo f; -// Foo f_copy(f); // ERROR: Foo(Foo&) is private in this context. -// Foo f_assign; -// f_assign = f; // ERROR: operator=(Foo&) is private in this context. -// -// -// Foo f(MakeFoo()); // R-value so alternate conversion executed. -// Foo f_copy(f.Pass()); // R-value so alternate conversion executed. -// f = f_copy.Pass(); // R-value so alternate conversion executed. -// -// -// IMPLEMENTATION SUBTLETIES WITH RValue -// -// The RValue struct is just a container for a pointer back to the original -// object. It should only ever be created as a temporary, and no external -// class should ever declare it or use it in a parameter. -// -// It is tempting to want to use the RValue type in function parameters, but -// excluding the limited usage here for the move constructor and move -// operator=, doing so would mean that the function could take both r-values -// and l-values equially which is unexpected. See COMPARED To Boost.Move for -// more details. -// -// An alternate, and incorrect, implementation of the RValue class used by -// Boost.Move makes RValue a fieldless child of the move-only type. RValue& -// is then used in place of RValue in the various operators. The RValue& is -// "created" by doing *reinterpret_cast(this). This has the appeal -// of never creating a temporary RValue struct even with optimizations -// disabled. Also, by virtue of inheritance you can treat the RValue -// reference as if it were the move-only type itself. Unfortunately, -// using the result of this reinterpret_cast<> is actually undefined behavior -// due to C++98 5.2.10.7. In certain compilers (e.g., NaCl) the optimizer -// will generate non-working code. -// -// In optimized builds, both implementations generate the same assembly so we -// choose the one that adheres to the standard. -// -// -// WHY HAVE typedef void MoveOnlyTypeForCPP03 -// -// Callback<>/Bind() needs to understand movable-but-not-copyable semantics -// to call .Pass() appropriately when it is expected to transfer the value. -// The cryptic typedef MoveOnlyTypeForCPP03 is added to make this check -// easy and automatic in helper templates for Callback<>/Bind(). -// See IsMoveOnlyType template and its usage in base/callback_internal.h -// for more details. -// -// -// COMPARED TO C++11 -// -// In C++11, you would implement this functionality using an r-value reference -// and our .Pass() method would be replaced with a call to std::move(). -// -// This emulation also has a deficiency where it uses up the single -// user-defined conversion allowed by C++ during initialization. This can -// cause problems in some API edge cases. For instance, in scoped_ptr, it is -// impossible to make a function "void Foo(scoped_ptr p)" accept a -// value of type scoped_ptr even if you add a constructor to -// scoped_ptr<> that would make it look like it should work. C++11 does not -// have this deficiency. -// -// -// COMPARED TO Boost.Move -// -// Our implementation similar to Boost.Move, but we keep the RValue struct -// private to the move-only type, and we don't use the reinterpret_cast<> hack. -// -// In Boost.Move, RValue is the boost::rv<> template. This type can be used -// when writing APIs like: -// -// void MyFunc(boost::rv& f) -// -// that can take advantage of rv<> to avoid extra copies of a type. However you -// would still be able to call this version of MyFunc with an l-value: -// -// Foo f; -// MyFunc(f); // Uh oh, we probably just destroyed |f| w/o calling Pass(). -// -// unless someone is very careful to also declare a parallel override like: -// -// void MyFunc(const Foo& f) -// -// that would catch the l-values first. This was declared unsafe in C++11 and -// a C++11 compiler will explicitly fail MyFunc(f). Unfortunately, we cannot -// ensure this in C++03. -// -// Since we have no need for writing such APIs yet, our implementation keeps -// RValue private and uses a .Pass() method to do the conversion instead of -// trying to write a version of "std::move()." Writing an API like std::move() -// would require the RValue struct to be public. -// -// -// CAVEATS -// -// If you include a move-only type as a field inside a class that does not -// explicitly declare a copy constructor, the containing class's implicit -// copy constructor will change from Containing(const Containing&) to -// Containing(Containing&). This can cause some unexpected errors. -// -// http://llvm.org/bugs/show_bug.cgi?id=11528 -// -// The workaround is to explicitly declare your copy constructor. -// -#define MOVE_ONLY_TYPE_FOR_CPP_03(type, rvalue_type) \ - private: \ - struct rvalue_type { \ - explicit rvalue_type(type* object) : object(object) {} \ - type* object; \ - }; \ - type(type&); \ - void operator=(type&); \ - \ - public: \ - operator rvalue_type() { return rvalue_type(this); } \ - type Pass() { return type(rvalue_type(this)); } \ - typedef void MoveOnlyTypeForCPP03; \ - \ - private: - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_MOVE_H_ diff --git a/third_party/cef/include/base/cef_platform_thread.h b/third_party/cef/include/base/cef_platform_thread.h deleted file mode 100644 index d3fdd798..00000000 --- a/third_party/cef/include/base/cef_platform_thread.h +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// WARNING: You should *NOT* be using this class directly. PlatformThread is -// the low-level platform-specific abstraction to the OS's threading interface. -// You should instead be using a message-loop driven Thread, see thread.h. - -#ifndef CEF_INCLUDE_BASE_PLATFORM_THREAD_H_ -#define CEF_INCLUDE_BASE_PLATFORM_THREAD_H_ - -#if defined(BASE_THREADING_PLATFORM_THREAD_H_) -// Do nothing if the Chromium header has already been included. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/threading/platform_thread.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include "include/base/cef_basictypes.h" -#include "include/base/cef_build.h" -#include "include/internal/cef_thread_internal.h" - -namespace base { - -// Used for logging. Always an integer value. -typedef cef_platform_thread_id_t PlatformThreadId; - -// Used for thread checking and debugging. -// Meant to be as fast as possible. -// These are produced by PlatformThread::CurrentRef(), and used to later -// check if we are on the same thread or not by using ==. These are safe -// to copy between threads, but can't be copied to another process as they -// have no meaning there. Also, the internal identifier can be re-used -// after a thread dies, so a PlatformThreadRef cannot be reliably used -// to distinguish a new thread from an old, dead thread. -class PlatformThreadRef { - public: - typedef cef_platform_thread_handle_t RefType; - - PlatformThreadRef() : id_(0) {} - - explicit PlatformThreadRef(RefType id) : id_(id) {} - - bool operator==(PlatformThreadRef other) const { return id_ == other.id_; } - - bool is_null() const { return id_ == 0; } - - private: - RefType id_; -}; - -// A namespace for low-level thread functions. -// Chromium uses a class with static methods but CEF uses an actual namespace -// to avoid linker problems with the sandbox libaries on Windows. -namespace PlatformThread { - -// Gets the current thread id, which may be useful for logging purposes. -inline PlatformThreadId CurrentId() { - return cef_get_current_platform_thread_id(); -} - -// Gets the current thread reference, which can be used to check if -// we're on the right thread quickly. -inline PlatformThreadRef CurrentRef() { - return PlatformThreadRef(cef_get_current_platform_thread_handle()); -} - -} // namespace PlatformThread - -} // namespace base - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_PLATFORM_THREAD_H_ diff --git a/third_party/cef/include/base/cef_ref_counted.h b/third_party/cef/include/base/cef_ref_counted.h deleted file mode 100644 index 7a687070..00000000 --- a/third_party/cef/include/base/cef_ref_counted.h +++ /dev/null @@ -1,370 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// - -#ifndef CEF_INCLUDE_BASE_CEF_REF_COUNTED_H_ -#define CEF_INCLUDE_BASE_CEF_REF_COUNTED_H_ -#pragma once - -#if defined(BASE_MEMORY_REF_COUNTED_H_) -// Do nothing if the Chromium header has already been included. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/memory/ref_counted.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include - -#include "include/base/cef_atomic_ref_count.h" -#include "include/base/cef_build.h" -#include "include/base/cef_logging.h" -#include "include/base/cef_macros.h" - -namespace base { - -namespace cef_subtle { - -class RefCountedBase { - public: - bool HasOneRef() const { return ref_count_ == 1; } - bool HasAtLeastOneRef() const { return ref_count_ >= 1; } - - protected: - RefCountedBase() - : ref_count_(0) -#if DCHECK_IS_ON() - , - in_dtor_(false) -#endif - { - } - - ~RefCountedBase() { -#if DCHECK_IS_ON() - DCHECK(in_dtor_) << "RefCounted object deleted without calling Release()"; -#endif - } - - void AddRef() const { -#if DCHECK_IS_ON() - DCHECK(!in_dtor_); -#endif - ++ref_count_; - } - - // Returns true if the object should self-delete. - bool Release() const { -#if DCHECK_IS_ON() - DCHECK(!in_dtor_); -#endif - if (--ref_count_ == 0) { -#if DCHECK_IS_ON() - in_dtor_ = true; -#endif - return true; - } - return false; - } - - private: - mutable int ref_count_; -#if DCHECK_IS_ON() - mutable bool in_dtor_; -#endif - - DISALLOW_COPY_AND_ASSIGN(RefCountedBase); -}; - -class RefCountedThreadSafeBase { - public: - bool HasOneRef() const; - bool HasAtLeastOneRef() const; - - protected: - RefCountedThreadSafeBase(); - ~RefCountedThreadSafeBase(); - - void AddRef() const; - - // Returns true if the object should self-delete. - bool Release() const; - - private: - mutable AtomicRefCount ref_count_; -#if DCHECK_IS_ON() - mutable bool in_dtor_; -#endif - - DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafeBase); -}; - -} // namespace cef_subtle - -// -// A base class for reference counted classes. Otherwise, known as a cheap -// knock-off of WebKit's RefCounted class. To use this guy just extend your -// class from it like so: -// -// class MyFoo : public base::RefCounted { -// ... -// private: -// friend class base::RefCounted; -// ~MyFoo(); -// }; -// -// You should always make your destructor private, to avoid any code deleting -// the object accidently while there are references to it. -template -class RefCounted : public cef_subtle::RefCountedBase { - public: - RefCounted() {} - - void AddRef() const { cef_subtle::RefCountedBase::AddRef(); } - - void Release() const { - if (cef_subtle::RefCountedBase::Release()) { - delete static_cast(this); - } - } - - protected: - ~RefCounted() {} - - private: - DISALLOW_COPY_AND_ASSIGN(RefCounted); -}; - -// Forward declaration. -template -class RefCountedThreadSafe; - -// Default traits for RefCountedThreadSafe. Deletes the object when its ref -// count reaches 0. Overload to delete it on a different thread etc. -template -struct DefaultRefCountedThreadSafeTraits { - static void Destruct(const T* x) { - // Delete through RefCountedThreadSafe to make child classes only need to be - // friend with RefCountedThreadSafe instead of this struct, which is an - // implementation detail. - RefCountedThreadSafe::DeleteInternal( - x); - } -}; - -// -// A thread-safe variant of RefCounted -// -// class MyFoo : public base::RefCountedThreadSafe { -// ... -// }; -// -// If you're using the default trait, then you should add compile time -// asserts that no one else is deleting your object. i.e. -// private: -// friend class base::RefCountedThreadSafe; -// ~MyFoo(); -template > -class RefCountedThreadSafe : public cef_subtle::RefCountedThreadSafeBase { - public: - RefCountedThreadSafe() {} - - void AddRef() const { cef_subtle::RefCountedThreadSafeBase::AddRef(); } - - void Release() const { - if (cef_subtle::RefCountedThreadSafeBase::Release()) { - Traits::Destruct(static_cast(this)); - } - } - - protected: - ~RefCountedThreadSafe() {} - - private: - friend struct DefaultRefCountedThreadSafeTraits; - static void DeleteInternal(const T* x) { delete x; } - - DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafe); -}; - -// -// A thread-safe wrapper for some piece of data so we can place other -// things in scoped_refptrs<>. -// -template -class RefCountedData - : public base::RefCountedThreadSafe> { - public: - RefCountedData() : data() {} - RefCountedData(const T& in_value) : data(in_value) {} - - T data; - - private: - friend class base::RefCountedThreadSafe>; - ~RefCountedData() {} -}; - -} // namespace base - -// -// A smart pointer class for reference counted objects. Use this class instead -// of calling AddRef and Release manually on a reference counted object to -// avoid common memory leaks caused by forgetting to Release an object -// reference. Sample usage: -// -// class MyFoo : public RefCounted { -// ... -// }; -// -// void some_function() { -// scoped_refptr foo = new MyFoo(); -// foo->Method(param); -// // |foo| is released when this function returns -// } -// -// void some_other_function() { -// scoped_refptr foo = new MyFoo(); -// ... -// foo = NULL; // explicitly releases |foo| -// ... -// if (foo) -// foo->Method(param); -// } -// -// The above examples show how scoped_refptr acts like a pointer to T. -// Given two scoped_refptr classes, it is also possible to exchange -// references between the two objects, like so: -// -// { -// scoped_refptr a = new MyFoo(); -// scoped_refptr b; -// -// b.swap(a); -// // now, |b| references the MyFoo object, and |a| references NULL. -// } -// -// To make both |a| and |b| in the above example reference the same MyFoo -// object, simply use the assignment operator: -// -// { -// scoped_refptr a = new MyFoo(); -// scoped_refptr b; -// -// b = a; -// // now, |a| and |b| each own a reference to the same MyFoo object. -// } -// -template -class scoped_refptr { - public: - typedef T element_type; - - scoped_refptr() : ptr_(NULL) {} - - scoped_refptr(T* p) : ptr_(p) { - if (ptr_) - ptr_->AddRef(); - } - - scoped_refptr(const scoped_refptr& r) : ptr_(r.ptr_) { - if (ptr_) - ptr_->AddRef(); - } - - template - scoped_refptr(const scoped_refptr& r) : ptr_(r.get()) { - if (ptr_) - ptr_->AddRef(); - } - - ~scoped_refptr() { - if (ptr_) - ptr_->Release(); - } - - T* get() const { return ptr_; } - - // Allow scoped_refptr to be used in boolean expression - // and comparison operations. - operator T*() const { return ptr_; } - - T* operator->() const { - assert(ptr_ != NULL); - return ptr_; - } - - scoped_refptr& operator=(T* p) { - // AddRef first so that self assignment should work - if (p) - p->AddRef(); - T* old_ptr = ptr_; - ptr_ = p; - if (old_ptr) - old_ptr->Release(); - return *this; - } - - scoped_refptr& operator=(const scoped_refptr& r) { - return *this = r.ptr_; - } - - template - scoped_refptr& operator=(const scoped_refptr& r) { - return *this = r.get(); - } - - void swap(T** pp) { - T* p = ptr_; - ptr_ = *pp; - *pp = p; - } - - void swap(scoped_refptr& r) { swap(&r.ptr_); } - - protected: - T* ptr_; -}; - -// Handy utility for creating a scoped_refptr out of a T* explicitly without -// having to retype all the template arguments -template -scoped_refptr make_scoped_refptr(T* t) { - return scoped_refptr(t); -} - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_REF_COUNTED_H_ diff --git a/third_party/cef/include/base/cef_scoped_ptr.h b/third_party/cef/include/base/cef_scoped_ptr.h deleted file mode 100644 index eb9e0e29..00000000 --- a/third_party/cef/include/base/cef_scoped_ptr.h +++ /dev/null @@ -1,625 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Scopers help you manage ownership of a pointer, helping you easily manage a -// pointer within a scope, and automatically destroying the pointer at the end -// of a scope. There are two main classes you will use, which correspond to the -// operators new/delete and new[]/delete[]. -// -// Example usage (scoped_ptr): -// { -// scoped_ptr foo(new Foo("wee")); -// } // foo goes out of scope, releasing the pointer with it. -// -// { -// scoped_ptr foo; // No pointer managed. -// foo.reset(new Foo("wee")); // Now a pointer is managed. -// foo.reset(new Foo("wee2")); // Foo("wee") was destroyed. -// foo.reset(new Foo("wee3")); // Foo("wee2") was destroyed. -// foo->Method(); // Foo::Method() called. -// foo.get()->Method(); // Foo::Method() called. -// SomeFunc(foo.release()); // SomeFunc takes ownership, foo no longer -// // manages a pointer. -// foo.reset(new Foo("wee4")); // foo manages a pointer again. -// foo.reset(); // Foo("wee4") destroyed, foo no longer -// // manages a pointer. -// } // foo wasn't managing a pointer, so nothing was destroyed. -// -// Example usage (scoped_ptr): -// { -// scoped_ptr foo(new Foo[100]); -// foo.get()->Method(); // Foo::Method on the 0th element. -// foo[10].Method(); // Foo::Method on the 10th element. -// } -// -// These scopers also implement part of the functionality of C++11 unique_ptr -// in that they are "movable but not copyable." You can use the scopers in -// the parameter and return types of functions to signify ownership transfer -// in to and out of a function. When calling a function that has a scoper -// as the argument type, it must be called with the result of an analogous -// scoper's Pass() function or another function that generates a temporary; -// passing by copy will NOT work. Here is an example using scoped_ptr: -// -// void TakesOwnership(scoped_ptr arg) { -// // Do something with arg -// } -// scoped_ptr CreateFoo() { -// // No need for calling Pass() because we are constructing a temporary -// // for the return value. -// return scoped_ptr(new Foo("new")); -// } -// scoped_ptr PassThru(scoped_ptr arg) { -// return arg.Pass(); -// } -// -// { -// scoped_ptr ptr(new Foo("yay")); // ptr manages Foo("yay"). -// TakesOwnership(ptr.Pass()); // ptr no longer owns Foo("yay"). -// scoped_ptr ptr2 = CreateFoo(); // ptr2 owns the return Foo. -// scoped_ptr ptr3 = // ptr3 now owns what was in ptr2. -// PassThru(ptr2.Pass()); // ptr2 is correspondingly NULL. -// } -// -// Notice that if you do not call Pass() when returning from PassThru(), or -// when invoking TakesOwnership(), the code will not compile because scopers -// are not copyable; they only implement move semantics which require calling -// the Pass() function to signify a destructive transfer of state. CreateFoo() -// is different though because we are constructing a temporary on the return -// line and thus can avoid needing to call Pass(). -// -// Pass() properly handles upcast in initialization, i.e. you can use a -// scoped_ptr to initialize a scoped_ptr: -// -// scoped_ptr foo(new Foo()); -// scoped_ptr parent(foo.Pass()); -// -// PassAs<>() should be used to upcast return value in return statement: -// -// scoped_ptr CreateFoo() { -// scoped_ptr result(new FooChild()); -// return result.PassAs(); -// } -// -// Note that PassAs<>() is implemented only for scoped_ptr, but not for -// scoped_ptr. This is because casting array pointers may not be safe. - -#ifndef CEF_INCLUDE_BASE_CEF_MEMORY_SCOPED_PTR_H_ -#define CEF_INCLUDE_BASE_CEF_MEMORY_SCOPED_PTR_H_ -#pragma once - -#if defined(BASE_MEMORY_SCOPED_PTR_H_) -// Do nothing if the Chromium header has already been included. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) -// Do nothing when building CEF. -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -// This is an implementation designed to match the anticipated future TR2 -// implementation of the scoped_ptr class. - -#include -#include -#include - -#include // For std::swap(). - -#include "include/base/cef_basictypes.h" -#include "include/base/cef_build.h" -#include "include/base/cef_macros.h" -#include "include/base/cef_move.h" -#include "include/base/cef_template_util.h" - -namespace base { - -namespace subtle { -class RefCountedBase; -class RefCountedThreadSafeBase; -} // namespace subtle - -// Function object which deletes its parameter, which must be a pointer. -// If C is an array type, invokes 'delete[]' on the parameter; otherwise, -// invokes 'delete'. The default deleter for scoped_ptr. -template -struct DefaultDeleter { - DefaultDeleter() {} - template - DefaultDeleter(const DefaultDeleter& other) { - // IMPLEMENTATION NOTE: C++11 20.7.1.1.2p2 only provides this constructor - // if U* is implicitly convertible to T* and U is not an array type. - // - // Correct implementation should use SFINAE to disable this - // constructor. However, since there are no other 1-argument constructors, - // using a COMPILE_ASSERT() based on is_convertible<> and requiring - // complete types is simpler and will cause compile failures for equivalent - // misuses. - // - // Note, the is_convertible check also ensures that U is not an - // array. T is guaranteed to be a non-array, so any U* where U is an array - // cannot convert to T*. - enum { T_must_be_complete = sizeof(T) }; - enum { U_must_be_complete = sizeof(U) }; - COMPILE_ASSERT((base::is_convertible::value), - U_ptr_must_implicitly_convert_to_T_ptr); - } - inline void operator()(T* ptr) const { - enum { type_must_be_complete = sizeof(T) }; - delete ptr; - } -}; - -// Specialization of DefaultDeleter for array types. -template -struct DefaultDeleter { - inline void operator()(T* ptr) const { - enum { type_must_be_complete = sizeof(T) }; - delete[] ptr; - } - - private: - // Disable this operator for any U != T because it is undefined to execute - // an array delete when the static type of the array mismatches the dynamic - // type. - // - // References: - // C++98 [expr.delete]p3 - // http://cplusplus.github.com/LWG/lwg-defects.html#938 - template - void operator()(U* array) const; -}; - -template -struct DefaultDeleter { - // Never allow someone to declare something like scoped_ptr. - COMPILE_ASSERT(sizeof(T) == -1, do_not_use_array_with_size_as_type); -}; - -// Function object which invokes 'free' on its parameter, which must be -// a pointer. Can be used to store malloc-allocated pointers in scoped_ptr: -// -// scoped_ptr foo_ptr( -// static_cast(malloc(sizeof(int)))); -struct FreeDeleter { - inline void operator()(void* ptr) const { free(ptr); } -}; - -namespace cef_internal { - -template -struct IsNotRefCounted { - enum { - value = - !base::is_convertible::value && - !base::is_convertible::value - }; -}; - -// Minimal implementation of the core logic of scoped_ptr, suitable for -// reuse in both scoped_ptr and its specializations. -template -class scoped_ptr_impl { - public: - explicit scoped_ptr_impl(T* p) : data_(p) {} - - // Initializer for deleters that have data parameters. - scoped_ptr_impl(T* p, const D& d) : data_(p, d) {} - - // Templated constructor that destructively takes the value from another - // scoped_ptr_impl. - template - scoped_ptr_impl(scoped_ptr_impl* other) - : data_(other->release(), other->get_deleter()) { - // We do not support move-only deleters. We could modify our move - // emulation to have base::subtle::move() and base::subtle::forward() - // functions that are imperfect emulations of their C++11 equivalents, - // but until there's a requirement, just assume deleters are copyable. - } - - template - void TakeState(scoped_ptr_impl* other) { - // See comment in templated constructor above regarding lack of support - // for move-only deleters. - reset(other->release()); - get_deleter() = other->get_deleter(); - } - - ~scoped_ptr_impl() { - if (data_.ptr != NULL) { - // Not using get_deleter() saves one function call in non-optimized - // builds. - static_cast(data_)(data_.ptr); - } - } - - void reset(T* p) { - // This is a self-reset, which is no longer allowed: http://crbug.com/162971 - if (p != NULL && p == data_.ptr) - abort(); - - // Note that running data_.ptr = p can lead to undefined behavior if - // get_deleter()(get()) deletes this. In order to prevent this, reset() - // should update the stored pointer before deleting its old value. - // - // However, changing reset() to use that behavior may cause current code to - // break in unexpected ways. If the destruction of the owned object - // dereferences the scoped_ptr when it is destroyed by a call to reset(), - // then it will incorrectly dispatch calls to |p| rather than the original - // value of |data_.ptr|. - // - // During the transition period, set the stored pointer to NULL while - // deleting the object. Eventually, this safety check will be removed to - // prevent the scenario initially described from occuring and - // http://crbug.com/176091 can be closed. - T* old = data_.ptr; - data_.ptr = NULL; - if (old != NULL) - static_cast(data_)(old); - data_.ptr = p; - } - - T* get() const { return data_.ptr; } - - D& get_deleter() { return data_; } - const D& get_deleter() const { return data_; } - - void swap(scoped_ptr_impl& p2) { - // Standard swap idiom: 'using std::swap' ensures that std::swap is - // present in the overload set, but we call swap unqualified so that - // any more-specific overloads can be used, if available. - using std::swap; - swap(static_cast(data_), static_cast(p2.data_)); - swap(data_.ptr, p2.data_.ptr); - } - - T* release() { - T* old_ptr = data_.ptr; - data_.ptr = NULL; - return old_ptr; - } - - private: - // Needed to allow type-converting constructor. - template - friend class scoped_ptr_impl; - - // Use the empty base class optimization to allow us to have a D - // member, while avoiding any space overhead for it when D is an - // empty class. See e.g. http://www.cantrip.org/emptyopt.html for a good - // discussion of this technique. - struct Data : public D { - explicit Data(T* ptr_in) : ptr(ptr_in) {} - Data(T* ptr_in, const D& other) : D(other), ptr(ptr_in) {} - T* ptr; - }; - - Data data_; - - DISALLOW_COPY_AND_ASSIGN(scoped_ptr_impl); -}; - -} // namespace cef_internal - -} // namespace base - -// A scoped_ptr is like a T*, except that the destructor of scoped_ptr -// automatically deletes the pointer it holds (if any). -// That is, scoped_ptr owns the T object that it points to. -// Like a T*, a scoped_ptr may hold either NULL or a pointer to a T object. -// Also like T*, scoped_ptr is thread-compatible, and once you -// dereference it, you get the thread safety guarantees of T. -// -// The size of scoped_ptr is small. On most compilers, when using the -// DefaultDeleter, sizeof(scoped_ptr) == sizeof(T*). Custom deleters will -// increase the size proportional to whatever state they need to have. See -// comments inside scoped_ptr_impl<> for details. -// -// Current implementation targets having a strict subset of C++11's -// unique_ptr<> features. Known deficiencies include not supporting move-only -// deleteres, function pointers as deleters, and deleters with reference -// types. -template > -class scoped_ptr { - MOVE_ONLY_TYPE_FOR_CPP_03(scoped_ptr, RValue) - - COMPILE_ASSERT(base::cef_internal::IsNotRefCounted::value, - T_is_refcounted_type_and_needs_scoped_refptr); - - public: - // The element and deleter types. - typedef T element_type; - typedef D deleter_type; - - // Constructor. Defaults to initializing with NULL. - scoped_ptr() : impl_(NULL) {} - - // Constructor. Takes ownership of p. - explicit scoped_ptr(element_type* p) : impl_(p) {} - - // Constructor. Allows initialization of a stateful deleter. - scoped_ptr(element_type* p, const D& d) : impl_(p, d) {} - - // Constructor. Allows construction from a scoped_ptr rvalue for a - // convertible type and deleter. - // - // IMPLEMENTATION NOTE: C++11 unique_ptr<> keeps this constructor distinct - // from the normal move constructor. By C++11 20.7.1.2.1.21, this constructor - // has different post-conditions if D is a reference type. Since this - // implementation does not support deleters with reference type, - // we do not need a separate move constructor allowing us to avoid one - // use of SFINAE. You only need to care about this if you modify the - // implementation of scoped_ptr. - template - scoped_ptr(scoped_ptr other) : impl_(&other.impl_) { - COMPILE_ASSERT(!base::is_array::value, U_cannot_be_an_array); - } - - // Constructor. Move constructor for C++03 move emulation of this type. - scoped_ptr(RValue rvalue) : impl_(&rvalue.object->impl_) {} - - // operator=. Allows assignment from a scoped_ptr rvalue for a convertible - // type and deleter. - // - // IMPLEMENTATION NOTE: C++11 unique_ptr<> keeps this operator= distinct from - // the normal move assignment operator. By C++11 20.7.1.2.3.4, this templated - // form has different requirements on for move-only Deleters. Since this - // implementation does not support move-only Deleters, we do not need a - // separate move assignment operator allowing us to avoid one use of SFINAE. - // You only need to care about this if you modify the implementation of - // scoped_ptr. - template - scoped_ptr& operator=(scoped_ptr rhs) { - COMPILE_ASSERT(!base::is_array::value, U_cannot_be_an_array); - impl_.TakeState(&rhs.impl_); - return *this; - } - - // Reset. Deletes the currently owned object, if any. - // Then takes ownership of a new object, if given. - void reset(element_type* p = NULL) { impl_.reset(p); } - - // Accessors to get the owned object. - // operator* and operator-> will assert() if there is no current object. - element_type& operator*() const { - assert(impl_.get() != NULL); - return *impl_.get(); - } - element_type* operator->() const { - assert(impl_.get() != NULL); - return impl_.get(); - } - element_type* get() const { return impl_.get(); } - - // Access to the deleter. - deleter_type& get_deleter() { return impl_.get_deleter(); } - const deleter_type& get_deleter() const { return impl_.get_deleter(); } - - // Allow scoped_ptr to be used in boolean expressions, but not - // implicitly convertible to a real bool (which is dangerous). - // - // Note that this trick is only safe when the == and != operators - // are declared explicitly, as otherwise "scoped_ptr1 == - // scoped_ptr2" will compile but do the wrong thing (i.e., convert - // to Testable and then do the comparison). - private: - typedef base::cef_internal::scoped_ptr_impl - scoped_ptr::*Testable; - - public: - operator Testable() const { return impl_.get() ? &scoped_ptr::impl_ : NULL; } - - // Comparison operators. - // These return whether two scoped_ptr refer to the same object, not just to - // two different but equal objects. - bool operator==(const element_type* p) const { return impl_.get() == p; } - bool operator!=(const element_type* p) const { return impl_.get() != p; } - - // Swap two scoped pointers. - void swap(scoped_ptr& p2) { impl_.swap(p2.impl_); } - - // Release a pointer. - // The return value is the current pointer held by this object. - // If this object holds a NULL pointer, the return value is NULL. - // After this operation, this object will hold a NULL pointer, - // and will not own the object any more. - element_type* release() WARN_UNUSED_RESULT { return impl_.release(); } - - // C++98 doesn't support functions templates with default parameters which - // makes it hard to write a PassAs() that understands converting the deleter - // while preserving simple calling semantics. - // - // Until there is a use case for PassAs() with custom deleters, just ignore - // the custom deleter. - template - scoped_ptr PassAs() { - return scoped_ptr(Pass()); - } - - private: - // Needed to reach into |impl_| in the constructor. - template - friend class scoped_ptr; - base::cef_internal::scoped_ptr_impl impl_; - - // Forbidden for API compatibility with std::unique_ptr. - explicit scoped_ptr(int disallow_construction_from_null); - - // Forbid comparison of scoped_ptr types. If U != T, it totally - // doesn't make sense, and if U == T, it still doesn't make sense - // because you should never have the same object owned by two different - // scoped_ptrs. - template - bool operator==(scoped_ptr const& p2) const; - template - bool operator!=(scoped_ptr const& p2) const; -}; - -template -class scoped_ptr { - MOVE_ONLY_TYPE_FOR_CPP_03(scoped_ptr, RValue) - - public: - // The element and deleter types. - typedef T element_type; - typedef D deleter_type; - - // Constructor. Defaults to initializing with NULL. - scoped_ptr() : impl_(NULL) {} - - // Constructor. Stores the given array. Note that the argument's type - // must exactly match T*. In particular: - // - it cannot be a pointer to a type derived from T, because it is - // inherently unsafe in the general case to access an array through a - // pointer whose dynamic type does not match its static type (eg., if - // T and the derived types had different sizes access would be - // incorrectly calculated). Deletion is also always undefined - // (C++98 [expr.delete]p3). If you're doing this, fix your code. - // - it cannot be NULL, because NULL is an integral expression, not a - // pointer to T. Use the no-argument version instead of explicitly - // passing NULL. - // - it cannot be const-qualified differently from T per unique_ptr spec - // (http://cplusplus.github.com/LWG/lwg-active.html#2118). Users wanting - // to work around this may use implicit_cast(). - // However, because of the first bullet in this comment, users MUST - // NOT use implicit_cast() to upcast the static type of the array. - explicit scoped_ptr(element_type* array) : impl_(array) {} - - // Constructor. Move constructor for C++03 move emulation of this type. - scoped_ptr(RValue rvalue) : impl_(&rvalue.object->impl_) {} - - // operator=. Move operator= for C++03 move emulation of this type. - scoped_ptr& operator=(RValue rhs) { - impl_.TakeState(&rhs.object->impl_); - return *this; - } - - // Reset. Deletes the currently owned array, if any. - // Then takes ownership of a new object, if given. - void reset(element_type* array = NULL) { impl_.reset(array); } - - // Accessors to get the owned array. - element_type& operator[](size_t i) const { - assert(impl_.get() != NULL); - return impl_.get()[i]; - } - element_type* get() const { return impl_.get(); } - - // Access to the deleter. - deleter_type& get_deleter() { return impl_.get_deleter(); } - const deleter_type& get_deleter() const { return impl_.get_deleter(); } - - // Allow scoped_ptr to be used in boolean expressions, but not - // implicitly convertible to a real bool (which is dangerous). - private: - typedef base::cef_internal::scoped_ptr_impl - scoped_ptr::*Testable; - - public: - operator Testable() const { return impl_.get() ? &scoped_ptr::impl_ : NULL; } - - // Comparison operators. - // These return whether two scoped_ptr refer to the same object, not just to - // two different but equal objects. - bool operator==(element_type* array) const { return impl_.get() == array; } - bool operator!=(element_type* array) const { return impl_.get() != array; } - - // Swap two scoped pointers. - void swap(scoped_ptr& p2) { impl_.swap(p2.impl_); } - - // Release a pointer. - // The return value is the current pointer held by this object. - // If this object holds a NULL pointer, the return value is NULL. - // After this operation, this object will hold a NULL pointer, - // and will not own the object any more. - element_type* release() WARN_UNUSED_RESULT { return impl_.release(); } - - private: - // Force element_type to be a complete type. - enum { type_must_be_complete = sizeof(element_type) }; - - // Actually hold the data. - base::cef_internal::scoped_ptr_impl impl_; - - // Disable initialization from any type other than element_type*, by - // providing a constructor that matches such an initialization, but is - // private and has no definition. This is disabled because it is not safe to - // call delete[] on an array whose static type does not match its dynamic - // type. - template - explicit scoped_ptr(U* array); - explicit scoped_ptr(int disallow_construction_from_null); - - // Disable reset() from any type other than element_type*, for the same - // reasons as the constructor above. - template - void reset(U* array); - void reset(int disallow_reset_from_null); - - // Forbid comparison of scoped_ptr types. If U != T, it totally - // doesn't make sense, and if U == T, it still doesn't make sense - // because you should never have the same object owned by two different - // scoped_ptrs. - template - bool operator==(scoped_ptr const& p2) const; - template - bool operator!=(scoped_ptr const& p2) const; -}; - -// Free functions -template -void swap(scoped_ptr& p1, scoped_ptr& p2) { - p1.swap(p2); -} - -template -bool operator==(T* p1, const scoped_ptr& p2) { - return p1 == p2.get(); -} - -template -bool operator!=(T* p1, const scoped_ptr& p2) { - return p1 != p2.get(); -} - -// A function to convert T* into scoped_ptr -// Doing e.g. make_scoped_ptr(new FooBarBaz(arg)) is a shorter notation -// for scoped_ptr >(new FooBarBaz(arg)) -template -scoped_ptr make_scoped_ptr(T* ptr) { - return scoped_ptr(ptr); -} - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_MEMORY_SCOPED_PTR_H_ diff --git a/third_party/cef/include/base/cef_string16.h b/third_party/cef/include/base/cef_string16.h deleted file mode 100644 index 6afcb79b..00000000 --- a/third_party/cef/include/base/cef_string16.h +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2013 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef CEF_INCLUDE_BASE_CEF_STRING16_H_ -#define CEF_INCLUDE_BASE_CEF_STRING16_H_ -#pragma once - -#if defined(BASE_STRINGS_STRING16_H_) -// Do nothing if the Chromium header has already been included. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/strings/string16.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. -// WHAT: -// A version of std::basic_string that provides 2-byte characters even when -// wchar_t is not implemented as a 2-byte type. You can access this class as -// string16. We also define char16, which string16 is based upon. -// -// WHY: -// On Windows, wchar_t is 2 bytes, and it can conveniently handle UTF-16/UCS-2 -// data. Plenty of existing code operates on strings encoded as UTF-16. -// -// On many other platforms, sizeof(wchar_t) is 4 bytes by default. We can make -// it 2 bytes by using the GCC flag -fshort-wchar. But then std::wstring fails -// at run time, because it calls some functions (like wcslen) that come from -// the system's native C library -- which was built with a 4-byte wchar_t! -// It's wasteful to use 4-byte wchar_t strings to carry UTF-16 data, and it's -// entirely improper on those systems where the encoding of wchar_t is defined -// as UTF-32. -// -// Here, we define string16, which is similar to std::wstring but replaces all -// libc functions with custom, 2-byte-char compatible routines. It is capable -// of carrying UTF-16-encoded data. - -#include -#include - -#include "include/base/cef_basictypes.h" - -#if defined(WCHAR_T_IS_UTF16) - -namespace base { - -typedef wchar_t char16; -typedef std::wstring string16; -typedef std::char_traits string16_char_traits; - -} // namespace base - -#elif defined(WCHAR_T_IS_UTF32) - -#include // For uint16_t - -#include "include/base/cef_macros.h" - -namespace cef { -namespace base { - -typedef uint16_t char16; - -// char16 versions of the functions required by string16_char_traits; these -// are based on the wide character functions of similar names ("w" or "wcs" -// instead of "c16"). -int c16memcmp(const char16* s1, const char16* s2, size_t n); -size_t c16len(const char16* s); -const char16* c16memchr(const char16* s, char16 c, size_t n); -char16* c16memmove(char16* s1, const char16* s2, size_t n); -char16* c16memcpy(char16* s1, const char16* s2, size_t n); -char16* c16memset(char16* s, char16 c, size_t n); - -struct string16_char_traits { - typedef char16 char_type; - typedef int int_type; - - // int_type needs to be able to hold each possible value of char_type, and in - // addition, the distinct value of eof(). - COMPILE_ASSERT(sizeof(int_type) > sizeof(char_type), unexpected_type_width); - - typedef std::streamoff off_type; - typedef mbstate_t state_type; - typedef std::fpos pos_type; - - static void assign(char_type& c1, const char_type& c2) { c1 = c2; } - - static bool eq(const char_type& c1, const char_type& c2) { return c1 == c2; } - static bool lt(const char_type& c1, const char_type& c2) { return c1 < c2; } - - static int compare(const char_type* s1, const char_type* s2, size_t n) { - return c16memcmp(s1, s2, n); - } - - static size_t length(const char_type* s) { return c16len(s); } - - static const char_type* find(const char_type* s, - size_t n, - const char_type& a) { - return c16memchr(s, a, n); - } - - static char_type* move(char_type* s1, const char_type* s2, int_type n) { - return c16memmove(s1, s2, n); - } - - static char_type* copy(char_type* s1, const char_type* s2, size_t n) { - return c16memcpy(s1, s2, n); - } - - static char_type* assign(char_type* s, size_t n, char_type a) { - return c16memset(s, a, n); - } - - static int_type not_eof(const int_type& c) { - return eq_int_type(c, eof()) ? 0 : c; - } - - static char_type to_char_type(const int_type& c) { return char_type(c); } - - static int_type to_int_type(const char_type& c) { return int_type(c); } - - static bool eq_int_type(const int_type& c1, const int_type& c2) { - return c1 == c2; - } - - static int_type eof() { return static_cast(EOF); } -}; - -typedef std::basic_string string16; - -} // namespace base -} // namespace cef - -namespace base { - -typedef cef::base::char16 char16; -typedef cef::base::string16 string16; - -extern std::ostream& operator<<(std::ostream& out, const string16& str); - -// This is required by googletest to print a readable output on test failures. -extern void PrintTo(const string16& str, std::ostream* out); - -} // namespace base - -// The string class will be explicitly instantiated only once, in string16.cc. -// -// std::basic_string<> in GNU libstdc++ contains a static data member, -// _S_empty_rep_storage, to represent empty strings. When an operation such -// as assignment or destruction is performed on a string, causing its existing -// data member to be invalidated, it must not be freed if this static data -// member is being used. Otherwise, it counts as an attempt to free static -// (and not allocated) data, which is a memory error. -// -// Generally, due to C++ template magic, _S_empty_rep_storage will be marked -// as a coalesced symbol, meaning that the linker will combine multiple -// instances into a single one when generating output. -// -// If a string class is used by multiple shared libraries, a problem occurs. -// Each library will get its own copy of _S_empty_rep_storage. When strings -// are passed across a library boundary for alteration or destruction, memory -// errors will result. GNU libstdc++ contains a configuration option, -// --enable-fully-dynamic-string (_GLIBCXX_FULLY_DYNAMIC_STRING), which -// disables the static data member optimization, but it's a good optimization -// and non-STL code is generally at the mercy of the system's STL -// configuration. Fully-dynamic strings are not the default for GNU libstdc++ -// libstdc++ itself or for the libstdc++ installations on the systems we care -// about, such as Mac OS X and relevant flavors of Linux. -// -// See also http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24196 . -// -// To avoid problems, string classes need to be explicitly instantiated only -// once, in exactly one library. All other string users see it via an "extern" -// declaration. This is precisely how GNU libstdc++ handles -// std::basic_string (string) and std::basic_string (wstring). -// -// This also works around a Mac OS X linker bug in ld64-85.2.1 (Xcode 3.1.2), -// in which the linker does not fully coalesce symbols when dead code -// stripping is enabled. This bug causes the memory errors described above -// to occur even when a std::basic_string<> does not cross shared library -// boundaries, such as in statically-linked executables. -// -// TODO(mark): File this bug with Apple and update this note with a bug number. - -extern template class std::basic_string; - -#endif // WCHAR_T_IS_UTF32 - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_STRING16_H_ diff --git a/third_party/cef/include/base/cef_template_util.h b/third_party/cef/include/base/cef_template_util.h deleted file mode 100644 index 38fa5839..00000000 --- a/third_party/cef/include/base/cef_template_util.h +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef CEF_INCLUDE_BASE_CEF_TEMPLATE_UTIL_H_ -#define CEF_INCLUDE_BASE_CEF_TEMPLATE_UTIL_H_ -#pragma once - -#if defined(BASE_TEMPLATE_UTIL_H_) -// Do nothing if the Chromium header has already been included. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/template_util.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include // For size_t. - -#include "include/base/cef_build.h" - -namespace base { - -// template definitions from tr1 - -template -struct integral_constant { - static const T value = v; - typedef T value_type; - typedef integral_constant type; -}; - -template -const T integral_constant::value; - -typedef integral_constant true_type; -typedef integral_constant false_type; - -template -struct is_pointer : false_type {}; -template -struct is_pointer : true_type {}; - -// Member function pointer detection up to four params. Add more as needed -// below. This is built-in to C++ 11, and we can remove this when we switch. -template -struct is_member_function_pointer : false_type {}; - -template -struct is_member_function_pointer : true_type {}; -template -struct is_member_function_pointer : true_type {}; - -template -struct is_member_function_pointer : true_type {}; -template -struct is_member_function_pointer : true_type {}; - -template -struct is_member_function_pointer : true_type {}; -template -struct is_member_function_pointer : true_type {}; - -template -struct is_member_function_pointer : true_type {}; -template -struct is_member_function_pointer : true_type {}; - -template -struct is_member_function_pointer : true_type {}; -template -struct is_member_function_pointer : true_type {}; - -template -struct is_same : public false_type {}; -template -struct is_same : true_type {}; - -template -struct is_array : public false_type {}; -template -struct is_array : public true_type {}; -template -struct is_array : public true_type {}; - -template -struct is_non_const_reference : false_type {}; -template -struct is_non_const_reference : true_type {}; -template -struct is_non_const_reference : false_type {}; - -template -struct is_const : false_type {}; -template -struct is_const : true_type {}; - -template -struct is_void : false_type {}; -template <> -struct is_void : true_type {}; - -namespace cef_internal { - -// Types YesType and NoType are guaranteed such that sizeof(YesType) < -// sizeof(NoType). -typedef char YesType; - -struct NoType { - YesType dummy[2]; -}; - -// This class is an implementation detail for is_convertible, and you -// don't need to know how it works to use is_convertible. For those -// who care: we declare two different functions, one whose argument is -// of type To and one with a variadic argument list. We give them -// return types of different size, so we can use sizeof to trick the -// compiler into telling us which function it would have chosen if we -// had called it with an argument of type From. See Alexandrescu's -// _Modern C++ Design_ for more details on this sort of trick. - -struct ConvertHelper { - template - static YesType Test(To); - - template - static NoType Test(...); - - template - static From& Create(); -}; - -// Used to determine if a type is a struct/union/class. Inspired by Boost's -// is_class type_trait implementation. -struct IsClassHelper { - template - static YesType Test(void (C::*)(void)); - - template - static NoType Test(...); -}; - -} // namespace cef_internal - -// Inherits from true_type if From is convertible to To, false_type otherwise. -// -// Note that if the type is convertible, this will be a true_type REGARDLESS -// of whether or not the conversion would emit a warning. -template -struct is_convertible - : integral_constant( - cef_internal::ConvertHelper::Create())) == - sizeof(cef_internal::YesType)> {}; - -template -struct is_class - : integral_constant(0)) == - sizeof(cef_internal::YesType)> {}; - -template -struct enable_if {}; - -template -struct enable_if { - typedef T type; -}; - -} // namespace base - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_TEMPLATE_UTIL_H_ diff --git a/third_party/cef/include/base/cef_thread_checker.h b/third_party/cef/include/base/cef_thread_checker.h deleted file mode 100644 index e48c8d03..00000000 --- a/third_party/cef/include/base/cef_thread_checker.h +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef CEF_INCLUDE_BASE_THREAD_CHECKER_H_ -#define CEF_INCLUDE_BASE_THREAD_CHECKER_H_ -#pragma once - -#if defined(BASE_THREADING_THREAD_CHECKER_H_) -// Do nothing if the Chromium header has already been included. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/threading/thread_checker.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include "include/base/cef_logging.h" -#include "include/base/internal/cef_thread_checker_impl.h" - -// Apart from debug builds, we also enable the thread checker in -// builds with DCHECK_ALWAYS_ON so that trybots and waterfall bots -// with this define will get the same level of thread checking as -// debug bots. -#if DCHECK_IS_ON() -#define ENABLE_THREAD_CHECKER 1 -#else -#define ENABLE_THREAD_CHECKER 0 -#endif - -namespace base { - -namespace cef_internal { - -// Do nothing implementation, for use in release mode. -// -// Note: You should almost always use the ThreadChecker class to get the -// right version for your build configuration. -class ThreadCheckerDoNothing { - public: - bool CalledOnValidThread() const { return true; } - - void DetachFromThread() {} -}; - -} // namespace cef_internal - -// ThreadChecker is a helper class used to help verify that some methods of a -// class are called from the same thread. It provides identical functionality to -// base::NonThreadSafe, but it is meant to be held as a member variable, rather -// than inherited from base::NonThreadSafe. -// -// While inheriting from base::NonThreadSafe may give a clear indication about -// the thread-safety of a class, it may also lead to violations of the style -// guide with regard to multiple inheritance. The choice between having a -// ThreadChecker member and inheriting from base::NonThreadSafe should be based -// on whether: -// - Derived classes need to know the thread they belong to, as opposed to -// having that functionality fully encapsulated in the base class. -// - Derived classes should be able to reassign the base class to another -// thread, via DetachFromThread. -// -// If neither of these are true, then having a ThreadChecker member and calling -// CalledOnValidThread is the preferable solution. -// -// Example: -// class MyClass { -// public: -// void Foo() { -// DCHECK(thread_checker_.CalledOnValidThread()); -// ... (do stuff) ... -// } -// -// private: -// ThreadChecker thread_checker_; -// } -// -// In Release mode, CalledOnValidThread will always return true. -#if ENABLE_THREAD_CHECKER -class ThreadChecker : public cef_internal::ThreadCheckerImpl {}; -#else -class ThreadChecker : public cef_internal::ThreadCheckerDoNothing {}; -#endif // ENABLE_THREAD_CHECKER - -#undef ENABLE_THREAD_CHECKER - -} // namespace base - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_THREAD_CHECKER_H_ diff --git a/third_party/cef/include/base/cef_trace_event.h b/third_party/cef/include/base/cef_trace_event.h deleted file mode 100644 index 1b2cad01..00000000 --- a/third_party/cef/include/base/cef_trace_event.h +++ /dev/null @@ -1,420 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -/// -// Trace events are for tracking application performance and resource usage. -// Macros are provided to track: -// Begin and end of function calls -// Counters -// -// Events are issued against categories. Whereas LOG's categories are statically -// defined, TRACE categories are created implicitly with a string. For example: -// TRACE_EVENT_INSTANT0("MY_SUBSYSTEM", "SomeImportantEvent") -// -// Events can be INSTANT, or can be pairs of BEGIN and END in the same scope: -// TRACE_EVENT_BEGIN0("MY_SUBSYSTEM", "SomethingCostly") -// doSomethingCostly() -// TRACE_EVENT_END0("MY_SUBSYSTEM", "SomethingCostly") -// Note: Our tools can't always determine the correct BEGIN/END pairs unless -// these are used in the same scope. Use ASYNC_BEGIN/ASYNC_END macros if you -// need them to be in separate scopes. -// -// A common use case is to trace entire function scopes. This issues a trace -// BEGIN and END automatically: -// void doSomethingCostly() { -// TRACE_EVENT0("MY_SUBSYSTEM", "doSomethingCostly"); -// ... -// } -// -// Additional parameters can be associated with an event: -// void doSomethingCostly2(int howMuch) { -// TRACE_EVENT1("MY_SUBSYSTEM", "doSomethingCostly", -// "howMuch", howMuch); -// ... -// } -// -// The trace system will automatically add to this information the current -// process id, thread id, and a timestamp in microseconds. -// -// To trace an asynchronous procedure such as an IPC send/receive, use -// ASYNC_BEGIN and ASYNC_END: -// [single threaded sender code] -// static int send_count = 0; -// ++send_count; -// TRACE_EVENT_ASYNC_BEGIN0("ipc", "message", send_count); -// Send(new MyMessage(send_count)); -// [receive code] -// void OnMyMessage(send_count) { -// TRACE_EVENT_ASYNC_END0("ipc", "message", send_count); -// } -// The third parameter is a unique ID to match ASYNC_BEGIN/ASYNC_END pairs. -// ASYNC_BEGIN and ASYNC_END can occur on any thread of any traced process. -// Pointers can be used for the ID parameter, and they will be mangled -// internally so that the same pointer on two different processes will not -// match. For example: -// class MyTracedClass { -// public: -// MyTracedClass() { -// TRACE_EVENT_ASYNC_BEGIN0("category", "MyTracedClass", this); -// } -// ~MyTracedClass() { -// TRACE_EVENT_ASYNC_END0("category", "MyTracedClass", this); -// } -// } -// -// The trace event also supports counters, which is a way to track a quantity -// as it varies over time. Counters are created with the following macro: -// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter", g_myCounterValue); -// -// Counters are process-specific. The macro itself can be issued from any -// thread, however. -// -// Sometimes, you want to track two counters at once. You can do this with two -// counter macros: -// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter0", g_myCounterValue[0]); -// TRACE_COUNTER1("MY_SUBSYSTEM", "myCounter1", g_myCounterValue[1]); -// Or you can do it with a combined macro: -// TRACE_COUNTER2("MY_SUBSYSTEM", "myCounter", -// "bytesPinned", g_myCounterValue[0], -// "bytesAllocated", g_myCounterValue[1]); -// This indicates to the tracing UI that these counters should be displayed -// in a single graph, as a summed area chart. -// -// Since counters are in a global namespace, you may want to disembiguate with a -// unique ID, by using the TRACE_COUNTER_ID* variations. -// -// By default, trace collection is compiled in, but turned off at runtime. -// Collecting trace data is the responsibility of the embedding application. In -// CEF's case, calling BeginTracing will turn on tracing on all active -// processes. -// -// -// Memory scoping note: -// Tracing copies the pointers, not the string content, of the strings passed -// in for category, name, and arg_names. Thus, the following code will cause -// problems: -// char* str = strdup("impprtantName"); -// TRACE_EVENT_INSTANT0("SUBSYSTEM", str); // BAD! -// free(str); // Trace system now has dangling pointer -// -// To avoid this issue with the |name| and |arg_name| parameters, use the -// TRACE_EVENT_COPY_XXX overloads of the macros at additional runtime -// overhead. -// Notes: The category must always be in a long-lived char* (i.e. static const). -// The |arg_values|, when used, are always deep copied with the _COPY -// macros. -// -// -// Thread Safety: -// All macros are thread safe and can be used from any process. -/// - -#ifndef CEF_INCLUDE_BASE_CEF_TRACE_EVENT_H_ -#define CEF_INCLUDE_BASE_CEF_TRACE_EVENT_H_ -#pragma once - -#if defined(TRACE_EVENT0) -// Do nothing if the macros provided by this header already exist. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/trace_event/trace_event.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include "include/internal/cef_trace_event_internal.h" - -// Records a pair of begin and end events called "name" for the current -// scope, with 0, 1 or 2 associated arguments. If the category is not -// enabled, then this does nothing. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -#define TRACE_EVENT0(category, name) \ - cef_trace_event_begin(category, name, NULL, 0, NULL, 0, false); \ - CEF_INTERNAL_TRACE_END_ON_SCOPE_CLOSE(category, name) -#define TRACE_EVENT1(category, name, arg1_name, arg1_val) \ - cef_trace_event_begin(category, name, arg1_name, arg1_val, NULL, 0, false); \ - CEF_INTERNAL_TRACE_END_ON_SCOPE_CLOSE(category, name) -#define TRACE_EVENT2(category, name, arg1_name, arg1_val, arg2_name, arg2_val) \ - cef_trace_event_begin(category, name, arg1_name, arg1_val, arg2_name, \ - arg2_val, false); \ - CEF_INTERNAL_TRACE_END_ON_SCOPE_CLOSE(category, name) - -// Implementation detail: trace event macros create temporary variable names. -// These macros give each temporary variable a unique name based on the line -// number to prevent name collisions. -#define CEF_INTERNAL_TRACE_EVENT_UID3(a, b) cef_trace_event_unique_##a##b -#define CEF_INTERNAL_TRACE_EVENT_UID2(a, b) CEF_INTERNAL_TRACE_EVENT_UID3(a, b) -#define CEF_INTERNAL_TRACE_EVENT_UID(name_prefix) \ - CEF_INTERNAL_TRACE_EVENT_UID2(name_prefix, __LINE__) - -// Implementation detail: internal macro to end end event when the scope ends. -#define CEF_INTERNAL_TRACE_END_ON_SCOPE_CLOSE(category, name) \ - cef_trace_event::CefTraceEndOnScopeClose CEF_INTERNAL_TRACE_EVENT_UID( \ - profileScope)(category, name) - -// Records a single event called "name" immediately, with 0, 1 or 2 -// associated arguments. If the category is not enabled, then this -// does nothing. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -#define TRACE_EVENT_INSTANT0(category, name) \ - cef_trace_event_instant(category, name, NULL, 0, NULL, 0, false) -#define TRACE_EVENT_INSTANT1(category, name, arg1_name, arg1_val) \ - cef_trace_event_instant(category, name, arg1_name, arg1_val, NULL, 0, false) -#define TRACE_EVENT_INSTANT2(category, name, arg1_name, arg1_val, arg2_name, \ - arg2_val) \ - cef_trace_event_instant(category, name, arg1_name, arg1_val, arg2_name, \ - arg2_val, false) -#define TRACE_EVENT_COPY_INSTANT0(category, name) \ - cef_trace_event_instant(category, name, NULL, 0, NULL, 0, true) -#define TRACE_EVENT_COPY_INSTANT1(category, name, arg1_name, arg1_val) \ - cef_trace_event_instant(category, name, arg1_name, arg1_val, NULL, 0, true) -#define TRACE_EVENT_COPY_INSTANT2(category, name, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - cef_trace_event_instant(category, name, arg1_name, arg1_val, arg2_name, \ - arg2_val, true) - -// Records a single BEGIN event called "name" immediately, with 0, 1 or 2 -// associated arguments. If the category is not enabled, then this -// does nothing. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -#define TRACE_EVENT_BEGIN0(category, name) \ - cef_trace_event_begin(category, name, NULL, 0, NULL, 0, false) -#define TRACE_EVENT_BEGIN1(category, name, arg1_name, arg1_val) \ - cef_trace_event_begin(category, name, arg1_name, arg1_val, NULL, 0, false) -#define TRACE_EVENT_BEGIN2(category, name, arg1_name, arg1_val, arg2_name, \ - arg2_val) \ - cef_trace_event_begin(category, name, arg1_name, arg1_val, arg2_name, \ - arg2_val, false) -#define TRACE_EVENT_COPY_BEGIN0(category, name) \ - cef_trace_event_begin(category, name, NULL, 0, NULL, 0, true) -#define TRACE_EVENT_COPY_BEGIN1(category, name, arg1_name, arg1_val) \ - cef_trace_event_begin(category, name, arg1_name, arg1_val, NULL, 0, true) -#define TRACE_EVENT_COPY_BEGIN2(category, name, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - cef_trace_event_begin(category, name, arg1_name, arg1_val, arg2_name, \ - arg2_val, true) - -// Records a single END event for "name" immediately. If the category -// is not enabled, then this does nothing. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -#define TRACE_EVENT_END0(category, name) \ - cef_trace_event_end(category, name, NULL, 0, NULL, 0, false) -#define TRACE_EVENT_END1(category, name, arg1_name, arg1_val) \ - cef_trace_event_end(category, name, arg1_name, arg1_val, NULL, 0, false) -#define TRACE_EVENT_END2(category, name, arg1_name, arg1_val, arg2_name, \ - arg2_val) \ - cef_trace_event_end(category, name, arg1_name, arg1_val, arg2_name, \ - arg2_val, false) -#define TRACE_EVENT_COPY_END0(category, name) \ - cef_trace_event_end(category, name, NULL, 0, NULL, 0, true) -#define TRACE_EVENT_COPY_END1(category, name, arg1_name, arg1_val) \ - cef_trace_event_end(category, name, arg1_name, arg1_val, NULL, 0, true) -#define TRACE_EVENT_COPY_END2(category, name, arg1_name, arg1_val, arg2_name, \ - arg2_val) \ - cef_trace_event_end(category, name, arg1_name, arg1_val, arg2_name, \ - arg2_val, true) - -// Records the value of a counter called "name" immediately. Value -// must be representable as a 32 bit integer. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -#define TRACE_COUNTER1(category, name, value) \ - cef_trace_counter(category, name, NULL, value, NULL, 0, false) -#define TRACE_COPY_COUNTER1(category, name, value) \ - cef_trace_counter(category, name, NULL, value, NULL, 0, true) - -// Records the values of a multi-parted counter called "name" immediately. -// The UI will treat value1 and value2 as parts of a whole, displaying their -// values as a stacked-bar chart. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -#define TRACE_COUNTER2(category, name, value1_name, value1_val, value2_name, \ - value2_val) \ - cef_trace_counter(category, name, value1_name, value1_val, value2_name, \ - value2_val, false) -#define TRACE_COPY_COUNTER2(category, name, value1_name, value1_val, \ - value2_name, value2_val) \ - cef_trace_counter(category, name, value1_name, value1_val, value2_name, \ - value2_val, true) - -// Records the value of a counter called "name" immediately. Value -// must be representable as a 32 bit integer. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -// - |id| is used to disambiguate counters with the same name. It must either -// be a pointer or an integer value up to 64 bits. If it's a pointer, the -// bits will be xored with a hash of the process ID so that the same pointer -// on two different processes will not collide. -#define TRACE_COUNTER_ID1(category, name, id, value) \ - cef_trace_counter_id(category, name, id, NULL, value, NULL, 0, false) -#define TRACE_COPY_COUNTER_ID1(category, name, id, value) \ - cef_trace_counter_id(category, name, id, NULL, value, NULL, 0, true) - -// Records the values of a multi-parted counter called "name" immediately. -// The UI will treat value1 and value2 as parts of a whole, displaying their -// values as a stacked-bar chart. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -// - |id| is used to disambiguate counters with the same name. It must either -// be a pointer or an integer value up to 64 bits. If it's a pointer, the -// bits will be xored with a hash of the process ID so that the same pointer -// on two different processes will not collide. -#define TRACE_COUNTER_ID2(category, name, id, value1_name, value1_val, \ - value2_name, value2_val) \ - cef_trace_counter_id(category, name, id, value1_name, value1_val, \ - value2_name, value2_val, false) -#define TRACE_COPY_COUNTER_ID2(category, name, id, value1_name, value1_val, \ - value2_name, value2_val) \ - cef_trace_counter_id(category, name, id, value1_name, value1_val, \ - value2_name, value2_val, true) - -// Records a single ASYNC_BEGIN event called "name" immediately, with 0, 1 or 2 -// associated arguments. If the category is not enabled, then this -// does nothing. -// - category and name strings must have application lifetime (statics or -// literals). They may not include " chars. -// - |id| is used to match the ASYNC_BEGIN event with the ASYNC_END event. -// ASYNC events are considered to match if their category, name and id values -// all match. |id| must either be a pointer or an integer value up to 64 -// bits. If it's a pointer, the bits will be xored with a hash of the process -// ID sothat the same pointer on two different processes will not collide. -// An asynchronous operation can consist of multiple phases. The first phase is -// defined by the ASYNC_BEGIN calls. Additional phases can be defined using the -// ASYNC_STEP_BEGIN macros. When the operation completes, call ASYNC_END. -// An async operation can span threads and processes, but all events in that -// operation must use the same |name| and |id|. Each event can have its own -// args. -#define TRACE_EVENT_ASYNC_BEGIN0(category, name, id) \ - cef_trace_event_async_begin(category, name, id, NULL, 0, NULL, 0, false) -#define TRACE_EVENT_ASYNC_BEGIN1(category, name, id, arg1_name, arg1_val) \ - cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, NULL, \ - 0, false) -#define TRACE_EVENT_ASYNC_BEGIN2(category, name, id, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, \ - arg2_name, arg2_val, false) -#define TRACE_EVENT_COPY_ASYNC_BEGIN0(category, name, id) \ - cef_trace_event_async_begin(category, name, id, NULL, 0, NULL, 0, true) -#define TRACE_EVENT_COPY_ASYNC_BEGIN1(category, name, id, arg1_name, arg1_val) \ - cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, NULL, \ - 0, true) -#define TRACE_EVENT_COPY_ASYNC_BEGIN2(category, name, id, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - cef_trace_event_async_begin(category, name, id, arg1_name, arg1_val, \ - arg2_name, arg2_val, true) - -// Records a single ASYNC_STEP_INTO event for |step| immediately. If the -// category is not enabled, then this does nothing. The |name| and |id| must -// match the ASYNC_BEGIN event above. The |step| param identifies this step -// within the async event. This should be called at the beginning of the next -// phase of an asynchronous operation. The ASYNC_BEGIN event must not have any -// ASYNC_STEP_PAST events. -#define TRACE_EVENT_ASYNC_STEP_INTO0(category, name, id, step) \ - cef_trace_event_async_step_into(category, name, id, step, NULL, 0, false) -#define TRACE_EVENT_ASYNC_STEP_INTO1(category, name, id, step, arg1_name, \ - arg1_val) \ - cef_trace_event_async_step_into(category, name, id, step, arg1_name, \ - arg1_val, false) -#define TRACE_EVENT_COPY_ASYNC_STEP_INTO0(category, name, id, step) \ - cef_trace_event_async_step_into(category, name, id, step, NULL, 0, true) -#define TRACE_EVENT_COPY_ASYNC_STEP_INTO1(category, name, id, step, arg1_name, \ - arg1_val) \ - cef_trace_event_async_step_into(category, name, id, step, arg1_name, \ - arg1_val, true) - -// Records a single ASYNC_STEP_PAST event for |step| immediately. If the -// category is not enabled, then this does nothing. The |name| and |id| must -// match the ASYNC_BEGIN event above. The |step| param identifies this step -// within the async event. This should be called at the beginning of the next -// phase of an asynchronous operation. The ASYNC_BEGIN event must not have any -// ASYNC_STEP_INTO events. -#define TRACE_EVENT_ASYNC_STEP_PAST0(category, name, id, step) \ - cef_trace_event_async_step_past(category, name, id, step, NULL, 0, false) -#define TRACE_EVENT_ASYNC_STEP_PAST1(category, name, id, step, arg1_name, \ - arg1_val) \ - cef_trace_event_async_step_past(category, name, id, step, arg1_name, \ - arg1_val, false) -#define TRACE_EVENT_COPY_ASYNC_STEP_PAST0(category, name, id, step) \ - cef_trace_event_async_step_past(category, name, id, step, NULL, 0, true) -#define TRACE_EVENT_COPY_ASYNC_STEP_PAST1(category, name, id, step, arg1_name, \ - arg1_val) \ - cef_trace_event_async_step_past(category, name, id, step, arg1_name, \ - arg1_val, true) - -// Records a single ASYNC_END event for "name" immediately. If the category -// is not enabled, then this does nothing. -#define TRACE_EVENT_ASYNC_END0(category, name, id) \ - cef_trace_event_async_end(category, name, id, NULL, 0, NULL, 0, false) -#define TRACE_EVENT_ASYNC_END1(category, name, id, arg1_name, arg1_val) \ - cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, NULL, 0, \ - false) -#define TRACE_EVENT_ASYNC_END2(category, name, id, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, \ - arg2_name, arg2_val, false) -#define TRACE_EVENT_COPY_ASYNC_END0(category, name, id) \ - cef_trace_event_async_end(category, name, id, NULL, 0, NULL, 0, true) -#define TRACE_EVENT_COPY_ASYNC_END1(category, name, id, arg1_name, arg1_val) \ - cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, NULL, 0, \ - true) -#define TRACE_EVENT_COPY_ASYNC_END2(category, name, id, arg1_name, arg1_val, \ - arg2_name, arg2_val) \ - cef_trace_event_async_end(category, name, id, arg1_name, arg1_val, \ - arg2_name, arg2_val, true) - -namespace cef_trace_event { - -// Used by TRACE_EVENTx macro. Do not use directly. -class CefTraceEndOnScopeClose { - public: - CefTraceEndOnScopeClose(const char* category, const char* name) - : category_(category), name_(name) {} - ~CefTraceEndOnScopeClose() { - cef_trace_event_end(category_, name_, NULL, 0, NULL, 0, false); - } - - private: - const char* category_; - const char* name_; -}; - -} // cef_trace_event - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_TRACE_EVENT_H_ diff --git a/third_party/cef/include/base/cef_tuple.h b/third_party/cef/include/base/cef_tuple.h deleted file mode 100644 index aeb6e9ce..00000000 --- a/third_party/cef/include/base/cef_tuple.h +++ /dev/null @@ -1,1610 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// A Tuple is a generic templatized container, similar in concept to std::pair. -// There are classes Tuple0 to Tuple6, cooresponding to the number of elements -// it contains. The convenient MakeTuple() function takes 0 to 6 arguments, -// and will construct and return the appropriate Tuple object. The functions -// DispatchToMethod and DispatchToFunction take a function pointer or instance -// and method pointer, and unpack a tuple into arguments to the call. -// -// Tuple elements are copied by value, and stored in the tuple. See the unit -// tests for more details of how/when the values are copied. -// -// Example usage: -// // These two methods of creating a Tuple are identical. -// Tuple2 tuple_a(1, "wee"); -// Tuple2 tuple_b = MakeTuple(1, "wee"); -// -// void SomeFunc(int a, const char* b) { } -// DispatchToFunction(&SomeFunc, tuple_a); // SomeFunc(1, "wee") -// DispatchToFunction( -// &SomeFunc, MakeTuple(10, "foo")); // SomeFunc(10, "foo") -// -// struct { void SomeMeth(int a, int b, int c) { } } foo; -// DispatchToMethod(&foo, &Foo::SomeMeth, MakeTuple(1, 2, 3)); -// // foo->SomeMeth(1, 2, 3); - -#ifndef CEF_INCLUDE_BASE_CEF_TUPLE_H_ -#define CEF_INCLUDE_BASE_CEF_TUPLE_H_ -#pragma once - -#if defined(BASE_TUPLE_H_) -// Do nothing if the Chromium header has already been included. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/tuple.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include "include/base/cef_bind_helpers.h" - -namespace base { - -// Traits ---------------------------------------------------------------------- -// -// A simple traits class for tuple arguments. -// -// ValueType: the bare, nonref version of a type (same as the type for nonrefs). -// RefType: the ref version of a type (same as the type for refs). -// ParamType: what type to pass to functions (refs should not be constified). - -template -struct TupleTraits { - typedef P ValueType; - typedef P& RefType; - typedef const P& ParamType; -}; - -template -struct TupleTraits { - typedef P ValueType; - typedef P& RefType; - typedef P& ParamType; -}; - -template -struct TupleTypes {}; - -// Tuple ----------------------------------------------------------------------- -// -// This set of classes is useful for bundling 0 or more heterogeneous data types -// into a single variable. The advantage of this is that it greatly simplifies -// function objects that need to take an arbitrary number of parameters; see -// RunnableMethod and IPC::MessageWithTuple. -// -// Tuple0 is supplied to act as a 'void' type. It can be used, for example, -// when dispatching to a function that accepts no arguments (see the -// Dispatchers below). -// Tuple1 is rarely useful. One such use is when A is non-const ref that you -// want filled by the dispatchee, and the tuple is merely a container for that -// output (a "tier"). See MakeRefTuple and its usages. - -struct Tuple0 { - typedef Tuple0 ValueTuple; - typedef Tuple0 RefTuple; - typedef Tuple0 ParamTuple; -}; - -template -struct Tuple1 { - public: - typedef A TypeA; - - Tuple1() {} - explicit Tuple1(typename TupleTraits::ParamType a) : a(a) {} - - A a; -}; - -template -struct Tuple2 { - public: - typedef A TypeA; - typedef B TypeB; - - Tuple2() {} - Tuple2(typename TupleTraits::ParamType a, - typename TupleTraits::ParamType b) - : a(a), b(b) {} - - A a; - B b; -}; - -template -struct Tuple3 { - public: - typedef A TypeA; - typedef B TypeB; - typedef C TypeC; - - Tuple3() {} - Tuple3(typename TupleTraits::ParamType a, - typename TupleTraits::ParamType b, - typename TupleTraits::ParamType c) - : a(a), b(b), c(c) {} - - A a; - B b; - C c; -}; - -template -struct Tuple4 { - public: - typedef A TypeA; - typedef B TypeB; - typedef C TypeC; - typedef D TypeD; - - Tuple4() {} - Tuple4(typename TupleTraits::ParamType a, - typename TupleTraits::ParamType b, - typename TupleTraits::ParamType c, - typename TupleTraits::ParamType d) - : a(a), b(b), c(c), d(d) {} - - A a; - B b; - C c; - D d; -}; - -template -struct Tuple5 { - public: - typedef A TypeA; - typedef B TypeB; - typedef C TypeC; - typedef D TypeD; - typedef E TypeE; - - Tuple5() {} - Tuple5(typename TupleTraits::ParamType a, - typename TupleTraits::ParamType b, - typename TupleTraits::ParamType c, - typename TupleTraits::ParamType d, - typename TupleTraits::ParamType e) - : a(a), b(b), c(c), d(d), e(e) {} - - A a; - B b; - C c; - D d; - E e; -}; - -template -struct Tuple6 { - public: - typedef A TypeA; - typedef B TypeB; - typedef C TypeC; - typedef D TypeD; - typedef E TypeE; - typedef F TypeF; - - Tuple6() {} - Tuple6(typename TupleTraits::ParamType a, - typename TupleTraits::ParamType b, - typename TupleTraits::ParamType c, - typename TupleTraits::ParamType d, - typename TupleTraits::ParamType e, - typename TupleTraits::ParamType f) - : a(a), b(b), c(c), d(d), e(e), f(f) {} - - A a; - B b; - C c; - D d; - E e; - F f; -}; - -template -struct Tuple7 { - public: - typedef A TypeA; - typedef B TypeB; - typedef C TypeC; - typedef D TypeD; - typedef E TypeE; - typedef F TypeF; - typedef G TypeG; - - Tuple7() {} - Tuple7(typename TupleTraits::ParamType a, - typename TupleTraits::ParamType b, - typename TupleTraits::ParamType c, - typename TupleTraits::ParamType d, - typename TupleTraits::ParamType e, - typename TupleTraits::ParamType f, - typename TupleTraits::ParamType g) - : a(a), b(b), c(c), d(d), e(e), f(f), g(g) {} - - A a; - B b; - C c; - D d; - E e; - F f; - G g; -}; - -template -struct Tuple8 { - public: - typedef A TypeA; - typedef B TypeB; - typedef C TypeC; - typedef D TypeD; - typedef E TypeE; - typedef F TypeF; - typedef G TypeG; - typedef H TypeH; - - Tuple8() {} - Tuple8(typename TupleTraits::ParamType a, - typename TupleTraits::ParamType b, - typename TupleTraits::ParamType c, - typename TupleTraits::ParamType d, - typename TupleTraits::ParamType e, - typename TupleTraits::ParamType f, - typename TupleTraits::ParamType g, - typename TupleTraits::ParamType h) - : a(a), b(b), c(c), d(d), e(e), f(f), g(g), h(h) {} - - A a; - B b; - C c; - D d; - E e; - F f; - G g; - H h; -}; - -// Tuple types ---------------------------------------------------------------- -// -// Allows for selection of ValueTuple/RefTuple/ParamTuple without needing the -// definitions of class types the tuple takes as parameters. - -template <> -struct TupleTypes { - typedef Tuple0 ValueTuple; - typedef Tuple0 RefTuple; - typedef Tuple0 ParamTuple; -}; - -template -struct TupleTypes> { - typedef Tuple1::ValueType> ValueTuple; - typedef Tuple1::RefType> RefTuple; - typedef Tuple1::ParamType> ParamTuple; -}; - -template -struct TupleTypes> { - typedef Tuple2::ValueType, - typename TupleTraits::ValueType> - ValueTuple; - typedef Tuple2::RefType, - typename TupleTraits::RefType> - RefTuple; - typedef Tuple2::ParamType, - typename TupleTraits::ParamType> - ParamTuple; -}; - -template -struct TupleTypes> { - typedef Tuple3::ValueType, - typename TupleTraits::ValueType, - typename TupleTraits::ValueType> - ValueTuple; - typedef Tuple3::RefType, - typename TupleTraits::RefType, - typename TupleTraits::RefType> - RefTuple; - typedef Tuple3::ParamType, - typename TupleTraits::ParamType, - typename TupleTraits::ParamType> - ParamTuple; -}; - -template -struct TupleTypes> { - typedef Tuple4::ValueType, - typename TupleTraits::ValueType, - typename TupleTraits::ValueType, - typename TupleTraits::ValueType> - ValueTuple; - typedef Tuple4::RefType, - typename TupleTraits::RefType, - typename TupleTraits::RefType, - typename TupleTraits::RefType> - RefTuple; - typedef Tuple4::ParamType, - typename TupleTraits::ParamType, - typename TupleTraits::ParamType, - typename TupleTraits::ParamType> - ParamTuple; -}; - -template -struct TupleTypes> { - typedef Tuple5::ValueType, - typename TupleTraits::ValueType, - typename TupleTraits::ValueType, - typename TupleTraits::ValueType, - typename TupleTraits::ValueType> - ValueTuple; - typedef Tuple5::RefType, - typename TupleTraits::RefType, - typename TupleTraits::RefType, - typename TupleTraits::RefType, - typename TupleTraits::RefType> - RefTuple; - typedef Tuple5::ParamType, - typename TupleTraits::ParamType, - typename TupleTraits::ParamType, - typename TupleTraits::ParamType, - typename TupleTraits::ParamType> - ParamTuple; -}; - -template -struct TupleTypes> { - typedef Tuple6::ValueType, - typename TupleTraits::ValueType, - typename TupleTraits::ValueType, - typename TupleTraits::ValueType, - typename TupleTraits::ValueType, - typename TupleTraits::ValueType> - ValueTuple; - typedef Tuple6::RefType, - typename TupleTraits::RefType, - typename TupleTraits::RefType, - typename TupleTraits::RefType, - typename TupleTraits::RefType, - typename TupleTraits::RefType> - RefTuple; - typedef Tuple6::ParamType, - typename TupleTraits::ParamType, - typename TupleTraits::ParamType, - typename TupleTraits::ParamType, - typename TupleTraits::ParamType, - typename TupleTraits::ParamType> - ParamTuple; -}; - -template -struct TupleTypes> { - typedef Tuple7::ValueType, - typename TupleTraits::ValueType, - typename TupleTraits::ValueType, - typename TupleTraits::ValueType, - typename TupleTraits::ValueType, - typename TupleTraits::ValueType, - typename TupleTraits::ValueType> - ValueTuple; - typedef Tuple7::RefType, - typename TupleTraits::RefType, - typename TupleTraits::RefType, - typename TupleTraits::RefType, - typename TupleTraits::RefType, - typename TupleTraits::RefType, - typename TupleTraits::RefType> - RefTuple; - typedef Tuple7::ParamType, - typename TupleTraits::ParamType, - typename TupleTraits::ParamType, - typename TupleTraits::ParamType, - typename TupleTraits::ParamType, - typename TupleTraits::ParamType, - typename TupleTraits::ParamType> - ParamTuple; -}; - -template -struct TupleTypes> { - typedef Tuple8::ValueType, - typename TupleTraits::ValueType, - typename TupleTraits::ValueType, - typename TupleTraits::ValueType, - typename TupleTraits::ValueType, - typename TupleTraits::ValueType, - typename TupleTraits::ValueType, - typename TupleTraits::ValueType> - ValueTuple; - typedef Tuple8::RefType, - typename TupleTraits::RefType, - typename TupleTraits::RefType, - typename TupleTraits::RefType, - typename TupleTraits::RefType, - typename TupleTraits::RefType, - typename TupleTraits::RefType, - typename TupleTraits::RefType> - RefTuple; - typedef Tuple8::ParamType, - typename TupleTraits::ParamType, - typename TupleTraits::ParamType, - typename TupleTraits::ParamType, - typename TupleTraits::ParamType, - typename TupleTraits::ParamType, - typename TupleTraits::ParamType, - typename TupleTraits::ParamType> - ParamTuple; -}; - -// Tuple creators ------------------------------------------------------------- -// -// Helper functions for constructing tuples while inferring the template -// argument types. - -inline Tuple0 MakeTuple() { - return Tuple0(); -} - -template -inline Tuple1 MakeTuple(const A& a) { - return Tuple1(a); -} - -template -inline Tuple2 MakeTuple(const A& a, const B& b) { - return Tuple2(a, b); -} - -template -inline Tuple3 MakeTuple(const A& a, const B& b, const C& c) { - return Tuple3(a, b, c); -} - -template -inline Tuple4 MakeTuple(const A& a, - const B& b, - const C& c, - const D& d) { - return Tuple4(a, b, c, d); -} - -template -inline Tuple5 MakeTuple(const A& a, - const B& b, - const C& c, - const D& d, - const E& e) { - return Tuple5(a, b, c, d, e); -} - -template -inline Tuple6 MakeTuple(const A& a, - const B& b, - const C& c, - const D& d, - const E& e, - const F& f) { - return Tuple6(a, b, c, d, e, f); -} - -template -inline Tuple7 MakeTuple(const A& a, - const B& b, - const C& c, - const D& d, - const E& e, - const F& f, - const G& g) { - return Tuple7(a, b, c, d, e, f, g); -} - -template -inline Tuple8 MakeTuple(const A& a, - const B& b, - const C& c, - const D& d, - const E& e, - const F& f, - const G& g, - const H& h) { - return Tuple8(a, b, c, d, e, f, g, h); -} - -// The following set of helpers make what Boost refers to as "Tiers" - a tuple -// of references. - -template -inline Tuple1 MakeRefTuple(A& a) { - return Tuple1(a); -} - -template -inline Tuple2 MakeRefTuple(A& a, B& b) { - return Tuple2(a, b); -} - -template -inline Tuple3 MakeRefTuple(A& a, B& b, C& c) { - return Tuple3(a, b, c); -} - -template -inline Tuple4 MakeRefTuple(A& a, B& b, C& c, D& d) { - return Tuple4(a, b, c, d); -} - -template -inline Tuple5 MakeRefTuple(A& a, B& b, C& c, D& d, E& e) { - return Tuple5(a, b, c, d, e); -} - -template -inline Tuple6 MakeRefTuple(A& a, - B& b, - C& c, - D& d, - E& e, - F& f) { - return Tuple6(a, b, c, d, e, f); -} - -template -inline Tuple7 -MakeRefTuple(A& a, B& b, C& c, D& d, E& e, F& f, G& g) { - return Tuple7(a, b, c, d, e, f, g); -} - -template -inline Tuple8 -MakeRefTuple(A& a, B& b, C& c, D& d, E& e, F& f, G& g, H& h) { - return Tuple8(a, b, c, d, e, f, g, h); -} - -// Dispatchers ---------------------------------------------------------------- -// -// Helper functions that call the given method on an object, with the unpacked -// tuple arguments. Notice that they all have the same number of arguments, -// so you need only write: -// DispatchToMethod(object, &Object::method, args); -// This is very useful for templated dispatchers, since they don't need to know -// what type |args| is. - -// Non-Static Dispatchers with no out params. - -template -inline void DispatchToMethod(ObjT* obj, Method method, const Tuple0& arg) { - (obj->*method)(); -} - -template -inline void DispatchToMethod(ObjT* obj, Method method, const A& arg) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(arg)); -} - -template -inline void DispatchToMethod(ObjT* obj, Method method, const Tuple1& arg) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(arg.a)); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple2& arg) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(arg.a), - base::cef_internal::UnwrapTraits::Unwrap(arg.b)); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple3& arg) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(arg.a), - base::cef_internal::UnwrapTraits::Unwrap(arg.b), - base::cef_internal::UnwrapTraits::Unwrap(arg.c)); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple4& arg) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(arg.a), - base::cef_internal::UnwrapTraits::Unwrap(arg.b), - base::cef_internal::UnwrapTraits::Unwrap(arg.c), - base::cef_internal::UnwrapTraits::Unwrap(arg.d)); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple5& arg) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(arg.a), - base::cef_internal::UnwrapTraits::Unwrap(arg.b), - base::cef_internal::UnwrapTraits::Unwrap(arg.c), - base::cef_internal::UnwrapTraits::Unwrap(arg.d), - base::cef_internal::UnwrapTraits::Unwrap(arg.e)); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple6& arg) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(arg.a), - base::cef_internal::UnwrapTraits::Unwrap(arg.b), - base::cef_internal::UnwrapTraits::Unwrap(arg.c), - base::cef_internal::UnwrapTraits::Unwrap(arg.d), - base::cef_internal::UnwrapTraits::Unwrap(arg.e), - base::cef_internal::UnwrapTraits::Unwrap(arg.f)); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple7& arg) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(arg.a), - base::cef_internal::UnwrapTraits::Unwrap(arg.b), - base::cef_internal::UnwrapTraits::Unwrap(arg.c), - base::cef_internal::UnwrapTraits::Unwrap(arg.d), - base::cef_internal::UnwrapTraits::Unwrap(arg.e), - base::cef_internal::UnwrapTraits::Unwrap(arg.f), - base::cef_internal::UnwrapTraits::Unwrap(arg.g)); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple8& arg) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(arg.a), - base::cef_internal::UnwrapTraits::Unwrap(arg.b), - base::cef_internal::UnwrapTraits::Unwrap(arg.c), - base::cef_internal::UnwrapTraits::Unwrap(arg.d), - base::cef_internal::UnwrapTraits::Unwrap(arg.e), - base::cef_internal::UnwrapTraits::Unwrap(arg.f), - base::cef_internal::UnwrapTraits::Unwrap(arg.g), - base::cef_internal::UnwrapTraits::Unwrap(arg.h)); -} - -// Static Dispatchers with no out params. - -template -inline void DispatchToFunction(Function function, const Tuple0& arg) { - (*function)(); -} - -template -inline void DispatchToFunction(Function function, const A& arg) { - (*function)(arg); -} - -template -inline void DispatchToFunction(Function function, const Tuple1& arg) { - (*function)(base::cef_internal::UnwrapTraits::Unwrap(arg.a)); -} - -template -inline void DispatchToFunction(Function function, const Tuple2& arg) { - (*function)(base::cef_internal::UnwrapTraits::Unwrap(arg.a), - base::cef_internal::UnwrapTraits::Unwrap(arg.b)); -} - -template -inline void DispatchToFunction(Function function, const Tuple3& arg) { - (*function)(base::cef_internal::UnwrapTraits::Unwrap(arg.a), - base::cef_internal::UnwrapTraits::Unwrap(arg.b), - base::cef_internal::UnwrapTraits::Unwrap(arg.c)); -} - -template -inline void DispatchToFunction(Function function, - const Tuple4& arg) { - (*function)(base::cef_internal::UnwrapTraits::Unwrap(arg.a), - base::cef_internal::UnwrapTraits::Unwrap(arg.b), - base::cef_internal::UnwrapTraits::Unwrap(arg.c), - base::cef_internal::UnwrapTraits::Unwrap(arg.d)); -} - -template -inline void DispatchToFunction(Function function, - const Tuple5& arg) { - (*function)(base::cef_internal::UnwrapTraits::Unwrap(arg.a), - base::cef_internal::UnwrapTraits::Unwrap(arg.b), - base::cef_internal::UnwrapTraits::Unwrap(arg.c), - base::cef_internal::UnwrapTraits::Unwrap(arg.d), - base::cef_internal::UnwrapTraits::Unwrap(arg.e)); -} - -template -inline void DispatchToFunction(Function function, - const Tuple6& arg) { - (*function)(base::cef_internal::UnwrapTraits::Unwrap(arg.a), - base::cef_internal::UnwrapTraits::Unwrap(arg.b), - base::cef_internal::UnwrapTraits::Unwrap(arg.c), - base::cef_internal::UnwrapTraits::Unwrap(arg.d), - base::cef_internal::UnwrapTraits::Unwrap(arg.e), - base::cef_internal::UnwrapTraits::Unwrap(arg.f)); -} - -template -inline void DispatchToFunction(Function function, - const Tuple7& arg) { - (*function)(base::cef_internal::UnwrapTraits::Unwrap(arg.a), - base::cef_internal::UnwrapTraits::Unwrap(arg.b), - base::cef_internal::UnwrapTraits::Unwrap(arg.c), - base::cef_internal::UnwrapTraits::Unwrap(arg.d), - base::cef_internal::UnwrapTraits::Unwrap(arg.e), - base::cef_internal::UnwrapTraits::Unwrap(arg.f), - base::cef_internal::UnwrapTraits::Unwrap(arg.g)); -} - -template -inline void DispatchToFunction(Function function, - const Tuple8& arg) { - (*function)(base::cef_internal::UnwrapTraits::Unwrap(arg.a), - base::cef_internal::UnwrapTraits::Unwrap(arg.b), - base::cef_internal::UnwrapTraits::Unwrap(arg.c), - base::cef_internal::UnwrapTraits::Unwrap(arg.d), - base::cef_internal::UnwrapTraits::Unwrap(arg.e), - base::cef_internal::UnwrapTraits::Unwrap(arg.f), - base::cef_internal::UnwrapTraits::Unwrap(arg.g), - base::cef_internal::UnwrapTraits::Unwrap(arg.h)); -} - -// Dispatchers with 0 out param (as a Tuple0). - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple0& arg, - Tuple0*) { - (obj->*method)(); -} - -template -inline void DispatchToMethod(ObjT* obj, Method method, const A& arg, Tuple0*) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(arg)); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple1& arg, - Tuple0*) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(arg.a)); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple2& arg, - Tuple0*) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(arg.a), - base::cef_internal::UnwrapTraits::Unwrap(arg.b)); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple3& arg, - Tuple0*) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(arg.a), - base::cef_internal::UnwrapTraits::Unwrap(arg.b), - base::cef_internal::UnwrapTraits::Unwrap(arg.c)); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple4& arg, - Tuple0*) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(arg.a), - base::cef_internal::UnwrapTraits::Unwrap(arg.b), - base::cef_internal::UnwrapTraits::Unwrap(arg.c), - base::cef_internal::UnwrapTraits::Unwrap(arg.d)); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple5& arg, - Tuple0*) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(arg.a), - base::cef_internal::UnwrapTraits::Unwrap(arg.b), - base::cef_internal::UnwrapTraits::Unwrap(arg.c), - base::cef_internal::UnwrapTraits::Unwrap(arg.d), - base::cef_internal::UnwrapTraits::Unwrap(arg.e)); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple6& arg, - Tuple0*) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(arg.a), - base::cef_internal::UnwrapTraits::Unwrap(arg.b), - base::cef_internal::UnwrapTraits::Unwrap(arg.c), - base::cef_internal::UnwrapTraits::Unwrap(arg.d), - base::cef_internal::UnwrapTraits::Unwrap(arg.e), - base::cef_internal::UnwrapTraits::Unwrap(arg.f)); -} - -// Dispatchers with 1 out param. - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple0& in, - Tuple1* out) { - (obj->*method)(&out->a); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const InA& in, - Tuple1* out) { - (obj->*method)(in, &out->a); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple1& in, - Tuple1* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), &out->a); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple2& in, - Tuple1* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), &out->a); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple3& in, - Tuple1* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), - base::cef_internal::UnwrapTraits::Unwrap(in.c), &out->a); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple4& in, - Tuple1* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), - base::cef_internal::UnwrapTraits::Unwrap(in.c), - base::cef_internal::UnwrapTraits::Unwrap(in.d), &out->a); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple5& in, - Tuple1* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), - base::cef_internal::UnwrapTraits::Unwrap(in.c), - base::cef_internal::UnwrapTraits::Unwrap(in.d), - base::cef_internal::UnwrapTraits::Unwrap(in.e), &out->a); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple6& in, - Tuple1* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), - base::cef_internal::UnwrapTraits::Unwrap(in.c), - base::cef_internal::UnwrapTraits::Unwrap(in.d), - base::cef_internal::UnwrapTraits::Unwrap(in.e), - base::cef_internal::UnwrapTraits::Unwrap(in.f), &out->a); -} - -// Dispatchers with 2 out params. - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple0& in, - Tuple2* out) { - (obj->*method)(&out->a, &out->b); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const InA& in, - Tuple2* out) { - (obj->*method)(in, &out->a, &out->b); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple1& in, - Tuple2* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), &out->a, - &out->b); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple2& in, - Tuple2* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), &out->a, - &out->b); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple3& in, - Tuple2* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), - base::cef_internal::UnwrapTraits::Unwrap(in.c), &out->a, - &out->b); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple4& in, - Tuple2* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), - base::cef_internal::UnwrapTraits::Unwrap(in.c), - base::cef_internal::UnwrapTraits::Unwrap(in.d), &out->a, - &out->b); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple5& in, - Tuple2* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), - base::cef_internal::UnwrapTraits::Unwrap(in.c), - base::cef_internal::UnwrapTraits::Unwrap(in.d), - base::cef_internal::UnwrapTraits::Unwrap(in.e), &out->a, - &out->b); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple6& in, - Tuple2* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), - base::cef_internal::UnwrapTraits::Unwrap(in.c), - base::cef_internal::UnwrapTraits::Unwrap(in.d), - base::cef_internal::UnwrapTraits::Unwrap(in.e), - base::cef_internal::UnwrapTraits::Unwrap(in.f), &out->a, - &out->b); -} - -// Dispatchers with 3 out params. - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple0& in, - Tuple3* out) { - (obj->*method)(&out->a, &out->b, &out->c); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const InA& in, - Tuple3* out) { - (obj->*method)(in, &out->a, &out->b, &out->c); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple1& in, - Tuple3* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), &out->a, - &out->b, &out->c); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple2& in, - Tuple3* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), &out->a, - &out->b, &out->c); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple3& in, - Tuple3* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), - base::cef_internal::UnwrapTraits::Unwrap(in.c), &out->a, - &out->b, &out->c); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple4& in, - Tuple3* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), - base::cef_internal::UnwrapTraits::Unwrap(in.c), - base::cef_internal::UnwrapTraits::Unwrap(in.d), &out->a, - &out->b, &out->c); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple5& in, - Tuple3* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), - base::cef_internal::UnwrapTraits::Unwrap(in.c), - base::cef_internal::UnwrapTraits::Unwrap(in.d), - base::cef_internal::UnwrapTraits::Unwrap(in.e), &out->a, - &out->b, &out->c); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple6& in, - Tuple3* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), - base::cef_internal::UnwrapTraits::Unwrap(in.c), - base::cef_internal::UnwrapTraits::Unwrap(in.d), - base::cef_internal::UnwrapTraits::Unwrap(in.e), - base::cef_internal::UnwrapTraits::Unwrap(in.f), &out->a, - &out->b, &out->c); -} - -// Dispatchers with 4 out params. - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple0& in, - Tuple4* out) { - (obj->*method)(&out->a, &out->b, &out->c, &out->d); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const InA& in, - Tuple4* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in), &out->a, - &out->b, &out->c, &out->d); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple1& in, - Tuple4* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), &out->a, - &out->b, &out->c, &out->d); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple2& in, - Tuple4* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), &out->a, - &out->b, &out->c, &out->d); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple3& in, - Tuple4* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), - base::cef_internal::UnwrapTraits::Unwrap(in.c), &out->a, - &out->b, &out->c, &out->d); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple4& in, - Tuple4* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), - base::cef_internal::UnwrapTraits::Unwrap(in.c), - base::cef_internal::UnwrapTraits::Unwrap(in.d), &out->a, - &out->b, &out->c, &out->d); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple5& in, - Tuple4* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), - base::cef_internal::UnwrapTraits::Unwrap(in.c), - base::cef_internal::UnwrapTraits::Unwrap(in.d), - base::cef_internal::UnwrapTraits::Unwrap(in.e), &out->a, - &out->b, &out->c, &out->d); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple6& in, - Tuple4* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), - base::cef_internal::UnwrapTraits::Unwrap(in.c), - base::cef_internal::UnwrapTraits::Unwrap(in.d), - base::cef_internal::UnwrapTraits::Unwrap(in.e), - base::cef_internal::UnwrapTraits::Unwrap(in.f), &out->a, - &out->b, &out->c, &out->d); -} - -// Dispatchers with 5 out params. - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple0& in, - Tuple5* out) { - (obj->*method)(&out->a, &out->b, &out->c, &out->d, &out->e); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const InA& in, - Tuple5* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in), &out->a, - &out->b, &out->c, &out->d, &out->e); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple1& in, - Tuple5* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), &out->a, - &out->b, &out->c, &out->d, &out->e); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple2& in, - Tuple5* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), &out->a, - &out->b, &out->c, &out->d, &out->e); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple3& in, - Tuple5* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), - base::cef_internal::UnwrapTraits::Unwrap(in.c), &out->a, - &out->b, &out->c, &out->d, &out->e); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple4& in, - Tuple5* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), - base::cef_internal::UnwrapTraits::Unwrap(in.c), - base::cef_internal::UnwrapTraits::Unwrap(in.d), &out->a, - &out->b, &out->c, &out->d, &out->e); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple5& in, - Tuple5* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), - base::cef_internal::UnwrapTraits::Unwrap(in.c), - base::cef_internal::UnwrapTraits::Unwrap(in.d), - base::cef_internal::UnwrapTraits::Unwrap(in.e), &out->a, - &out->b, &out->c, &out->d, &out->e); -} - -template -inline void DispatchToMethod(ObjT* obj, - Method method, - const Tuple6& in, - Tuple5* out) { - (obj->*method)(base::cef_internal::UnwrapTraits::Unwrap(in.a), - base::cef_internal::UnwrapTraits::Unwrap(in.b), - base::cef_internal::UnwrapTraits::Unwrap(in.c), - base::cef_internal::UnwrapTraits::Unwrap(in.d), - base::cef_internal::UnwrapTraits::Unwrap(in.e), - base::cef_internal::UnwrapTraits::Unwrap(in.f), &out->a, - &out->b, &out->c, &out->d, &out->e); -} - -} // namespace base - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_TUPLE_H_ diff --git a/third_party/cef/include/base/cef_weak_ptr.h b/third_party/cef/include/base/cef_weak_ptr.h deleted file mode 100644 index 1ba34b9d..00000000 --- a/third_party/cef/include/base/cef_weak_ptr.h +++ /dev/null @@ -1,385 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012 -// Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Weak pointers are pointers to an object that do not affect its lifetime, -// and which may be invalidated (i.e. reset to NULL) by the object, or its -// owner, at any time, most commonly when the object is about to be deleted. - -// Weak pointers are useful when an object needs to be accessed safely by one -// or more objects other than its owner, and those callers can cope with the -// object vanishing and e.g. tasks posted to it being silently dropped. -// Reference-counting such an object would complicate the ownership graph and -// make it harder to reason about the object's lifetime. - -// EXAMPLE: -// -// class Controller { -// public: -// Controller() : weak_factory_(this) {} -// void SpawnWorker() { Worker::StartNew(weak_factory_.GetWeakPtr()); } -// void WorkComplete(const Result& result) { ... } -// private: -// // Member variables should appear before the WeakPtrFactory, to ensure -// // that any WeakPtrs to Controller are invalidated before its members -// // variable's destructors are executed, rendering them invalid. -// WeakPtrFactory weak_factory_; -// }; -// -// class Worker { -// public: -// static void StartNew(const WeakPtr& controller) { -// Worker* worker = new Worker(controller); -// // Kick off asynchronous processing... -// } -// private: -// Worker(const WeakPtr& controller) -// : controller_(controller) {} -// void DidCompleteAsynchronousProcessing(const Result& result) { -// if (controller_) -// controller_->WorkComplete(result); -// } -// WeakPtr controller_; -// }; -// -// With this implementation a caller may use SpawnWorker() to dispatch multiple -// Workers and subsequently delete the Controller, without waiting for all -// Workers to have completed. - -// ------------------------- IMPORTANT: Thread-safety ------------------------- - -// Weak pointers may be passed safely between threads, but must always be -// dereferenced and invalidated on the same thread otherwise checking the -// pointer would be racey. -// -// To ensure correct use, the first time a WeakPtr issued by a WeakPtrFactory -// is dereferenced, the factory and its WeakPtrs become bound to the calling -// thread, and cannot be dereferenced or invalidated on any other thread. Bound -// WeakPtrs can still be handed off to other threads, e.g. to use to post tasks -// back to object on the bound thread. -// -// If all WeakPtr objects are destroyed or invalidated then the factory is -// unbound from the SequencedTaskRunner/Thread. The WeakPtrFactory may then be -// destroyed, or new WeakPtr objects may be used, from a different sequence. -// -// Thus, at least one WeakPtr object must exist and have been dereferenced on -// the correct thread to enforce that other WeakPtr objects will enforce they -// are used on the desired thread. - -#ifndef CEF_INCLUDE_BASE_CEF_WEAK_PTR_H_ -#define CEF_INCLUDE_BASE_CEF_WEAK_PTR_H_ -#pragma once - -#if defined(BASE_MEMORY_WEAK_PTR_H_) -// Do nothing if the Chromium header has already been included. -// This can happen in cases where Chromium code is used directly by the -// client application. When using Chromium code directly always include -// the Chromium header first to avoid type conflicts. -#elif defined(USING_CHROMIUM_INCLUDES) -// When building CEF include the Chromium header directly. -#include "base/memory/weak_ptr.h" -#else // !USING_CHROMIUM_INCLUDES -// The following is substantially similar to the Chromium implementation. -// If the Chromium implementation diverges the below implementation should be -// updated to match. - -#include "include/base/cef_basictypes.h" -#include "include/base/cef_logging.h" -#include "include/base/cef_ref_counted.h" -#include "include/base/cef_template_util.h" -#include "include/base/cef_thread_checker.h" - -namespace base { - -template -class SupportsWeakPtr; -template -class WeakPtr; - -namespace cef_internal { -// These classes are part of the WeakPtr implementation. -// DO NOT USE THESE CLASSES DIRECTLY YOURSELF. - -class WeakReference { - public: - // Although Flag is bound to a specific thread, it may be deleted from another - // via base::WeakPtr::~WeakPtr(). - class Flag : public RefCountedThreadSafe { - public: - Flag(); - - void Invalidate(); - bool IsValid() const; - - private: - friend class base::RefCountedThreadSafe; - - ~Flag(); - - // The current Chromium implementation uses SequenceChecker instead of - // ThreadChecker to support SequencedWorkerPools. CEF does not yet expose - // the concept of SequencedWorkerPools. - ThreadChecker thread_checker_; - bool is_valid_; - }; - - WeakReference(); - explicit WeakReference(const Flag* flag); - ~WeakReference(); - - bool is_valid() const; - - private: - scoped_refptr flag_; -}; - -class WeakReferenceOwner { - public: - WeakReferenceOwner(); - ~WeakReferenceOwner(); - - WeakReference GetRef() const; - - bool HasRefs() const { return flag_.get() && !flag_->HasOneRef(); } - - void Invalidate(); - - private: - mutable scoped_refptr flag_; -}; - -// This class simplifies the implementation of WeakPtr's type conversion -// constructor by avoiding the need for a public accessor for ref_. A -// WeakPtr cannot access the private members of WeakPtr, so this -// base class gives us a way to access ref_ in a protected fashion. -class WeakPtrBase { - public: - WeakPtrBase(); - ~WeakPtrBase(); - - protected: - explicit WeakPtrBase(const WeakReference& ref); - - WeakReference ref_; -}; - -// This class provides a common implementation of common functions that would -// otherwise get instantiated separately for each distinct instantiation of -// SupportsWeakPtr<>. -class SupportsWeakPtrBase { - public: - // A safe static downcast of a WeakPtr to WeakPtr. This - // conversion will only compile if there is exists a Base which inherits - // from SupportsWeakPtr. See base::AsWeakPtr() below for a helper - // function that makes calling this easier. - template - static WeakPtr StaticAsWeakPtr(Derived* t) { - typedef is_convertible - convertible; - COMPILE_ASSERT(convertible::value, - AsWeakPtr_argument_inherits_from_SupportsWeakPtr); - return AsWeakPtrImpl(t, *t); - } - - private: - // This template function uses type inference to find a Base of Derived - // which is an instance of SupportsWeakPtr. We can then safely - // static_cast the Base* to a Derived*. - template - static WeakPtr AsWeakPtrImpl(Derived* t, - const SupportsWeakPtr&) { - WeakPtr ptr = t->Base::AsWeakPtr(); - return WeakPtr(ptr.ref_, static_cast(ptr.ptr_)); - } -}; - -} // namespace cef_internal - -template -class WeakPtrFactory; - -// The WeakPtr class holds a weak reference to |T*|. -// -// This class is designed to be used like a normal pointer. You should always -// null-test an object of this class before using it or invoking a method that -// may result in the underlying object being destroyed. -// -// EXAMPLE: -// -// class Foo { ... }; -// WeakPtr foo; -// if (foo) -// foo->method(); -// -template -class WeakPtr : public cef_internal::WeakPtrBase { - public: - WeakPtr() : ptr_(NULL) {} - - // Allow conversion from U to T provided U "is a" T. Note that this - // is separate from the (implicit) copy constructor. - template - WeakPtr(const WeakPtr& other) : WeakPtrBase(other), ptr_(other.ptr_) {} - - T* get() const { return ref_.is_valid() ? ptr_ : NULL; } - - T& operator*() const { - DCHECK(get() != NULL); - return *get(); - } - T* operator->() const { - DCHECK(get() != NULL); - return get(); - } - - // Allow WeakPtr to be used in boolean expressions, but not - // implicitly convertible to a real bool (which is dangerous). - // - // Note that this trick is only safe when the == and != operators - // are declared explicitly, as otherwise "weak_ptr1 == weak_ptr2" - // will compile but do the wrong thing (i.e., convert to Testable - // and then do the comparison). - private: - typedef T* WeakPtr::*Testable; - - public: - operator Testable() const { return get() ? &WeakPtr::ptr_ : NULL; } - - void reset() { - ref_ = cef_internal::WeakReference(); - ptr_ = NULL; - } - - private: - // Explicitly declare comparison operators as required by the bool - // trick, but keep them private. - template - bool operator==(WeakPtr const&) const; - template - bool operator!=(WeakPtr const&) const; - - friend class cef_internal::SupportsWeakPtrBase; - template - friend class WeakPtr; - friend class SupportsWeakPtr; - friend class WeakPtrFactory; - - WeakPtr(const cef_internal::WeakReference& ref, T* ptr) - : WeakPtrBase(ref), ptr_(ptr) {} - - // This pointer is only valid when ref_.is_valid() is true. Otherwise, its - // value is undefined (as opposed to NULL). - T* ptr_; -}; - -// A class may be composed of a WeakPtrFactory and thereby -// control how it exposes weak pointers to itself. This is helpful if you only -// need weak pointers within the implementation of a class. This class is also -// useful when working with primitive types. For example, you could have a -// WeakPtrFactory that is used to pass around a weak reference to a bool. -template -class WeakPtrFactory { - public: - explicit WeakPtrFactory(T* ptr) : ptr_(ptr) {} - - ~WeakPtrFactory() { ptr_ = NULL; } - - WeakPtr GetWeakPtr() { - DCHECK(ptr_); - return WeakPtr(weak_reference_owner_.GetRef(), ptr_); - } - - // Call this method to invalidate all existing weak pointers. - void InvalidateWeakPtrs() { - DCHECK(ptr_); - weak_reference_owner_.Invalidate(); - } - - // Call this method to determine if any weak pointers exist. - bool HasWeakPtrs() const { - DCHECK(ptr_); - return weak_reference_owner_.HasRefs(); - } - - private: - cef_internal::WeakReferenceOwner weak_reference_owner_; - T* ptr_; - DISALLOW_IMPLICIT_CONSTRUCTORS(WeakPtrFactory); -}; - -// A class may extend from SupportsWeakPtr to let others take weak pointers to -// it. This avoids the class itself implementing boilerplate to dispense weak -// pointers. However, since SupportsWeakPtr's destructor won't invalidate -// weak pointers to the class until after the derived class' members have been -// destroyed, its use can lead to subtle use-after-destroy issues. -template -class SupportsWeakPtr : public cef_internal::SupportsWeakPtrBase { - public: - SupportsWeakPtr() {} - - WeakPtr AsWeakPtr() { - return WeakPtr(weak_reference_owner_.GetRef(), static_cast(this)); - } - - protected: - ~SupportsWeakPtr() {} - - private: - cef_internal::WeakReferenceOwner weak_reference_owner_; - DISALLOW_COPY_AND_ASSIGN(SupportsWeakPtr); -}; - -// Helper function that uses type deduction to safely return a WeakPtr -// when Derived doesn't directly extend SupportsWeakPtr, instead it -// extends a Base that extends SupportsWeakPtr. -// -// EXAMPLE: -// class Base : public base::SupportsWeakPtr {}; -// class Derived : public Base {}; -// -// Derived derived; -// base::WeakPtr ptr = base::AsWeakPtr(&derived); -// -// Note that the following doesn't work (invalid type conversion) since -// Derived::AsWeakPtr() is WeakPtr SupportsWeakPtr::AsWeakPtr(), -// and there's no way to safely cast WeakPtr to WeakPtr at -// the caller. -// -// base::WeakPtr ptr = derived.AsWeakPtr(); // Fails. - -template -WeakPtr AsWeakPtr(Derived* t) { - return cef_internal::SupportsWeakPtrBase::StaticAsWeakPtr(t); -} - -} // namespace base - -#endif // !USING_CHROMIUM_INCLUDES - -#endif // CEF_INCLUDE_BASE_CEF_WEAK_PTR_H_ diff --git a/third_party/cef/include/base/internal/cef_atomicops_x86_msvc.h b/third_party/cef/include/base/internal/cef_atomicops_x86_msvc.h deleted file mode 100644 index a262c81f..00000000 --- a/third_party/cef/include/base/internal/cef_atomicops_x86_msvc.h +++ /dev/null @@ -1,221 +0,0 @@ -// Copyright (c) 2008 Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Do not include this header file directly. Use base/cef_atomicops.h -// instead. - -#ifndef CEF_INCLUDE_BASE_INTERNAL_CEF_ATOMICOPS_X86_MSVC_H_ -#define CEF_INCLUDE_BASE_INTERNAL_CEF_ATOMICOPS_X86_MSVC_H_ - -#include - -#include - -#include "include/base/cef_macros.h" - -#if defined(ARCH_CPU_64_BITS) -// windows.h #defines this (only on x64). This causes problems because the -// public API also uses MemoryBarrier at the public name for this fence. So, on -// X64, undef it, and call its documented -// (http://msdn.microsoft.com/en-us/library/windows/desktop/ms684208.aspx) -// implementation directly. -#undef MemoryBarrier -#endif - -namespace base { -namespace subtle { - -inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value) { - LONG result = _InterlockedCompareExchange( - reinterpret_cast(ptr), static_cast(new_value), - static_cast(old_value)); - return static_cast(result); -} - -inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr, - Atomic32 new_value) { - LONG result = _InterlockedExchange(reinterpret_cast(ptr), - static_cast(new_value)); - return static_cast(result); -} - -inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr, - Atomic32 increment) { - return _InterlockedExchangeAdd(reinterpret_cast(ptr), - static_cast(increment)) + - increment; -} - -inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr, - Atomic32 increment) { - return Barrier_AtomicIncrement(ptr, increment); -} - -#if !(defined(_MSC_VER) && _MSC_VER >= 1400) -#error "We require at least vs2005 for MemoryBarrier" -#endif -inline void MemoryBarrier() { -#if defined(ARCH_CPU_64_BITS) - // See #undef and note at the top of this file. - __faststorefence(); -#else - // We use MemoryBarrier from WinNT.h - ::MemoryBarrier(); -#endif -} - -inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value) { - return NoBarrier_CompareAndSwap(ptr, old_value, new_value); -} - -inline Atomic32 Release_CompareAndSwap(volatile Atomic32* ptr, - Atomic32 old_value, - Atomic32 new_value) { - return NoBarrier_CompareAndSwap(ptr, old_value, new_value); -} - -inline void NoBarrier_Store(volatile Atomic32* ptr, Atomic32 value) { - *ptr = value; -} - -inline void Acquire_Store(volatile Atomic32* ptr, Atomic32 value) { - NoBarrier_AtomicExchange(ptr, value); - // acts as a barrier in this implementation -} - -inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) { - *ptr = value; // works w/o barrier for current Intel chips as of June 2005 - // See comments in Atomic64 version of Release_Store() below. -} - -inline Atomic32 NoBarrier_Load(volatile const Atomic32* ptr) { - return *ptr; -} - -inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) { - Atomic32 value = *ptr; - return value; -} - -inline Atomic32 Release_Load(volatile const Atomic32* ptr) { - MemoryBarrier(); - return *ptr; -} - -#if defined(_WIN64) - -// 64-bit low-level operations on 64-bit platform. - -COMPILE_ASSERT(sizeof(Atomic64) == sizeof(PVOID), atomic_word_is_atomic); - -inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr, - Atomic64 old_value, - Atomic64 new_value) { - PVOID result = InterlockedCompareExchangePointer( - reinterpret_cast(ptr), - reinterpret_cast(new_value), reinterpret_cast(old_value)); - return reinterpret_cast(result); -} - -inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr, - Atomic64 new_value) { - PVOID result = - InterlockedExchangePointer(reinterpret_cast(ptr), - reinterpret_cast(new_value)); - return reinterpret_cast(result); -} - -inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr, - Atomic64 increment) { - return InterlockedExchangeAdd64(reinterpret_cast(ptr), - static_cast(increment)) + - increment; -} - -inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr, - Atomic64 increment) { - return Barrier_AtomicIncrement(ptr, increment); -} - -inline void NoBarrier_Store(volatile Atomic64* ptr, Atomic64 value) { - *ptr = value; -} - -inline void Acquire_Store(volatile Atomic64* ptr, Atomic64 value) { - NoBarrier_AtomicExchange(ptr, value); - // acts as a barrier in this implementation -} - -inline void Release_Store(volatile Atomic64* ptr, Atomic64 value) { - *ptr = value; // works w/o barrier for current Intel chips as of June 2005 - - // When new chips come out, check: - // IA-32 Intel Architecture Software Developer's Manual, Volume 3: - // System Programming Guide, Chatper 7: Multiple-processor management, - // Section 7.2, Memory Ordering. - // Last seen at: - // http://developer.intel.com/design/pentium4/manuals/index_new.htm -} - -inline Atomic64 NoBarrier_Load(volatile const Atomic64* ptr) { - return *ptr; -} - -inline Atomic64 Acquire_Load(volatile const Atomic64* ptr) { - Atomic64 value = *ptr; - return value; -} - -inline Atomic64 Release_Load(volatile const Atomic64* ptr) { - MemoryBarrier(); - return *ptr; -} - -inline Atomic64 Acquire_CompareAndSwap(volatile Atomic64* ptr, - Atomic64 old_value, - Atomic64 new_value) { - return NoBarrier_CompareAndSwap(ptr, old_value, new_value); -} - -inline Atomic64 Release_CompareAndSwap(volatile Atomic64* ptr, - Atomic64 old_value, - Atomic64 new_value) { - return NoBarrier_CompareAndSwap(ptr, old_value, new_value); -} - -#endif // defined(_WIN64) - -} // namespace base::subtle -} // namespace base - -#endif // CEF_INCLUDE_BASE_INTERNAL_CEF_ATOMICOPS_X86_MSVC_H_ diff --git a/third_party/cef/include/base/internal/cef_bind_internal.h b/third_party/cef/include/base/internal/cef_bind_internal.h deleted file mode 100644 index 64eeb3f3..00000000 --- a/third_party/cef/include/base/internal/cef_bind_internal.h +++ /dev/null @@ -1,3190 +0,0 @@ -// Copyright (c) 2011 Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Do not include this header file directly. Use base/cef_bind.h instead. - -#ifndef CEF_INCLUDE_BASE_INTERNAL_CEF_BIND_INTERNAL_H_ -#define CEF_INCLUDE_BASE_INTERNAL_CEF_BIND_INTERNAL_H_ - -#include "include/base/cef_bind_helpers.h" -#include "include/base/cef_build.h" -#include "include/base/cef_template_util.h" -#include "include/base/cef_weak_ptr.h" -#include "include/base/internal/cef_callback_internal.h" -#include "include/base/internal/cef_raw_scoped_refptr_mismatch_checker.h" - -#if defined(OS_WIN) -#include "include/base/internal/cef_bind_internal_win.h" -#endif - -namespace base { -namespace cef_internal { - -// See base/callback.h for user documentation. -// -// -// CONCEPTS: -// Runnable -- A type (really a type class) that has a single Run() method -// and a RunType typedef that corresponds to the type of Run(). -// A Runnable can declare that it should treated like a method -// call by including a typedef named IsMethod. The value of -// this typedef is NOT inspected, only the existence. When a -// Runnable declares itself a method, Bind() will enforce special -// refcounting + WeakPtr handling semantics for the first -// parameter which is expected to be an object. -// Functor -- A copyable type representing something that should be called. -// All function pointers, Callback<>, and Runnables are functors -// even if the invocation syntax differs. -// RunType -- A function type (as opposed to function _pointer_ type) for -// a Run() function. Usually just a convenience typedef. -// (Bound)ArgsType -- A function type that is being (ab)used to store the -// types of set of arguments. The "return" type is always -// void here. We use this hack so that we do not need -// a new type name for each arity of type. (eg., -// BindState1, BindState2). This makes forward -// declarations and friending much much easier. -// -// Types: -// RunnableAdapter<> -- Wraps the various "function" pointer types into an -// object that adheres to the Runnable interface. -// There are |3*ARITY| RunnableAdapter types. -// FunctionTraits<> -- Type traits that unwrap a function signature into a -// a set of easier to use typedefs. Used mainly for -// compile time asserts. -// There are |ARITY| FunctionTraits types. -// ForceVoidReturn<> -- Helper class for translating function signatures to -// equivalent forms with a "void" return type. -// There are |ARITY| ForceVoidReturn types. -// FunctorTraits<> -- Type traits used determine the correct RunType and -// RunnableType for a Functor. This is where function -// signature adapters are applied. -// There are |ARITY| ForceVoidReturn types. -// MakeRunnable<> -- Takes a Functor and returns an object in the Runnable -// type class that represents the underlying Functor. -// There are |O(1)| MakeRunnable types. -// InvokeHelper<> -- Take a Runnable + arguments and actully invokes it. -// Handle the differing syntaxes needed for WeakPtr<> support, -// and for ignoring return values. This is separate from -// Invoker to avoid creating multiple version of Invoker<> -// which grows at O(n^2) with the arity. -// There are |k*ARITY| InvokeHelper types. -// Invoker<> -- Unwraps the curried parameters and executes the Runnable. -// There are |(ARITY^2 + ARITY)/2| Invoketypes. -// BindState<> -- Stores the curried parameters, and is the main entry point -// into the Bind() system, doing most of the type resolution. -// There are ARITY BindState types. - -// RunnableAdapter<> -// -// The RunnableAdapter<> templates provide a uniform interface for invoking -// a function pointer, method pointer, or const method pointer. The adapter -// exposes a Run() method with an appropriate signature. Using this wrapper -// allows for writing code that supports all three pointer types without -// undue repetition. Without it, a lot of code would need to be repeated 3 -// times. -// -// For method pointers and const method pointers the first argument to Run() -// is considered to be the received of the method. This is similar to STL's -// mem_fun(). -// -// This class also exposes a RunType typedef that is the function type of the -// Run() function. -// -// If and only if the wrapper contains a method or const method pointer, an -// IsMethod typedef is exposed. The existence of this typedef (NOT the value) -// marks that the wrapper should be considered a method wrapper. - -template -class RunnableAdapter; - -// Function: Arity 0. -template -class RunnableAdapter { - public: - typedef R(RunType)(); - - explicit RunnableAdapter(R (*function)()) : function_(function) {} - - R Run() { return function_(); } - - private: - R (*function_)(); -}; - -// Method: Arity 0. -template -class RunnableAdapter { - public: - typedef R(RunType)(T*); - typedef true_type IsMethod; - - explicit RunnableAdapter(R (T::*method)()) : method_(method) {} - - R Run(T* object) { return (object->*method_)(); } - - private: - R (T::*method_)(); -}; - -// Const Method: Arity 0. -template -class RunnableAdapter { - public: - typedef R(RunType)(const T*); - typedef true_type IsMethod; - - explicit RunnableAdapter(R (T::*method)() const) : method_(method) {} - - R Run(const T* object) { return (object->*method_)(); } - - private: - R (T::*method_)() const; -}; - -// Function: Arity 1. -template -class RunnableAdapter { - public: - typedef R(RunType)(A1); - - explicit RunnableAdapter(R (*function)(A1)) : function_(function) {} - - R Run(typename CallbackParamTraits::ForwardType a1) { - return function_(CallbackForward(a1)); - } - - private: - R (*function_)(A1); -}; - -// Method: Arity 1. -template -class RunnableAdapter { - public: - typedef R(RunType)(T*, A1); - typedef true_type IsMethod; - - explicit RunnableAdapter(R (T::*method)(A1)) : method_(method) {} - - R Run(T* object, typename CallbackParamTraits::ForwardType a1) { - return (object->*method_)(CallbackForward(a1)); - } - - private: - R (T::*method_)(A1); -}; - -// Const Method: Arity 1. -template -class RunnableAdapter { - public: - typedef R(RunType)(const T*, A1); - typedef true_type IsMethod; - - explicit RunnableAdapter(R (T::*method)(A1) const) : method_(method) {} - - R Run(const T* object, typename CallbackParamTraits::ForwardType a1) { - return (object->*method_)(CallbackForward(a1)); - } - - private: - R (T::*method_)(A1) const; -}; - -// Function: Arity 2. -template -class RunnableAdapter { - public: - typedef R(RunType)(A1, A2); - - explicit RunnableAdapter(R (*function)(A1, A2)) : function_(function) {} - - R Run(typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2) { - return function_(CallbackForward(a1), CallbackForward(a2)); - } - - private: - R (*function_)(A1, A2); -}; - -// Method: Arity 2. -template -class RunnableAdapter { - public: - typedef R(RunType)(T*, A1, A2); - typedef true_type IsMethod; - - explicit RunnableAdapter(R (T::*method)(A1, A2)) : method_(method) {} - - R Run(T* object, - typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2) { - return (object->*method_)(CallbackForward(a1), CallbackForward(a2)); - } - - private: - R (T::*method_)(A1, A2); -}; - -// Const Method: Arity 2. -template -class RunnableAdapter { - public: - typedef R(RunType)(const T*, A1, A2); - typedef true_type IsMethod; - - explicit RunnableAdapter(R (T::*method)(A1, A2) const) : method_(method) {} - - R Run(const T* object, - typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2) { - return (object->*method_)(CallbackForward(a1), CallbackForward(a2)); - } - - private: - R (T::*method_)(A1, A2) const; -}; - -// Function: Arity 3. -template -class RunnableAdapter { - public: - typedef R(RunType)(A1, A2, A3); - - explicit RunnableAdapter(R (*function)(A1, A2, A3)) : function_(function) {} - - R Run(typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3) { - return function_(CallbackForward(a1), CallbackForward(a2), - CallbackForward(a3)); - } - - private: - R (*function_)(A1, A2, A3); -}; - -// Method: Arity 3. -template -class RunnableAdapter { - public: - typedef R(RunType)(T*, A1, A2, A3); - typedef true_type IsMethod; - - explicit RunnableAdapter(R (T::*method)(A1, A2, A3)) : method_(method) {} - - R Run(T* object, - typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3) { - return (object->*method_)(CallbackForward(a1), CallbackForward(a2), - CallbackForward(a3)); - } - - private: - R (T::*method_)(A1, A2, A3); -}; - -// Const Method: Arity 3. -template -class RunnableAdapter { - public: - typedef R(RunType)(const T*, A1, A2, A3); - typedef true_type IsMethod; - - explicit RunnableAdapter(R (T::*method)(A1, A2, A3) const) - : method_(method) {} - - R Run(const T* object, - typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3) { - return (object->*method_)(CallbackForward(a1), CallbackForward(a2), - CallbackForward(a3)); - } - - private: - R (T::*method_)(A1, A2, A3) const; -}; - -// Function: Arity 4. -template -class RunnableAdapter { - public: - typedef R(RunType)(A1, A2, A3, A4); - - explicit RunnableAdapter(R (*function)(A1, A2, A3, A4)) - : function_(function) {} - - R Run(typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3, - typename CallbackParamTraits::ForwardType a4) { - return function_(CallbackForward(a1), CallbackForward(a2), - CallbackForward(a3), CallbackForward(a4)); - } - - private: - R (*function_)(A1, A2, A3, A4); -}; - -// Method: Arity 4. -template -class RunnableAdapter { - public: - typedef R(RunType)(T*, A1, A2, A3, A4); - typedef true_type IsMethod; - - explicit RunnableAdapter(R (T::*method)(A1, A2, A3, A4)) : method_(method) {} - - R Run(T* object, - typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3, - typename CallbackParamTraits::ForwardType a4) { - return (object->*method_)(CallbackForward(a1), CallbackForward(a2), - CallbackForward(a3), CallbackForward(a4)); - } - - private: - R (T::*method_)(A1, A2, A3, A4); -}; - -// Const Method: Arity 4. -template -class RunnableAdapter { - public: - typedef R(RunType)(const T*, A1, A2, A3, A4); - typedef true_type IsMethod; - - explicit RunnableAdapter(R (T::*method)(A1, A2, A3, A4) const) - : method_(method) {} - - R Run(const T* object, - typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3, - typename CallbackParamTraits::ForwardType a4) { - return (object->*method_)(CallbackForward(a1), CallbackForward(a2), - CallbackForward(a3), CallbackForward(a4)); - } - - private: - R (T::*method_)(A1, A2, A3, A4) const; -}; - -// Function: Arity 5. -template -class RunnableAdapter { - public: - typedef R(RunType)(A1, A2, A3, A4, A5); - - explicit RunnableAdapter(R (*function)(A1, A2, A3, A4, A5)) - : function_(function) {} - - R Run(typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3, - typename CallbackParamTraits::ForwardType a4, - typename CallbackParamTraits::ForwardType a5) { - return function_(CallbackForward(a1), CallbackForward(a2), - CallbackForward(a3), CallbackForward(a4), - CallbackForward(a5)); - } - - private: - R (*function_)(A1, A2, A3, A4, A5); -}; - -// Method: Arity 5. -template -class RunnableAdapter { - public: - typedef R(RunType)(T*, A1, A2, A3, A4, A5); - typedef true_type IsMethod; - - explicit RunnableAdapter(R (T::*method)(A1, A2, A3, A4, A5)) - : method_(method) {} - - R Run(T* object, - typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3, - typename CallbackParamTraits::ForwardType a4, - typename CallbackParamTraits::ForwardType a5) { - return (object->*method_)(CallbackForward(a1), CallbackForward(a2), - CallbackForward(a3), CallbackForward(a4), - CallbackForward(a5)); - } - - private: - R (T::*method_)(A1, A2, A3, A4, A5); -}; - -// Const Method: Arity 5. -template -class RunnableAdapter { - public: - typedef R(RunType)(const T*, A1, A2, A3, A4, A5); - typedef true_type IsMethod; - - explicit RunnableAdapter(R (T::*method)(A1, A2, A3, A4, A5) const) - : method_(method) {} - - R Run(const T* object, - typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3, - typename CallbackParamTraits::ForwardType a4, - typename CallbackParamTraits::ForwardType a5) { - return (object->*method_)(CallbackForward(a1), CallbackForward(a2), - CallbackForward(a3), CallbackForward(a4), - CallbackForward(a5)); - } - - private: - R (T::*method_)(A1, A2, A3, A4, A5) const; -}; - -// Function: Arity 6. -template -class RunnableAdapter { - public: - typedef R(RunType)(A1, A2, A3, A4, A5, A6); - - explicit RunnableAdapter(R (*function)(A1, A2, A3, A4, A5, A6)) - : function_(function) {} - - R Run(typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3, - typename CallbackParamTraits::ForwardType a4, - typename CallbackParamTraits::ForwardType a5, - typename CallbackParamTraits::ForwardType a6) { - return function_(CallbackForward(a1), CallbackForward(a2), - CallbackForward(a3), CallbackForward(a4), - CallbackForward(a5), CallbackForward(a6)); - } - - private: - R (*function_)(A1, A2, A3, A4, A5, A6); -}; - -// Method: Arity 6. -template -class RunnableAdapter { - public: - typedef R(RunType)(T*, A1, A2, A3, A4, A5, A6); - typedef true_type IsMethod; - - explicit RunnableAdapter(R (T::*method)(A1, A2, A3, A4, A5, A6)) - : method_(method) {} - - R Run(T* object, - typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3, - typename CallbackParamTraits::ForwardType a4, - typename CallbackParamTraits::ForwardType a5, - typename CallbackParamTraits::ForwardType a6) { - return (object->*method_)(CallbackForward(a1), CallbackForward(a2), - CallbackForward(a3), CallbackForward(a4), - CallbackForward(a5), CallbackForward(a6)); - } - - private: - R (T::*method_)(A1, A2, A3, A4, A5, A6); -}; - -// Const Method: Arity 6. -template -class RunnableAdapter { - public: - typedef R(RunType)(const T*, A1, A2, A3, A4, A5, A6); - typedef true_type IsMethod; - - explicit RunnableAdapter(R (T::*method)(A1, A2, A3, A4, A5, A6) const) - : method_(method) {} - - R Run(const T* object, - typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3, - typename CallbackParamTraits::ForwardType a4, - typename CallbackParamTraits::ForwardType a5, - typename CallbackParamTraits::ForwardType a6) { - return (object->*method_)(CallbackForward(a1), CallbackForward(a2), - CallbackForward(a3), CallbackForward(a4), - CallbackForward(a5), CallbackForward(a6)); - } - - private: - R (T::*method_)(A1, A2, A3, A4, A5, A6) const; -}; - -// Function: Arity 7. -template -class RunnableAdapter { - public: - typedef R(RunType)(A1, A2, A3, A4, A5, A6, A7); - - explicit RunnableAdapter(R (*function)(A1, A2, A3, A4, A5, A6, A7)) - : function_(function) {} - - R Run(typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3, - typename CallbackParamTraits::ForwardType a4, - typename CallbackParamTraits::ForwardType a5, - typename CallbackParamTraits::ForwardType a6, - typename CallbackParamTraits::ForwardType a7) { - return function_(CallbackForward(a1), CallbackForward(a2), - CallbackForward(a3), CallbackForward(a4), - CallbackForward(a5), CallbackForward(a6), - CallbackForward(a7)); - } - - private: - R (*function_)(A1, A2, A3, A4, A5, A6, A7); -}; - -// Method: Arity 7. -template -class RunnableAdapter { - public: - typedef R(RunType)(T*, A1, A2, A3, A4, A5, A6, A7); - typedef true_type IsMethod; - - explicit RunnableAdapter(R (T::*method)(A1, A2, A3, A4, A5, A6, A7)) - : method_(method) {} - - R Run(T* object, - typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3, - typename CallbackParamTraits::ForwardType a4, - typename CallbackParamTraits::ForwardType a5, - typename CallbackParamTraits::ForwardType a6, - typename CallbackParamTraits::ForwardType a7) { - return (object->*method_)(CallbackForward(a1), CallbackForward(a2), - CallbackForward(a3), CallbackForward(a4), - CallbackForward(a5), CallbackForward(a6), - CallbackForward(a7)); - } - - private: - R (T::*method_)(A1, A2, A3, A4, A5, A6, A7); -}; - -// Const Method: Arity 7. -template -class RunnableAdapter { - public: - typedef R(RunType)(const T*, A1, A2, A3, A4, A5, A6, A7); - typedef true_type IsMethod; - - explicit RunnableAdapter(R (T::*method)(A1, A2, A3, A4, A5, A6, A7) const) - : method_(method) {} - - R Run(const T* object, - typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3, - typename CallbackParamTraits::ForwardType a4, - typename CallbackParamTraits::ForwardType a5, - typename CallbackParamTraits::ForwardType a6, - typename CallbackParamTraits::ForwardType a7) { - return (object->*method_)(CallbackForward(a1), CallbackForward(a2), - CallbackForward(a3), CallbackForward(a4), - CallbackForward(a5), CallbackForward(a6), - CallbackForward(a7)); - } - - private: - R (T::*method_)(A1, A2, A3, A4, A5, A6, A7) const; -}; - -// FunctionTraits<> -// -// Breaks a function signature apart into typedefs for easier introspection. -template -struct FunctionTraits; - -template -struct FunctionTraits { - typedef R ReturnType; -}; - -template -struct FunctionTraits { - typedef R ReturnType; - typedef A1 A1Type; -}; - -template -struct FunctionTraits { - typedef R ReturnType; - typedef A1 A1Type; - typedef A2 A2Type; -}; - -template -struct FunctionTraits { - typedef R ReturnType; - typedef A1 A1Type; - typedef A2 A2Type; - typedef A3 A3Type; -}; - -template -struct FunctionTraits { - typedef R ReturnType; - typedef A1 A1Type; - typedef A2 A2Type; - typedef A3 A3Type; - typedef A4 A4Type; -}; - -template -struct FunctionTraits { - typedef R ReturnType; - typedef A1 A1Type; - typedef A2 A2Type; - typedef A3 A3Type; - typedef A4 A4Type; - typedef A5 A5Type; -}; - -template -struct FunctionTraits { - typedef R ReturnType; - typedef A1 A1Type; - typedef A2 A2Type; - typedef A3 A3Type; - typedef A4 A4Type; - typedef A5 A5Type; - typedef A6 A6Type; -}; - -template -struct FunctionTraits { - typedef R ReturnType; - typedef A1 A1Type; - typedef A2 A2Type; - typedef A3 A3Type; - typedef A4 A4Type; - typedef A5 A5Type; - typedef A6 A6Type; - typedef A7 A7Type; -}; - -// ForceVoidReturn<> -// -// Set of templates that support forcing the function return type to void. -template -struct ForceVoidReturn; - -template -struct ForceVoidReturn { - typedef void(RunType)(); -}; - -template -struct ForceVoidReturn { - typedef void(RunType)(A1); -}; - -template -struct ForceVoidReturn { - typedef void(RunType)(A1, A2); -}; - -template -struct ForceVoidReturn { - typedef void(RunType)(A1, A2, A3); -}; - -template -struct ForceVoidReturn { - typedef void(RunType)(A1, A2, A3, A4); -}; - -template -struct ForceVoidReturn { - typedef void(RunType)(A1, A2, A3, A4, A5); -}; - -template -struct ForceVoidReturn { - typedef void(RunType)(A1, A2, A3, A4, A5, A6); -}; - -template -struct ForceVoidReturn { - typedef void(RunType)(A1, A2, A3, A4, A5, A6, A7); -}; - -// FunctorTraits<> -// -// See description at top of file. -template -struct FunctorTraits { - typedef RunnableAdapter RunnableType; - typedef typename RunnableType::RunType RunType; -}; - -template -struct FunctorTraits> { - typedef typename FunctorTraits::RunnableType RunnableType; - typedef - typename ForceVoidReturn::RunType RunType; -}; - -template -struct FunctorTraits> { - typedef Callback RunnableType; - typedef typename Callback::RunType RunType; -}; - -// MakeRunnable<> -// -// Converts a passed in functor to a RunnableType using type inference. - -template -typename FunctorTraits::RunnableType MakeRunnable(const T& t) { - return RunnableAdapter(t); -} - -template -typename FunctorTraits::RunnableType MakeRunnable( - const IgnoreResultHelper& t) { - return MakeRunnable(t.functor_); -} - -template -const typename FunctorTraits>::RunnableType& MakeRunnable( - const Callback& t) { - DCHECK(!t.is_null()); - return t; -} - -// InvokeHelper<> -// -// There are 3 logical InvokeHelper<> specializations: normal, void-return, -// WeakCalls. -// -// The normal type just calls the underlying runnable. -// -// We need a InvokeHelper to handle void return types in order to support -// IgnoreResult(). Normally, if the Runnable's RunType had a void return, -// the template system would just accept "return functor.Run()" ignoring -// the fact that a void function is being used with return. This piece of -// sugar breaks though when the Runnable's RunType is not void. Thus, we -// need a partial specialization to change the syntax to drop the "return" -// from the invocation call. -// -// WeakCalls similarly need special syntax that is applied to the first -// argument to check if they should no-op themselves. -template -struct InvokeHelper; - -template -struct InvokeHelper { - static ReturnType MakeItSo(Runnable runnable) { return runnable.Run(); } -}; - -template -struct InvokeHelper { - static void MakeItSo(Runnable runnable) { runnable.Run(); } -}; - -template -struct InvokeHelper { - static ReturnType MakeItSo(Runnable runnable, A1 a1) { - return runnable.Run(CallbackForward(a1)); - } -}; - -template -struct InvokeHelper { - static void MakeItSo(Runnable runnable, A1 a1) { - runnable.Run(CallbackForward(a1)); - } -}; - -template -struct InvokeHelper { - static void MakeItSo(Runnable runnable, BoundWeakPtr weak_ptr) { - if (!weak_ptr.get()) { - return; - } - runnable.Run(weak_ptr.get()); - } -}; - -template -struct InvokeHelper { - static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2) { - return runnable.Run(CallbackForward(a1), CallbackForward(a2)); - } -}; - -template -struct InvokeHelper { - static void MakeItSo(Runnable runnable, A1 a1, A2 a2) { - runnable.Run(CallbackForward(a1), CallbackForward(a2)); - } -}; - -template -struct InvokeHelper { - static void MakeItSo(Runnable runnable, BoundWeakPtr weak_ptr, A2 a2) { - if (!weak_ptr.get()) { - return; - } - runnable.Run(weak_ptr.get(), CallbackForward(a2)); - } -}; - -template -struct InvokeHelper { - static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3) { - return runnable.Run(CallbackForward(a1), CallbackForward(a2), - CallbackForward(a3)); - } -}; - -template -struct InvokeHelper { - static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3) { - runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3)); - } -}; - -template -struct InvokeHelper { - static void MakeItSo(Runnable runnable, BoundWeakPtr weak_ptr, A2 a2, A3 a3) { - if (!weak_ptr.get()) { - return; - } - runnable.Run(weak_ptr.get(), CallbackForward(a2), CallbackForward(a3)); - } -}; - -template -struct InvokeHelper { - static ReturnType MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4) { - return runnable.Run(CallbackForward(a1), CallbackForward(a2), - CallbackForward(a3), CallbackForward(a4)); - } -}; - -template -struct InvokeHelper { - static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4) { - runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3), - CallbackForward(a4)); - } -}; - -template -struct InvokeHelper { - static void MakeItSo(Runnable runnable, - BoundWeakPtr weak_ptr, - A2 a2, - A3 a3, - A4 a4) { - if (!weak_ptr.get()) { - return; - } - runnable.Run(weak_ptr.get(), CallbackForward(a2), CallbackForward(a3), - CallbackForward(a4)); - } -}; - -template -struct InvokeHelper { - static ReturnType MakeItSo(Runnable runnable, - A1 a1, - A2 a2, - A3 a3, - A4 a4, - A5 a5) { - return runnable.Run(CallbackForward(a1), CallbackForward(a2), - CallbackForward(a3), CallbackForward(a4), - CallbackForward(a5)); - } -}; - -template -struct InvokeHelper { - static void MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { - runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3), - CallbackForward(a4), CallbackForward(a5)); - } -}; - -template -struct InvokeHelper { - static void MakeItSo(Runnable runnable, - BoundWeakPtr weak_ptr, - A2 a2, - A3 a3, - A4 a4, - A5 a5) { - if (!weak_ptr.get()) { - return; - } - runnable.Run(weak_ptr.get(), CallbackForward(a2), CallbackForward(a3), - CallbackForward(a4), CallbackForward(a5)); - } -}; - -template -struct InvokeHelper { - static ReturnType - MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { - return runnable.Run(CallbackForward(a1), CallbackForward(a2), - CallbackForward(a3), CallbackForward(a4), - CallbackForward(a5), CallbackForward(a6)); - } -}; - -template -struct InvokeHelper { - static void - MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { - runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3), - CallbackForward(a4), CallbackForward(a5), CallbackForward(a6)); - } -}; - -template -struct InvokeHelper { - static void MakeItSo(Runnable runnable, - BoundWeakPtr weak_ptr, - A2 a2, - A3 a3, - A4 a4, - A5 a5, - A6 a6) { - if (!weak_ptr.get()) { - return; - } - runnable.Run(weak_ptr.get(), CallbackForward(a2), CallbackForward(a3), - CallbackForward(a4), CallbackForward(a5), CallbackForward(a6)); - } -}; - -template -struct InvokeHelper { - static ReturnType - MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { - return runnable.Run(CallbackForward(a1), CallbackForward(a2), - CallbackForward(a3), CallbackForward(a4), - CallbackForward(a5), CallbackForward(a6), - CallbackForward(a7)); - } -}; - -template -struct InvokeHelper { - static void - MakeItSo(Runnable runnable, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { - runnable.Run(CallbackForward(a1), CallbackForward(a2), CallbackForward(a3), - CallbackForward(a4), CallbackForward(a5), CallbackForward(a6), - CallbackForward(a7)); - } -}; - -template -struct InvokeHelper { - static void MakeItSo(Runnable runnable, - BoundWeakPtr weak_ptr, - A2 a2, - A3 a3, - A4 a4, - A5 a5, - A6 a6, - A7 a7) { - if (!weak_ptr.get()) { - return; - } - runnable.Run(weak_ptr.get(), CallbackForward(a2), CallbackForward(a3), - CallbackForward(a4), CallbackForward(a5), CallbackForward(a6), - CallbackForward(a7)); - } -}; - -#if !defined(_MSC_VER) - -template -struct InvokeHelper { - // WeakCalls are only supported for functions with a void return type. - // Otherwise, the function result would be undefined if the the WeakPtr<> - // is invalidated. - COMPILE_ASSERT(is_void::value, - weak_ptrs_can_only_bind_to_methods_without_return_values); -}; - -#endif - -// Invoker<> -// -// See description at the top of the file. -template -struct Invoker; - -// Arity 0 -> 0. -template -struct Invoker<0, StorageType, R()> { - typedef R(RunType)(BindStateBase*); - - typedef R(UnboundRunType)(); - - static R Run(BindStateBase* base) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - - return InvokeHelper::MakeItSo(storage->runnable_); - } -}; - -// Arity 1 -> 1. -template -struct Invoker<0, StorageType, R(X1)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X1); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x1) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - - return InvokeHelper::ForwardType - x1)>::MakeItSo(storage->runnable_, - CallbackForward(x1)); - } -}; - -// Arity 1 -> 0. -template -struct Invoker<1, StorageType, R(X1)> { - typedef R(RunType)(BindStateBase*); - - typedef R(UnboundRunType)(); - - static R Run(BindStateBase* base) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - return InvokeHelper:: - MakeItSo(storage->runnable_, CallbackForward(x1)); - } -}; - -// Arity 2 -> 2. -template -struct Invoker<0, StorageType, R(X1, X2)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X1, X2); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x1, - typename CallbackParamTraits::ForwardType x2) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - - return InvokeHelper::ForwardType x1, - typename CallbackParamTraits::ForwardType - x2)>::MakeItSo(storage->runnable_, - CallbackForward(x1), - CallbackForward(x2)); - } -}; - -// Arity 2 -> 1. -template -struct Invoker<1, StorageType, R(X1, X2)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X2); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x2) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - return InvokeHelper::ForwardType - x2)>::MakeItSo(storage->runnable_, - CallbackForward(x1), - CallbackForward(x2)); - } -}; - -// Arity 2 -> 0. -template -struct Invoker<2, StorageType, R(X1, X2)> { - typedef R(RunType)(BindStateBase*); - - typedef R(UnboundRunType)(); - - static R Run(BindStateBase* base) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - typename Bound2UnwrapTraits::ForwardType x2 = - Bound2UnwrapTraits::Unwrap(storage->p2_); - return InvokeHelper:: - MakeItSo(storage->runnable_, CallbackForward(x1), CallbackForward(x2)); - } -}; - -// Arity 3 -> 3. -template -struct Invoker<0, StorageType, R(X1, X2, X3)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X1, X2, X3); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x1, - typename CallbackParamTraits::ForwardType x2, - typename CallbackParamTraits::ForwardType x3) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - - return InvokeHelper::ForwardType x1, - typename CallbackParamTraits::ForwardType x2, - typename CallbackParamTraits::ForwardType - x3)>::MakeItSo(storage->runnable_, - CallbackForward(x1), - CallbackForward(x2), - CallbackForward(x3)); - } -}; - -// Arity 3 -> 2. -template -struct Invoker<1, StorageType, R(X1, X2, X3)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X2, X3); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x2, - typename CallbackParamTraits::ForwardType x3) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - return InvokeHelper::ForwardType x2, - typename CallbackParamTraits::ForwardType - x3)>::MakeItSo(storage->runnable_, - CallbackForward(x1), - CallbackForward(x2), - CallbackForward(x3)); - } -}; - -// Arity 3 -> 1. -template -struct Invoker<2, StorageType, R(X1, X2, X3)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X3); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x3) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - typename Bound2UnwrapTraits::ForwardType x2 = - Bound2UnwrapTraits::Unwrap(storage->p2_); - return InvokeHelper::ForwardType - x3)>::MakeItSo(storage->runnable_, - CallbackForward(x1), - CallbackForward(x2), - CallbackForward(x3)); - } -}; - -// Arity 3 -> 0. -template -struct Invoker<3, StorageType, R(X1, X2, X3)> { - typedef R(RunType)(BindStateBase*); - - typedef R(UnboundRunType)(); - - static R Run(BindStateBase* base) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; - typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - typename Bound2UnwrapTraits::ForwardType x2 = - Bound2UnwrapTraits::Unwrap(storage->p2_); - typename Bound3UnwrapTraits::ForwardType x3 = - Bound3UnwrapTraits::Unwrap(storage->p3_); - return InvokeHelper:: - MakeItSo(storage->runnable_, CallbackForward(x1), CallbackForward(x2), - CallbackForward(x3)); - } -}; - -// Arity 4 -> 4. -template -struct Invoker<0, StorageType, R(X1, X2, X3, X4)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X1, X2, X3, X4); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x1, - typename CallbackParamTraits::ForwardType x2, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType x4) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - - return InvokeHelper::ForwardType x1, - typename CallbackParamTraits::ForwardType x2, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType - x4)>::MakeItSo(storage->runnable_, - CallbackForward(x1), - CallbackForward(x2), - CallbackForward(x3), - CallbackForward(x4)); - } -}; - -// Arity 4 -> 3. -template -struct Invoker<1, StorageType, R(X1, X2, X3, X4)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X2, X3, X4); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x2, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType x4) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - return InvokeHelper::ForwardType x2, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType - x4)>::MakeItSo(storage->runnable_, - CallbackForward(x1), - CallbackForward(x2), - CallbackForward(x3), - CallbackForward(x4)); - } -}; - -// Arity 4 -> 2. -template -struct Invoker<2, StorageType, R(X1, X2, X3, X4)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X3, X4); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType x4) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - typename Bound2UnwrapTraits::ForwardType x2 = - Bound2UnwrapTraits::Unwrap(storage->p2_); - return InvokeHelper::ForwardType x3, - typename CallbackParamTraits::ForwardType - x4)>::MakeItSo(storage->runnable_, - CallbackForward(x1), - CallbackForward(x2), - CallbackForward(x3), - CallbackForward(x4)); - } -}; - -// Arity 4 -> 1. -template -struct Invoker<3, StorageType, R(X1, X2, X3, X4)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X4); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x4) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; - typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - typename Bound2UnwrapTraits::ForwardType x2 = - Bound2UnwrapTraits::Unwrap(storage->p2_); - typename Bound3UnwrapTraits::ForwardType x3 = - Bound3UnwrapTraits::Unwrap(storage->p3_); - return InvokeHelper::ForwardType - x4)>::MakeItSo(storage->runnable_, - CallbackForward(x1), - CallbackForward(x2), - CallbackForward(x3), - CallbackForward(x4)); - } -}; - -// Arity 4 -> 0. -template -struct Invoker<4, StorageType, R(X1, X2, X3, X4)> { - typedef R(RunType)(BindStateBase*); - - typedef R(UnboundRunType)(); - - static R Run(BindStateBase* base) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; - typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; - typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - typename Bound2UnwrapTraits::ForwardType x2 = - Bound2UnwrapTraits::Unwrap(storage->p2_); - typename Bound3UnwrapTraits::ForwardType x3 = - Bound3UnwrapTraits::Unwrap(storage->p3_); - typename Bound4UnwrapTraits::ForwardType x4 = - Bound4UnwrapTraits::Unwrap(storage->p4_); - return InvokeHelper:: - MakeItSo(storage->runnable_, CallbackForward(x1), CallbackForward(x2), - CallbackForward(x3), CallbackForward(x4)); - } -}; - -// Arity 5 -> 5. -template -struct Invoker<0, StorageType, R(X1, X2, X3, X4, X5)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X1, X2, X3, X4, X5); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x1, - typename CallbackParamTraits::ForwardType x2, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType x5) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - - return InvokeHelper< - StorageType::IsWeakCall::value, R, typename StorageType::RunnableType, - void(typename CallbackParamTraits::ForwardType x1, - typename CallbackParamTraits::ForwardType x2, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType - x5)>::MakeItSo(storage->runnable_, CallbackForward(x1), - CallbackForward(x2), CallbackForward(x3), - CallbackForward(x4), CallbackForward(x5)); - } -}; - -// Arity 5 -> 4. -template -struct Invoker<1, StorageType, R(X1, X2, X3, X4, X5)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X2, X3, X4, X5); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x2, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType x5) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - return InvokeHelper< - StorageType::IsWeakCall::value, R, typename StorageType::RunnableType, - void(typename Bound1UnwrapTraits::ForwardType, - typename CallbackParamTraits::ForwardType x2, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType - x5)>::MakeItSo(storage->runnable_, CallbackForward(x1), - CallbackForward(x2), CallbackForward(x3), - CallbackForward(x4), CallbackForward(x5)); - } -}; - -// Arity 5 -> 3. -template -struct Invoker<2, StorageType, R(X1, X2, X3, X4, X5)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X3, X4, X5); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType x5) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - typename Bound2UnwrapTraits::ForwardType x2 = - Bound2UnwrapTraits::Unwrap(storage->p2_); - return InvokeHelper< - StorageType::IsWeakCall::value, R, typename StorageType::RunnableType, - void(typename Bound1UnwrapTraits::ForwardType, - typename Bound2UnwrapTraits::ForwardType, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType - x5)>::MakeItSo(storage->runnable_, CallbackForward(x1), - CallbackForward(x2), CallbackForward(x3), - CallbackForward(x4), CallbackForward(x5)); - } -}; - -// Arity 5 -> 2. -template -struct Invoker<3, StorageType, R(X1, X2, X3, X4, X5)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X4, X5); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType x5) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; - typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - typename Bound2UnwrapTraits::ForwardType x2 = - Bound2UnwrapTraits::Unwrap(storage->p2_); - typename Bound3UnwrapTraits::ForwardType x3 = - Bound3UnwrapTraits::Unwrap(storage->p3_); - return InvokeHelper< - StorageType::IsWeakCall::value, R, typename StorageType::RunnableType, - void(typename Bound1UnwrapTraits::ForwardType, - typename Bound2UnwrapTraits::ForwardType, - typename Bound3UnwrapTraits::ForwardType, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType - x5)>::MakeItSo(storage->runnable_, CallbackForward(x1), - CallbackForward(x2), CallbackForward(x3), - CallbackForward(x4), CallbackForward(x5)); - } -}; - -// Arity 5 -> 1. -template -struct Invoker<4, StorageType, R(X1, X2, X3, X4, X5)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X5); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x5) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; - typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; - typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - typename Bound2UnwrapTraits::ForwardType x2 = - Bound2UnwrapTraits::Unwrap(storage->p2_); - typename Bound3UnwrapTraits::ForwardType x3 = - Bound3UnwrapTraits::Unwrap(storage->p3_); - typename Bound4UnwrapTraits::ForwardType x4 = - Bound4UnwrapTraits::Unwrap(storage->p4_); - return InvokeHelper< - StorageType::IsWeakCall::value, R, typename StorageType::RunnableType, - void(typename Bound1UnwrapTraits::ForwardType, - typename Bound2UnwrapTraits::ForwardType, - typename Bound3UnwrapTraits::ForwardType, - typename Bound4UnwrapTraits::ForwardType, - typename CallbackParamTraits::ForwardType - x5)>::MakeItSo(storage->runnable_, CallbackForward(x1), - CallbackForward(x2), CallbackForward(x3), - CallbackForward(x4), CallbackForward(x5)); - } -}; - -// Arity 5 -> 0. -template -struct Invoker<5, StorageType, R(X1, X2, X3, X4, X5)> { - typedef R(RunType)(BindStateBase*); - - typedef R(UnboundRunType)(); - - static R Run(BindStateBase* base) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; - typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; - typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits; - typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - typename Bound2UnwrapTraits::ForwardType x2 = - Bound2UnwrapTraits::Unwrap(storage->p2_); - typename Bound3UnwrapTraits::ForwardType x3 = - Bound3UnwrapTraits::Unwrap(storage->p3_); - typename Bound4UnwrapTraits::ForwardType x4 = - Bound4UnwrapTraits::Unwrap(storage->p4_); - typename Bound5UnwrapTraits::ForwardType x5 = - Bound5UnwrapTraits::Unwrap(storage->p5_); - return InvokeHelper:: - MakeItSo(storage->runnable_, CallbackForward(x1), CallbackForward(x2), - CallbackForward(x3), CallbackForward(x4), CallbackForward(x5)); - } -}; - -// Arity 6 -> 6. -template -struct Invoker<0, StorageType, R(X1, X2, X3, X4, X5, X6)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X1, X2, X3, X4, X5, X6); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x1, - typename CallbackParamTraits::ForwardType x2, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType x5, - typename CallbackParamTraits::ForwardType x6) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - - return InvokeHelper< - StorageType::IsWeakCall::value, R, typename StorageType::RunnableType, - void(typename CallbackParamTraits::ForwardType x1, - typename CallbackParamTraits::ForwardType x2, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType x5, - typename CallbackParamTraits::ForwardType - x6)>::MakeItSo(storage->runnable_, CallbackForward(x1), - CallbackForward(x2), CallbackForward(x3), - CallbackForward(x4), CallbackForward(x5), - CallbackForward(x6)); - } -}; - -// Arity 6 -> 5. -template -struct Invoker<1, StorageType, R(X1, X2, X3, X4, X5, X6)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X2, X3, X4, X5, X6); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x2, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType x5, - typename CallbackParamTraits::ForwardType x6) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - return InvokeHelper< - StorageType::IsWeakCall::value, R, typename StorageType::RunnableType, - void(typename Bound1UnwrapTraits::ForwardType, - typename CallbackParamTraits::ForwardType x2, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType x5, - typename CallbackParamTraits::ForwardType - x6)>::MakeItSo(storage->runnable_, CallbackForward(x1), - CallbackForward(x2), CallbackForward(x3), - CallbackForward(x4), CallbackForward(x5), - CallbackForward(x6)); - } -}; - -// Arity 6 -> 4. -template -struct Invoker<2, StorageType, R(X1, X2, X3, X4, X5, X6)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X3, X4, X5, X6); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType x5, - typename CallbackParamTraits::ForwardType x6) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - typename Bound2UnwrapTraits::ForwardType x2 = - Bound2UnwrapTraits::Unwrap(storage->p2_); - return InvokeHelper< - StorageType::IsWeakCall::value, R, typename StorageType::RunnableType, - void(typename Bound1UnwrapTraits::ForwardType, - typename Bound2UnwrapTraits::ForwardType, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType x5, - typename CallbackParamTraits::ForwardType - x6)>::MakeItSo(storage->runnable_, CallbackForward(x1), - CallbackForward(x2), CallbackForward(x3), - CallbackForward(x4), CallbackForward(x5), - CallbackForward(x6)); - } -}; - -// Arity 6 -> 3. -template -struct Invoker<3, StorageType, R(X1, X2, X3, X4, X5, X6)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X4, X5, X6); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType x5, - typename CallbackParamTraits::ForwardType x6) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; - typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - typename Bound2UnwrapTraits::ForwardType x2 = - Bound2UnwrapTraits::Unwrap(storage->p2_); - typename Bound3UnwrapTraits::ForwardType x3 = - Bound3UnwrapTraits::Unwrap(storage->p3_); - return InvokeHelper< - StorageType::IsWeakCall::value, R, typename StorageType::RunnableType, - void(typename Bound1UnwrapTraits::ForwardType, - typename Bound2UnwrapTraits::ForwardType, - typename Bound3UnwrapTraits::ForwardType, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType x5, - typename CallbackParamTraits::ForwardType - x6)>::MakeItSo(storage->runnable_, CallbackForward(x1), - CallbackForward(x2), CallbackForward(x3), - CallbackForward(x4), CallbackForward(x5), - CallbackForward(x6)); - } -}; - -// Arity 6 -> 2. -template -struct Invoker<4, StorageType, R(X1, X2, X3, X4, X5, X6)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X5, X6); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x5, - typename CallbackParamTraits::ForwardType x6) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; - typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; - typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - typename Bound2UnwrapTraits::ForwardType x2 = - Bound2UnwrapTraits::Unwrap(storage->p2_); - typename Bound3UnwrapTraits::ForwardType x3 = - Bound3UnwrapTraits::Unwrap(storage->p3_); - typename Bound4UnwrapTraits::ForwardType x4 = - Bound4UnwrapTraits::Unwrap(storage->p4_); - return InvokeHelper< - StorageType::IsWeakCall::value, R, typename StorageType::RunnableType, - void(typename Bound1UnwrapTraits::ForwardType, - typename Bound2UnwrapTraits::ForwardType, - typename Bound3UnwrapTraits::ForwardType, - typename Bound4UnwrapTraits::ForwardType, - typename CallbackParamTraits::ForwardType x5, - typename CallbackParamTraits::ForwardType - x6)>::MakeItSo(storage->runnable_, CallbackForward(x1), - CallbackForward(x2), CallbackForward(x3), - CallbackForward(x4), CallbackForward(x5), - CallbackForward(x6)); - } -}; - -// Arity 6 -> 1. -template -struct Invoker<5, StorageType, R(X1, X2, X3, X4, X5, X6)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X6); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x6) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; - typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; - typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits; - typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - typename Bound2UnwrapTraits::ForwardType x2 = - Bound2UnwrapTraits::Unwrap(storage->p2_); - typename Bound3UnwrapTraits::ForwardType x3 = - Bound3UnwrapTraits::Unwrap(storage->p3_); - typename Bound4UnwrapTraits::ForwardType x4 = - Bound4UnwrapTraits::Unwrap(storage->p4_); - typename Bound5UnwrapTraits::ForwardType x5 = - Bound5UnwrapTraits::Unwrap(storage->p5_); - return InvokeHelper< - StorageType::IsWeakCall::value, R, typename StorageType::RunnableType, - void(typename Bound1UnwrapTraits::ForwardType, - typename Bound2UnwrapTraits::ForwardType, - typename Bound3UnwrapTraits::ForwardType, - typename Bound4UnwrapTraits::ForwardType, - typename Bound5UnwrapTraits::ForwardType, - typename CallbackParamTraits::ForwardType - x6)>::MakeItSo(storage->runnable_, CallbackForward(x1), - CallbackForward(x2), CallbackForward(x3), - CallbackForward(x4), CallbackForward(x5), - CallbackForward(x6)); - } -}; - -// Arity 6 -> 0. -template -struct Invoker<6, StorageType, R(X1, X2, X3, X4, X5, X6)> { - typedef R(RunType)(BindStateBase*); - - typedef R(UnboundRunType)(); - - static R Run(BindStateBase* base) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; - typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; - typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits; - typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits; - typedef typename StorageType::Bound6UnwrapTraits Bound6UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - typename Bound2UnwrapTraits::ForwardType x2 = - Bound2UnwrapTraits::Unwrap(storage->p2_); - typename Bound3UnwrapTraits::ForwardType x3 = - Bound3UnwrapTraits::Unwrap(storage->p3_); - typename Bound4UnwrapTraits::ForwardType x4 = - Bound4UnwrapTraits::Unwrap(storage->p4_); - typename Bound5UnwrapTraits::ForwardType x5 = - Bound5UnwrapTraits::Unwrap(storage->p5_); - typename Bound6UnwrapTraits::ForwardType x6 = - Bound6UnwrapTraits::Unwrap(storage->p6_); - return InvokeHelper:: - MakeItSo(storage->runnable_, CallbackForward(x1), CallbackForward(x2), - CallbackForward(x3), CallbackForward(x4), CallbackForward(x5), - CallbackForward(x6)); - } -}; - -// Arity 7 -> 7. -template -struct Invoker<0, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X1, X2, X3, X4, X5, X6, X7); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x1, - typename CallbackParamTraits::ForwardType x2, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType x5, - typename CallbackParamTraits::ForwardType x6, - typename CallbackParamTraits::ForwardType x7) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - - return InvokeHelper< - StorageType::IsWeakCall::value, R, typename StorageType::RunnableType, - void(typename CallbackParamTraits::ForwardType x1, - typename CallbackParamTraits::ForwardType x2, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType x5, - typename CallbackParamTraits::ForwardType x6, - typename CallbackParamTraits::ForwardType - x7)>::MakeItSo(storage->runnable_, CallbackForward(x1), - CallbackForward(x2), CallbackForward(x3), - CallbackForward(x4), CallbackForward(x5), - CallbackForward(x6), CallbackForward(x7)); - } -}; - -// Arity 7 -> 6. -template -struct Invoker<1, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X2, X3, X4, X5, X6, X7); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x2, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType x5, - typename CallbackParamTraits::ForwardType x6, - typename CallbackParamTraits::ForwardType x7) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - return InvokeHelper< - StorageType::IsWeakCall::value, R, typename StorageType::RunnableType, - void(typename Bound1UnwrapTraits::ForwardType, - typename CallbackParamTraits::ForwardType x2, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType x5, - typename CallbackParamTraits::ForwardType x6, - typename CallbackParamTraits::ForwardType - x7)>::MakeItSo(storage->runnable_, CallbackForward(x1), - CallbackForward(x2), CallbackForward(x3), - CallbackForward(x4), CallbackForward(x5), - CallbackForward(x6), CallbackForward(x7)); - } -}; - -// Arity 7 -> 5. -template -struct Invoker<2, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X3, X4, X5, X6, X7); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType x5, - typename CallbackParamTraits::ForwardType x6, - typename CallbackParamTraits::ForwardType x7) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - typename Bound2UnwrapTraits::ForwardType x2 = - Bound2UnwrapTraits::Unwrap(storage->p2_); - return InvokeHelper< - StorageType::IsWeakCall::value, R, typename StorageType::RunnableType, - void(typename Bound1UnwrapTraits::ForwardType, - typename Bound2UnwrapTraits::ForwardType, - typename CallbackParamTraits::ForwardType x3, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType x5, - typename CallbackParamTraits::ForwardType x6, - typename CallbackParamTraits::ForwardType - x7)>::MakeItSo(storage->runnable_, CallbackForward(x1), - CallbackForward(x2), CallbackForward(x3), - CallbackForward(x4), CallbackForward(x5), - CallbackForward(x6), CallbackForward(x7)); - } -}; - -// Arity 7 -> 4. -template -struct Invoker<3, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X4, X5, X6, X7); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType x5, - typename CallbackParamTraits::ForwardType x6, - typename CallbackParamTraits::ForwardType x7) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; - typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - typename Bound2UnwrapTraits::ForwardType x2 = - Bound2UnwrapTraits::Unwrap(storage->p2_); - typename Bound3UnwrapTraits::ForwardType x3 = - Bound3UnwrapTraits::Unwrap(storage->p3_); - return InvokeHelper< - StorageType::IsWeakCall::value, R, typename StorageType::RunnableType, - void(typename Bound1UnwrapTraits::ForwardType, - typename Bound2UnwrapTraits::ForwardType, - typename Bound3UnwrapTraits::ForwardType, - typename CallbackParamTraits::ForwardType x4, - typename CallbackParamTraits::ForwardType x5, - typename CallbackParamTraits::ForwardType x6, - typename CallbackParamTraits::ForwardType - x7)>::MakeItSo(storage->runnable_, CallbackForward(x1), - CallbackForward(x2), CallbackForward(x3), - CallbackForward(x4), CallbackForward(x5), - CallbackForward(x6), CallbackForward(x7)); - } -}; - -// Arity 7 -> 3. -template -struct Invoker<4, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X5, X6, X7); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x5, - typename CallbackParamTraits::ForwardType x6, - typename CallbackParamTraits::ForwardType x7) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; - typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; - typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - typename Bound2UnwrapTraits::ForwardType x2 = - Bound2UnwrapTraits::Unwrap(storage->p2_); - typename Bound3UnwrapTraits::ForwardType x3 = - Bound3UnwrapTraits::Unwrap(storage->p3_); - typename Bound4UnwrapTraits::ForwardType x4 = - Bound4UnwrapTraits::Unwrap(storage->p4_); - return InvokeHelper< - StorageType::IsWeakCall::value, R, typename StorageType::RunnableType, - void(typename Bound1UnwrapTraits::ForwardType, - typename Bound2UnwrapTraits::ForwardType, - typename Bound3UnwrapTraits::ForwardType, - typename Bound4UnwrapTraits::ForwardType, - typename CallbackParamTraits::ForwardType x5, - typename CallbackParamTraits::ForwardType x6, - typename CallbackParamTraits::ForwardType - x7)>::MakeItSo(storage->runnable_, CallbackForward(x1), - CallbackForward(x2), CallbackForward(x3), - CallbackForward(x4), CallbackForward(x5), - CallbackForward(x6), CallbackForward(x7)); - } -}; - -// Arity 7 -> 2. -template -struct Invoker<5, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X6, X7); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x6, - typename CallbackParamTraits::ForwardType x7) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; - typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; - typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits; - typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - typename Bound2UnwrapTraits::ForwardType x2 = - Bound2UnwrapTraits::Unwrap(storage->p2_); - typename Bound3UnwrapTraits::ForwardType x3 = - Bound3UnwrapTraits::Unwrap(storage->p3_); - typename Bound4UnwrapTraits::ForwardType x4 = - Bound4UnwrapTraits::Unwrap(storage->p4_); - typename Bound5UnwrapTraits::ForwardType x5 = - Bound5UnwrapTraits::Unwrap(storage->p5_); - return InvokeHelper< - StorageType::IsWeakCall::value, R, typename StorageType::RunnableType, - void(typename Bound1UnwrapTraits::ForwardType, - typename Bound2UnwrapTraits::ForwardType, - typename Bound3UnwrapTraits::ForwardType, - typename Bound4UnwrapTraits::ForwardType, - typename Bound5UnwrapTraits::ForwardType, - typename CallbackParamTraits::ForwardType x6, - typename CallbackParamTraits::ForwardType - x7)>::MakeItSo(storage->runnable_, CallbackForward(x1), - CallbackForward(x2), CallbackForward(x3), - CallbackForward(x4), CallbackForward(x5), - CallbackForward(x6), CallbackForward(x7)); - } -}; - -// Arity 7 -> 1. -template -struct Invoker<6, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> { - typedef R(RunType)(BindStateBase*, - typename CallbackParamTraits::ForwardType); - - typedef R(UnboundRunType)(X7); - - static R Run(BindStateBase* base, - typename CallbackParamTraits::ForwardType x7) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; - typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; - typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits; - typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits; - typedef typename StorageType::Bound6UnwrapTraits Bound6UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - typename Bound2UnwrapTraits::ForwardType x2 = - Bound2UnwrapTraits::Unwrap(storage->p2_); - typename Bound3UnwrapTraits::ForwardType x3 = - Bound3UnwrapTraits::Unwrap(storage->p3_); - typename Bound4UnwrapTraits::ForwardType x4 = - Bound4UnwrapTraits::Unwrap(storage->p4_); - typename Bound5UnwrapTraits::ForwardType x5 = - Bound5UnwrapTraits::Unwrap(storage->p5_); - typename Bound6UnwrapTraits::ForwardType x6 = - Bound6UnwrapTraits::Unwrap(storage->p6_); - return InvokeHelper< - StorageType::IsWeakCall::value, R, typename StorageType::RunnableType, - void(typename Bound1UnwrapTraits::ForwardType, - typename Bound2UnwrapTraits::ForwardType, - typename Bound3UnwrapTraits::ForwardType, - typename Bound4UnwrapTraits::ForwardType, - typename Bound5UnwrapTraits::ForwardType, - typename Bound6UnwrapTraits::ForwardType, - typename CallbackParamTraits::ForwardType - x7)>::MakeItSo(storage->runnable_, CallbackForward(x1), - CallbackForward(x2), CallbackForward(x3), - CallbackForward(x4), CallbackForward(x5), - CallbackForward(x6), CallbackForward(x7)); - } -}; - -// Arity 7 -> 0. -template -struct Invoker<7, StorageType, R(X1, X2, X3, X4, X5, X6, X7)> { - typedef R(RunType)(BindStateBase*); - - typedef R(UnboundRunType)(); - - static R Run(BindStateBase* base) { - StorageType* storage = static_cast(base); - - // Local references to make debugger stepping easier. If in a debugger, - // you really want to warp ahead and step through the - // InvokeHelper<>::MakeItSo() call below. - typedef typename StorageType::Bound1UnwrapTraits Bound1UnwrapTraits; - typedef typename StorageType::Bound2UnwrapTraits Bound2UnwrapTraits; - typedef typename StorageType::Bound3UnwrapTraits Bound3UnwrapTraits; - typedef typename StorageType::Bound4UnwrapTraits Bound4UnwrapTraits; - typedef typename StorageType::Bound5UnwrapTraits Bound5UnwrapTraits; - typedef typename StorageType::Bound6UnwrapTraits Bound6UnwrapTraits; - typedef typename StorageType::Bound7UnwrapTraits Bound7UnwrapTraits; - - typename Bound1UnwrapTraits::ForwardType x1 = - Bound1UnwrapTraits::Unwrap(storage->p1_); - typename Bound2UnwrapTraits::ForwardType x2 = - Bound2UnwrapTraits::Unwrap(storage->p2_); - typename Bound3UnwrapTraits::ForwardType x3 = - Bound3UnwrapTraits::Unwrap(storage->p3_); - typename Bound4UnwrapTraits::ForwardType x4 = - Bound4UnwrapTraits::Unwrap(storage->p4_); - typename Bound5UnwrapTraits::ForwardType x5 = - Bound5UnwrapTraits::Unwrap(storage->p5_); - typename Bound6UnwrapTraits::ForwardType x6 = - Bound6UnwrapTraits::Unwrap(storage->p6_); - typename Bound7UnwrapTraits::ForwardType x7 = - Bound7UnwrapTraits::Unwrap(storage->p7_); - return InvokeHelper:: - MakeItSo(storage->runnable_, CallbackForward(x1), CallbackForward(x2), - CallbackForward(x3), CallbackForward(x4), CallbackForward(x5), - CallbackForward(x6), CallbackForward(x7)); - } -}; - -// BindState<> -// -// This stores all the state passed into Bind() and is also where most -// of the template resolution magic occurs. -// -// Runnable is the functor we are binding arguments to. -// RunType is type of the Run() function that the Invoker<> should use. -// Normally, this is the same as the RunType of the Runnable, but it can -// be different if an adapter like IgnoreResult() has been used. -// -// BoundArgsType contains the storage type for all the bound arguments by -// (ab)using a function type. -template -struct BindState; - -template -struct BindState : public BindStateBase { - typedef Runnable RunnableType; - typedef false_type IsWeakCall; - typedef Invoker<0, BindState, RunType> InvokerType; - typedef typename InvokerType::UnboundRunType UnboundRunType; - explicit BindState(const Runnable& runnable) - : BindStateBase(&Destroy), runnable_(runnable) {} - - ~BindState() {} - - static void Destroy(BindStateBase* self) { - delete static_cast(self); - } - - RunnableType runnable_; -}; - -template -struct BindState : public BindStateBase { - typedef Runnable RunnableType; - typedef IsWeakMethod::value, P1> IsWeakCall; - typedef Invoker<1, BindState, RunType> InvokerType; - typedef typename InvokerType::UnboundRunType UnboundRunType; - - // Convenience typedefs for bound argument types. - typedef UnwrapTraits Bound1UnwrapTraits; - - BindState(const Runnable& runnable, const P1& p1) - : BindStateBase(&Destroy), runnable_(runnable), p1_(p1) { - MaybeRefcount::value, P1>::AddRef(p1_); - } - - ~BindState() { - MaybeRefcount::value, P1>::Release(p1_); - } - - static void Destroy(BindStateBase* self) { - delete static_cast(self); - } - - RunnableType runnable_; - P1 p1_; -}; - -template -struct BindState : public BindStateBase { - typedef Runnable RunnableType; - typedef IsWeakMethod::value, P1> IsWeakCall; - typedef Invoker<2, BindState, RunType> InvokerType; - typedef typename InvokerType::UnboundRunType UnboundRunType; - - // Convenience typedefs for bound argument types. - typedef UnwrapTraits Bound1UnwrapTraits; - typedef UnwrapTraits Bound2UnwrapTraits; - - BindState(const Runnable& runnable, const P1& p1, const P2& p2) - : BindStateBase(&Destroy), runnable_(runnable), p1_(p1), p2_(p2) { - MaybeRefcount::value, P1>::AddRef(p1_); - } - - ~BindState() { - MaybeRefcount::value, P1>::Release(p1_); - } - - static void Destroy(BindStateBase* self) { - delete static_cast(self); - } - - RunnableType runnable_; - P1 p1_; - P2 p2_; -}; - -template -struct BindState : public BindStateBase { - typedef Runnable RunnableType; - typedef IsWeakMethod::value, P1> IsWeakCall; - typedef Invoker<3, BindState, RunType> InvokerType; - typedef typename InvokerType::UnboundRunType UnboundRunType; - - // Convenience typedefs for bound argument types. - typedef UnwrapTraits Bound1UnwrapTraits; - typedef UnwrapTraits Bound2UnwrapTraits; - typedef UnwrapTraits Bound3UnwrapTraits; - - BindState(const Runnable& runnable, const P1& p1, const P2& p2, const P3& p3) - : BindStateBase(&Destroy), - runnable_(runnable), - p1_(p1), - p2_(p2), - p3_(p3) { - MaybeRefcount::value, P1>::AddRef(p1_); - } - - ~BindState() { - MaybeRefcount::value, P1>::Release(p1_); - } - - static void Destroy(BindStateBase* self) { - delete static_cast(self); - } - - RunnableType runnable_; - P1 p1_; - P2 p2_; - P3 p3_; -}; - -template -struct BindState - : public BindStateBase { - typedef Runnable RunnableType; - typedef IsWeakMethod::value, P1> IsWeakCall; - typedef Invoker<4, BindState, RunType> InvokerType; - typedef typename InvokerType::UnboundRunType UnboundRunType; - - // Convenience typedefs for bound argument types. - typedef UnwrapTraits Bound1UnwrapTraits; - typedef UnwrapTraits Bound2UnwrapTraits; - typedef UnwrapTraits Bound3UnwrapTraits; - typedef UnwrapTraits Bound4UnwrapTraits; - - BindState(const Runnable& runnable, - const P1& p1, - const P2& p2, - const P3& p3, - const P4& p4) - : BindStateBase(&Destroy), - runnable_(runnable), - p1_(p1), - p2_(p2), - p3_(p3), - p4_(p4) { - MaybeRefcount::value, P1>::AddRef(p1_); - } - - ~BindState() { - MaybeRefcount::value, P1>::Release(p1_); - } - - static void Destroy(BindStateBase* self) { - delete static_cast(self); - } - - RunnableType runnable_; - P1 p1_; - P2 p2_; - P3 p3_; - P4 p4_; -}; - -template -struct BindState - : public BindStateBase { - typedef Runnable RunnableType; - typedef IsWeakMethod::value, P1> IsWeakCall; - typedef Invoker<5, BindState, RunType> InvokerType; - typedef typename InvokerType::UnboundRunType UnboundRunType; - - // Convenience typedefs for bound argument types. - typedef UnwrapTraits Bound1UnwrapTraits; - typedef UnwrapTraits Bound2UnwrapTraits; - typedef UnwrapTraits Bound3UnwrapTraits; - typedef UnwrapTraits Bound4UnwrapTraits; - typedef UnwrapTraits Bound5UnwrapTraits; - - BindState(const Runnable& runnable, - const P1& p1, - const P2& p2, - const P3& p3, - const P4& p4, - const P5& p5) - : BindStateBase(&Destroy), - runnable_(runnable), - p1_(p1), - p2_(p2), - p3_(p3), - p4_(p4), - p5_(p5) { - MaybeRefcount::value, P1>::AddRef(p1_); - } - - ~BindState() { - MaybeRefcount::value, P1>::Release(p1_); - } - - static void Destroy(BindStateBase* self) { - delete static_cast(self); - } - - RunnableType runnable_; - P1 p1_; - P2 p2_; - P3 p3_; - P4 p4_; - P5 p5_; -}; - -template -struct BindState - : public BindStateBase { - typedef Runnable RunnableType; - typedef IsWeakMethod::value, P1> IsWeakCall; - typedef Invoker<6, BindState, RunType> InvokerType; - typedef typename InvokerType::UnboundRunType UnboundRunType; - - // Convenience typedefs for bound argument types. - typedef UnwrapTraits Bound1UnwrapTraits; - typedef UnwrapTraits Bound2UnwrapTraits; - typedef UnwrapTraits Bound3UnwrapTraits; - typedef UnwrapTraits Bound4UnwrapTraits; - typedef UnwrapTraits Bound5UnwrapTraits; - typedef UnwrapTraits Bound6UnwrapTraits; - - BindState(const Runnable& runnable, - const P1& p1, - const P2& p2, - const P3& p3, - const P4& p4, - const P5& p5, - const P6& p6) - : BindStateBase(&Destroy), - runnable_(runnable), - p1_(p1), - p2_(p2), - p3_(p3), - p4_(p4), - p5_(p5), - p6_(p6) { - MaybeRefcount::value, P1>::AddRef(p1_); - } - - ~BindState() { - MaybeRefcount::value, P1>::Release(p1_); - } - - static void Destroy(BindStateBase* self) { - delete static_cast(self); - } - - RunnableType runnable_; - P1 p1_; - P2 p2_; - P3 p3_; - P4 p4_; - P5 p5_; - P6 p6_; -}; - -template -struct BindState - : public BindStateBase { - typedef Runnable RunnableType; - typedef IsWeakMethod::value, P1> IsWeakCall; - typedef Invoker<7, BindState, RunType> InvokerType; - typedef typename InvokerType::UnboundRunType UnboundRunType; - - // Convenience typedefs for bound argument types. - typedef UnwrapTraits Bound1UnwrapTraits; - typedef UnwrapTraits Bound2UnwrapTraits; - typedef UnwrapTraits Bound3UnwrapTraits; - typedef UnwrapTraits Bound4UnwrapTraits; - typedef UnwrapTraits Bound5UnwrapTraits; - typedef UnwrapTraits Bound6UnwrapTraits; - typedef UnwrapTraits Bound7UnwrapTraits; - - BindState(const Runnable& runnable, - const P1& p1, - const P2& p2, - const P3& p3, - const P4& p4, - const P5& p5, - const P6& p6, - const P7& p7) - : BindStateBase(&Destroy), - runnable_(runnable), - p1_(p1), - p2_(p2), - p3_(p3), - p4_(p4), - p5_(p5), - p6_(p6), - p7_(p7) { - MaybeRefcount::value, P1>::AddRef(p1_); - } - - ~BindState() { - MaybeRefcount::value, P1>::Release(p1_); - } - - static void Destroy(BindStateBase* self) { - delete static_cast(self); - } - - RunnableType runnable_; - P1 p1_; - P2 p2_; - P3 p3_; - P4 p4_; - P5 p5_; - P6 p6_; - P7 p7_; -}; - -} // namespace cef_internal -} // namespace base - -#endif // CEF_INCLUDE_BASE_INTERNAL_CEF_BIND_INTERNAL_H_ diff --git a/third_party/cef/include/base/internal/cef_bind_internal_win.h b/third_party/cef/include/base/internal/cef_bind_internal_win.h deleted file mode 100644 index 4a363def..00000000 --- a/third_party/cef/include/base/internal/cef_bind_internal_win.h +++ /dev/null @@ -1,396 +0,0 @@ -// Copyright (c) 2011 Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Do not include this header file directly. Use base/cef_bind.h instead. - -// Specializations of RunnableAdapter<> for Windows specific calling -// conventions. Please see base/bind_internal.h for more info. - -#ifndef CEF_INCLUDE_BASE_INTERNAL_CEF_BIND_INTERNAL_WIN_H_ -#define CEF_INCLUDE_BASE_INTERNAL_CEF_BIND_INTERNAL_WIN_H_ - -// In the x64 architecture in Windows, __fastcall, __stdcall, etc, are all -// the same as __cdecl which would turn the following specializations into -// multiple definitions. -#if !defined(ARCH_CPU_X86_64) - -namespace base { -namespace cef_internal { - -template -class RunnableAdapter; - -// __stdcall Function: Arity 0. -template -class RunnableAdapter { - public: - typedef R(RunType)(); - - explicit RunnableAdapter(R(__stdcall* function)()) : function_(function) {} - - R Run() { return function_(); } - - private: - R(__stdcall* function_)(); -}; - -// __fastcall Function: Arity 0. -template -class RunnableAdapter { - public: - typedef R(RunType)(); - - explicit RunnableAdapter(R(__fastcall* function)()) : function_(function) {} - - R Run() { return function_(); } - - private: - R(__fastcall* function_)(); -}; - -// __stdcall Function: Arity 1. -template -class RunnableAdapter { - public: - typedef R(RunType)(A1); - - explicit RunnableAdapter(R(__stdcall* function)(A1)) : function_(function) {} - - R Run(typename CallbackParamTraits::ForwardType a1) { - return function_(a1); - } - - private: - R(__stdcall* function_)(A1); -}; - -// __fastcall Function: Arity 1. -template -class RunnableAdapter { - public: - typedef R(RunType)(A1); - - explicit RunnableAdapter(R(__fastcall* function)(A1)) : function_(function) {} - - R Run(typename CallbackParamTraits::ForwardType a1) { - return function_(a1); - } - - private: - R(__fastcall* function_)(A1); -}; - -// __stdcall Function: Arity 2. -template -class RunnableAdapter { - public: - typedef R(RunType)(A1, A2); - - explicit RunnableAdapter(R(__stdcall* function)(A1, A2)) - : function_(function) {} - - R Run(typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2) { - return function_(a1, a2); - } - - private: - R(__stdcall* function_)(A1, A2); -}; - -// __fastcall Function: Arity 2. -template -class RunnableAdapter { - public: - typedef R(RunType)(A1, A2); - - explicit RunnableAdapter(R(__fastcall* function)(A1, A2)) - : function_(function) {} - - R Run(typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2) { - return function_(a1, a2); - } - - private: - R(__fastcall* function_)(A1, A2); -}; - -// __stdcall Function: Arity 3. -template -class RunnableAdapter { - public: - typedef R(RunType)(A1, A2, A3); - - explicit RunnableAdapter(R(__stdcall* function)(A1, A2, A3)) - : function_(function) {} - - R Run(typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3) { - return function_(a1, a2, a3); - } - - private: - R(__stdcall* function_)(A1, A2, A3); -}; - -// __fastcall Function: Arity 3. -template -class RunnableAdapter { - public: - typedef R(RunType)(A1, A2, A3); - - explicit RunnableAdapter(R(__fastcall* function)(A1, A2, A3)) - : function_(function) {} - - R Run(typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3) { - return function_(a1, a2, a3); - } - - private: - R(__fastcall* function_)(A1, A2, A3); -}; - -// __stdcall Function: Arity 4. -template -class RunnableAdapter { - public: - typedef R(RunType)(A1, A2, A3, A4); - - explicit RunnableAdapter(R(__stdcall* function)(A1, A2, A3, A4)) - : function_(function) {} - - R Run(typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3, - typename CallbackParamTraits::ForwardType a4) { - return function_(a1, a2, a3, a4); - } - - private: - R(__stdcall* function_)(A1, A2, A3, A4); -}; - -// __fastcall Function: Arity 4. -template -class RunnableAdapter { - public: - typedef R(RunType)(A1, A2, A3, A4); - - explicit RunnableAdapter(R(__fastcall* function)(A1, A2, A3, A4)) - : function_(function) {} - - R Run(typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3, - typename CallbackParamTraits::ForwardType a4) { - return function_(a1, a2, a3, a4); - } - - private: - R(__fastcall* function_)(A1, A2, A3, A4); -}; - -// __stdcall Function: Arity 5. -template -class RunnableAdapter { - public: - typedef R(RunType)(A1, A2, A3, A4, A5); - - explicit RunnableAdapter(R(__stdcall* function)(A1, A2, A3, A4, A5)) - : function_(function) {} - - R Run(typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3, - typename CallbackParamTraits::ForwardType a4, - typename CallbackParamTraits::ForwardType a5) { - return function_(a1, a2, a3, a4, a5); - } - - private: - R(__stdcall* function_)(A1, A2, A3, A4, A5); -}; - -// __fastcall Function: Arity 5. -template -class RunnableAdapter { - public: - typedef R(RunType)(A1, A2, A3, A4, A5); - - explicit RunnableAdapter(R(__fastcall* function)(A1, A2, A3, A4, A5)) - : function_(function) {} - - R Run(typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3, - typename CallbackParamTraits::ForwardType a4, - typename CallbackParamTraits::ForwardType a5) { - return function_(a1, a2, a3, a4, a5); - } - - private: - R(__fastcall* function_)(A1, A2, A3, A4, A5); -}; - -// __stdcall Function: Arity 6. -template -class RunnableAdapter { - public: - typedef R(RunType)(A1, A2, A3, A4, A5, A6); - - explicit RunnableAdapter(R(__stdcall* function)(A1, A2, A3, A4, A5, A6)) - : function_(function) {} - - R Run(typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3, - typename CallbackParamTraits::ForwardType a4, - typename CallbackParamTraits::ForwardType a5, - typename CallbackParamTraits::ForwardType a6) { - return function_(a1, a2, a3, a4, a5, a6); - } - - private: - R(__stdcall* function_)(A1, A2, A3, A4, A5, A6); -}; - -// __fastcall Function: Arity 6. -template -class RunnableAdapter { - public: - typedef R(RunType)(A1, A2, A3, A4, A5, A6); - - explicit RunnableAdapter(R(__fastcall* function)(A1, A2, A3, A4, A5, A6)) - : function_(function) {} - - R Run(typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3, - typename CallbackParamTraits::ForwardType a4, - typename CallbackParamTraits::ForwardType a5, - typename CallbackParamTraits::ForwardType a6) { - return function_(a1, a2, a3, a4, a5, a6); - } - - private: - R(__fastcall* function_)(A1, A2, A3, A4, A5, A6); -}; - -// __stdcall Function: Arity 7. -template -class RunnableAdapter { - public: - typedef R(RunType)(A1, A2, A3, A4, A5, A6, A7); - - explicit RunnableAdapter(R(__stdcall* function)(A1, A2, A3, A4, A5, A6, A7)) - : function_(function) {} - - R Run(typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3, - typename CallbackParamTraits::ForwardType a4, - typename CallbackParamTraits::ForwardType a5, - typename CallbackParamTraits::ForwardType a6, - typename CallbackParamTraits::ForwardType a7) { - return function_(a1, a2, a3, a4, a5, a6, a7); - } - - private: - R(__stdcall* function_)(A1, A2, A3, A4, A5, A6, A7); -}; - -// __fastcall Function: Arity 7. -template -class RunnableAdapter { - public: - typedef R(RunType)(A1, A2, A3, A4, A5, A6, A7); - - explicit RunnableAdapter(R(__fastcall* function)(A1, A2, A3, A4, A5, A6, A7)) - : function_(function) {} - - R Run(typename CallbackParamTraits::ForwardType a1, - typename CallbackParamTraits::ForwardType a2, - typename CallbackParamTraits::ForwardType a3, - typename CallbackParamTraits::ForwardType a4, - typename CallbackParamTraits::ForwardType a5, - typename CallbackParamTraits::ForwardType a6, - typename CallbackParamTraits::ForwardType a7) { - return function_(a1, a2, a3, a4, a5, a6, a7); - } - - private: - R(__fastcall* function_)(A1, A2, A3, A4, A5, A6, A7); -}; - -} // namespace cef_internal -} // namespace base - -#endif // !defined(ARCH_CPU_X86_64) - -#endif // CEF_INCLUDE_BASE_INTERNAL_CEF_BIND_INTERNAL_WIN_H_ diff --git a/third_party/cef/include/base/internal/cef_callback_internal.h b/third_party/cef/include/base/internal/cef_callback_internal.h deleted file mode 100644 index 1f2e16c9..00000000 --- a/third_party/cef/include/base/internal/cef_callback_internal.h +++ /dev/null @@ -1,224 +0,0 @@ -// Copyright (c) 2012 Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Do not include this header file directly. Use base/cef_bind.h or -// base/cef_callback.h instead. - -// This file contains utility functions and classes that help the -// implementation, and management of the Callback objects. - -#ifndef CEF_INCLUDE_BASE_INTERNAL_CEF_CALLBACK_INTERNAL_H_ -#define CEF_INCLUDE_BASE_INTERNAL_CEF_CALLBACK_INTERNAL_H_ - -#include - -#include "include/base/cef_atomic_ref_count.h" -#include "include/base/cef_macros.h" -#include "include/base/cef_ref_counted.h" -#include "include/base/cef_scoped_ptr.h" -#include "include/base/cef_template_util.h" - -template -class ScopedVector; - -namespace base { -namespace cef_internal { -class CallbackBase; - -// At the base level, the only task is to add reference counting data. Don't use -// RefCountedThreadSafe since it requires the destructor to be a virtual method. -// Creating a vtable for every BindState template instantiation results in a lot -// of bloat. Its only task is to call the destructor which can be done with a -// function pointer. -class BindStateBase { - protected: - explicit BindStateBase(void (*destructor)(BindStateBase*)) - : ref_count_(0), destructor_(destructor) {} - ~BindStateBase() {} - - private: - friend class scoped_refptr; - friend class CallbackBase; - - void AddRef(); - void Release(); - - AtomicRefCount ref_count_; - - // Pointer to a function that will properly destroy |this|. - void (*destructor_)(BindStateBase*); - - DISALLOW_COPY_AND_ASSIGN(BindStateBase); -}; - -// Holds the Callback methods that don't require specialization to reduce -// template bloat. -class CallbackBase { - public: - // Returns true if Callback is null (doesn't refer to anything). - bool is_null() const { return bind_state_.get() == NULL; } - - // Returns the Callback into an uninitialized state. - void Reset(); - - protected: - // In C++, it is safe to cast function pointers to function pointers of - // another type. It is not okay to use void*. We create a InvokeFuncStorage - // that that can store our function pointer, and then cast it back to - // the original type on usage. - typedef void (*InvokeFuncStorage)(void); - - // Returns true if this callback equals |other|. |other| may be null. - bool Equals(const CallbackBase& other) const; - - // Allow initializing of |bind_state_| via the constructor to avoid default - // initialization of the scoped_refptr. We do not also initialize - // |polymorphic_invoke_| here because doing a normal assignment in the - // derived Callback templates makes for much nicer compiler errors. - explicit CallbackBase(BindStateBase* bind_state); - - // Force the destructor to be instantiated inside this translation unit so - // that our subclasses will not get inlined versions. Avoids more template - // bloat. - ~CallbackBase(); - - scoped_refptr bind_state_; - InvokeFuncStorage polymorphic_invoke_; -}; - -// A helper template to determine if given type is non-const move-only-type, -// i.e. if a value of the given type should be passed via .Pass() in a -// destructive way. -template -struct IsMoveOnlyType { - template - static YesType Test(const typename U::MoveOnlyTypeForCPP03*); - - template - static NoType Test(...); - - static const bool value = - sizeof(Test(0)) == sizeof(YesType) && !is_const::value; -}; - -// This is a typetraits object that's used to take an argument type, and -// extract a suitable type for storing and forwarding arguments. -// -// In particular, it strips off references, and converts arrays to -// pointers for storage; and it avoids accidentally trying to create a -// "reference of a reference" if the argument is a reference type. -// -// This array type becomes an issue for storage because we are passing bound -// parameters by const reference. In this case, we end up passing an actual -// array type in the initializer list which C++ does not allow. This will -// break passing of C-string literals. -template ::value> -struct CallbackParamTraits { - typedef const T& ForwardType; - typedef T StorageType; -}; - -// The Storage should almost be impossible to trigger unless someone manually -// specifies type of the bind parameters. However, in case they do, -// this will guard against us accidentally storing a reference parameter. -// -// The ForwardType should only be used for unbound arguments. -template -struct CallbackParamTraits { - typedef T& ForwardType; - typedef T StorageType; -}; - -// Note that for array types, we implicitly add a const in the conversion. This -// means that it is not possible to bind array arguments to functions that take -// a non-const pointer. Trying to specialize the template based on a "const -// T[n]" does not seem to match correctly, so we are stuck with this -// restriction. -template -struct CallbackParamTraits { - typedef const T* ForwardType; - typedef const T* StorageType; -}; - -// See comment for CallbackParamTraits. -template -struct CallbackParamTraits { - typedef const T* ForwardType; - typedef const T* StorageType; -}; - -// Parameter traits for movable-but-not-copyable scopers. -// -// Callback<>/Bind() understands movable-but-not-copyable semantics where -// the type cannot be copied but can still have its state destructively -// transferred (aka. moved) to another instance of the same type by calling a -// helper function. When used with Bind(), this signifies transferal of the -// object's state to the target function. -// -// For these types, the ForwardType must not be a const reference, or a -// reference. A const reference is inappropriate, and would break const -// correctness, because we are implementing a destructive move. A non-const -// reference cannot be used with temporaries which means the result of a -// function or a cast would not be usable with Callback<> or Bind(). -template -struct CallbackParamTraits { - typedef T ForwardType; - typedef T StorageType; -}; - -// CallbackForward() is a very limited simulation of C++11's std::forward() -// used by the Callback/Bind system for a set of movable-but-not-copyable -// types. It is needed because forwarding a movable-but-not-copyable -// argument to another function requires us to invoke the proper move -// operator to create a rvalue version of the type. The supported types are -// whitelisted below as overloads of the CallbackForward() function. The -// default template compiles out to be a no-op. -// -// In C++11, std::forward would replace all uses of this function. However, it -// is impossible to implement a general std::forward with C++11 due to a lack -// of rvalue references. -// -// In addition to Callback/Bind, this is used by PostTaskAndReplyWithResult to -// simulate std::forward() and forward the result of one Callback as a -// parameter to another callback. This is to support Callbacks that return -// the movable-but-not-copyable types whitelisted above. -template -typename enable_if::value, T>::type& CallbackForward(T& t) { - return t; -} - -template -typename enable_if::value, T>::type CallbackForward(T& t) { - return t.Pass(); -} - -} // namespace cef_internal -} // namespace base - -#endif // CEF_INCLUDE_BASE_INTERNAL_CEF_CALLBACK_INTERNAL_H_ diff --git a/third_party/cef/include/base/internal/cef_lock_impl.h b/third_party/cef/include/base/internal/cef_lock_impl.h deleted file mode 100644 index 470547fe..00000000 --- a/third_party/cef/include/base/internal/cef_lock_impl.h +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 2011 Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Do not include this header file directly. Use base/cef_lock.h instead. - -#ifndef CEF_INCLUDE_BASE_INTERNAL_CEF_LOCK_IMPL_H_ -#define CEF_INCLUDE_BASE_INTERNAL_CEF_LOCK_IMPL_H_ - -#include "include/base/cef_build.h" - -#if defined(OS_WIN) -#include -#elif defined(OS_POSIX) -#include -#endif - -#include "include/base/cef_macros.h" - -namespace base { -namespace cef_internal { - -// This class implements the underlying platform-specific spin-lock mechanism -// used for the Lock class. Most users should not use LockImpl directly, but -// should instead use Lock. -class LockImpl { - public: -#if defined(OS_WIN) - typedef CRITICAL_SECTION NativeHandle; -#elif defined(OS_POSIX) - typedef pthread_mutex_t NativeHandle; -#endif - - LockImpl(); - ~LockImpl(); - - // If the lock is not held, take it and return true. If the lock is already - // held by something else, immediately return false. - bool Try(); - - // Take the lock, blocking until it is available if necessary. - void Lock(); - - // Release the lock. This must only be called by the lock's holder: after - // a successful call to Try, or a call to Lock. - void Unlock(); - - // Return the native underlying lock. - // TODO(awalker): refactor lock and condition variables so that this is - // unnecessary. - NativeHandle* native_handle() { return &native_handle_; } - - private: - NativeHandle native_handle_; - - DISALLOW_COPY_AND_ASSIGN(LockImpl); -}; - -} // namespace cef_internal -} // namespace base - -#endif // CEF_INCLUDE_BASE_INTERNAL_CEF_LOCK_IMPL_H_ diff --git a/third_party/cef/include/base/internal/cef_raw_scoped_refptr_mismatch_checker.h b/third_party/cef/include/base/internal/cef_raw_scoped_refptr_mismatch_checker.h deleted file mode 100644 index 9f2f932f..00000000 --- a/third_party/cef/include/base/internal/cef_raw_scoped_refptr_mismatch_checker.h +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) 2011 Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Do not include this header file directly. Use base/cef_callback.h instead. - -#ifndef CEF_INCLUDE_BASE_INTERNAL_CEF_RAW_SCOPED_REFPTR_MISMATCH_CHECKER_H_ -#define CEF_INCLUDE_BASE_INTERNAL_CEF_RAW_SCOPED_REFPTR_MISMATCH_CHECKER_H_ - -#include "include/base/cef_build.h" -#include "include/base/cef_ref_counted.h" -#include "include/base/cef_template_util.h" -#include "include/base/cef_tuple.h" - -// It is dangerous to post a task with a T* argument where T is a subtype of -// RefCounted(Base|ThreadSafeBase), since by the time the parameter is used, the -// object may already have been deleted since it was not held with a -// scoped_refptr. Example: http://crbug.com/27191 -// The following set of traits are designed to generate a compile error -// whenever this antipattern is attempted. - -namespace base { - -namespace cef_internal { - -template -struct NeedsScopedRefptrButGetsRawPtr { -#if defined(OS_WIN) - enum { value = base::false_type::value }; -#else - enum { - // Human readable translation: you needed to be a scoped_refptr if you are a - // raw pointer type and are convertible to a RefCounted(Base|ThreadSafeBase) - // type. - value = (is_pointer::value && - (is_convertible::value || - is_convertible::value)) - }; -#endif -}; - -template -struct ParamsUseScopedRefptrCorrectly { - enum { value = 0 }; -}; - -template <> -struct ParamsUseScopedRefptrCorrectly { - enum { value = 1 }; -}; - -template -struct ParamsUseScopedRefptrCorrectly> { - enum { value = !NeedsScopedRefptrButGetsRawPtr::value }; -}; - -template -struct ParamsUseScopedRefptrCorrectly> { - enum { - value = !(NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value) - }; -}; - -template -struct ParamsUseScopedRefptrCorrectly> { - enum { - value = !(NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value) - }; -}; - -template -struct ParamsUseScopedRefptrCorrectly> { - enum { - value = !(NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value) - }; -}; - -template -struct ParamsUseScopedRefptrCorrectly> { - enum { - value = !(NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value) - }; -}; - -template -struct ParamsUseScopedRefptrCorrectly> { - enum { - value = !(NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value) - }; -}; - -template -struct ParamsUseScopedRefptrCorrectly> { - enum { - value = !(NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value) - }; -}; - -template -struct ParamsUseScopedRefptrCorrectly> { - enum { - value = !(NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value || - NeedsScopedRefptrButGetsRawPtr::value) - }; -}; - -} // namespace cef_internal - -} // namespace base - -#endif // CEF_INCLUDE_BASE_INTERNAL_CEF_RAW_SCOPED_REFPTR_MISMATCH_CHECKER_H_ diff --git a/third_party/cef/include/base/internal/cef_thread_checker_impl.h b/third_party/cef/include/base/internal/cef_thread_checker_impl.h deleted file mode 100644 index 26546981..00000000 --- a/third_party/cef/include/base/internal/cef_thread_checker_impl.h +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) 2011 Google Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Do not include this header file directly. Use base/cef_thread_checker.h -// instead. - -#ifndef CEF_INCLUDE_BASE_INTERNAL_THREAD_CHECKER_IMPL_H_ -#define CEF_INCLUDE_BASE_INTERNAL_THREAD_CHECKER_IMPL_H_ - -#include "include/base/cef_lock.h" -#include "include/base/cef_platform_thread.h" - -namespace base { -namespace cef_internal { - -// Real implementation of ThreadChecker, for use in debug mode, or -// for temporary use in release mode (e.g. to CHECK on a threading issue -// seen only in the wild). -// -// Note: You should almost always use the ThreadChecker class to get the -// right version for your build configuration. -class ThreadCheckerImpl { - public: - ThreadCheckerImpl(); - ~ThreadCheckerImpl(); - - bool CalledOnValidThread() const; - - // Changes the thread that is checked for in CalledOnValidThread. This may - // be useful when an object may be created on one thread and then used - // exclusively on another thread. - void DetachFromThread(); - - private: - void EnsureThreadIdAssigned() const; - - mutable base::Lock lock_; - // This is mutable so that CalledOnValidThread can set it. - // It's guarded by |lock_|. - mutable PlatformThreadRef valid_thread_id_; -}; - -} // namespace cef_internal -} // namespace base - -#endif // CEF_INCLUDE_BASE_INTERNAL_THREAD_CHECKER_IMPL_H_ diff --git a/third_party/cef/include/capi/cef_accessibility_handler_capi.h b/third_party/cef/include/capi/cef_accessibility_handler_capi.h deleted file mode 100644 index 696cc09a..00000000 --- a/third_party/cef/include/capi/cef_accessibility_handler_capi.h +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// -// $hash=3e20b926af7550a1dc4000bfdf261332222a64b8$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_ACCESSIBILITY_HANDLER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_ACCESSIBILITY_HANDLER_CAPI_H_ -#pragma once - -#include "include/capi/cef_values_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// -// Implement this structure to receive accessibility notification when -// accessibility events have been registered. The functions of this structure -// will be called on the UI thread. -/// -typedef struct _cef_accessibility_handler_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Called after renderer process sends accessibility tree changes to the - // browser process. - /// - void(CEF_CALLBACK* on_accessibility_tree_change)( - struct _cef_accessibility_handler_t* self, - struct _cef_value_t* value); - - /// - // Called after renderer process sends accessibility location changes to the - // browser process. - /// - void(CEF_CALLBACK* on_accessibility_location_change)( - struct _cef_accessibility_handler_t* self, - struct _cef_value_t* value); -} cef_accessibility_handler_t; - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_ACCESSIBILITY_HANDLER_CAPI_H_ diff --git a/third_party/cef/include/capi/cef_app_capi.h b/third_party/cef/include/capi/cef_app_capi.h deleted file mode 100644 index 05e7aa97..00000000 --- a/third_party/cef/include/capi/cef_app_capi.h +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// -// $hash=ca069c86d9b09fb6f939ce72682e15ce95571ead$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_ -#pragma once - -#include "include/capi/cef_base_capi.h" -#include "include/capi/cef_browser_process_handler_capi.h" -#include "include/capi/cef_command_line_capi.h" -#include "include/capi/cef_render_process_handler_capi.h" -#include "include/capi/cef_resource_bundle_handler_capi.h" -#include "include/capi/cef_scheme_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct _cef_app_t; - -/// -// Implement this structure to provide handler implementations. Methods will be -// called by the process and/or thread indicated. -/// -typedef struct _cef_app_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Provides an opportunity to view and/or modify command-line arguments before - // processing by CEF and Chromium. The |process_type| value will be NULL for - // the browser process. Do not keep a reference to the cef_command_line_t - // object passed to this function. The CefSettings.command_line_args_disabled - // value can be used to start with an NULL command-line object. Any values - // specified in CefSettings that equate to command-line arguments will be set - // before this function is called. Be cautious when using this function to - // modify command-line arguments for non-browser processes as this may result - // in undefined behavior including crashes. - /// - void(CEF_CALLBACK* on_before_command_line_processing)( - struct _cef_app_t* self, - const cef_string_t* process_type, - struct _cef_command_line_t* command_line); - - /// - // Provides an opportunity to register custom schemes. Do not keep a reference - // to the |registrar| object. This function is called on the main thread for - // each process and the registered schemes should be the same across all - // processes. - /// - void(CEF_CALLBACK* on_register_custom_schemes)( - struct _cef_app_t* self, - struct _cef_scheme_registrar_t* registrar); - - /// - // Return the handler for resource bundle events. If - // CefSettings.pack_loading_disabled is true (1) a handler must be returned. - // If no handler is returned resources will be loaded from pack files. This - // function is called by the browser and render processes on multiple threads. - /// - struct _cef_resource_bundle_handler_t*( - CEF_CALLBACK* get_resource_bundle_handler)(struct _cef_app_t* self); - - /// - // Return the handler for functionality specific to the browser process. This - // function is called on multiple threads in the browser process. - /// - struct _cef_browser_process_handler_t*( - CEF_CALLBACK* get_browser_process_handler)(struct _cef_app_t* self); - - /// - // Return the handler for functionality specific to the render process. This - // function is called on the render process main thread. - /// - struct _cef_render_process_handler_t*( - CEF_CALLBACK* get_render_process_handler)(struct _cef_app_t* self); -} cef_app_t; - -/// -// This function should be called from the application entry point function to -// execute a secondary process. It can be used to run secondary processes from -// the browser client executable (default behavior) or from a separate -// executable specified by the CefSettings.browser_subprocess_path value. If -// called for the browser process (identified by no "type" command-line value) -// it will return immediately with a value of -1. If called for a recognized -// secondary process it will block until the process should exit and then return -// the process exit code. The |application| parameter may be NULL. The -// |windows_sandbox_info| parameter is only used on Windows and may be NULL (see -// cef_sandbox_win.h for details). -/// -CEF_EXPORT int cef_execute_process(const struct _cef_main_args_t* args, - cef_app_t* application, - void* windows_sandbox_info); - -/// -// This function should be called on the main application thread to initialize -// the CEF browser process. The |application| parameter may be NULL. A return -// value of true (1) indicates that it succeeded and false (0) indicates that it -// failed. The |windows_sandbox_info| parameter is only used on Windows and may -// be NULL (see cef_sandbox_win.h for details). -/// -CEF_EXPORT int cef_initialize(const struct _cef_main_args_t* args, - const struct _cef_settings_t* settings, - cef_app_t* application, - void* windows_sandbox_info); - -/// -// This function should be called on the main application thread to shut down -// the CEF browser process before the application exits. -/// -CEF_EXPORT void cef_shutdown(); - -/// -// Perform a single iteration of CEF message loop processing. This function is -// provided for cases where the CEF message loop must be integrated into an -// existing application message loop. Use of this function is not recommended -// for most users; use either the cef_run_message_loop() function or -// CefSettings.multi_threaded_message_loop if possible. When using this function -// care must be taken to balance performance against excessive CPU usage. It is -// recommended to enable the CefSettings.external_message_pump option when using -// this function so that -// cef_browser_process_handler_t::on_schedule_message_pump_work() callbacks can -// facilitate the scheduling process. This function should only be called on the -// main application thread and only if cef_initialize() is called with a -// CefSettings.multi_threaded_message_loop value of false (0). This function -// will not block. -/// -CEF_EXPORT void cef_do_message_loop_work(); - -/// -// Run the CEF message loop. Use this function instead of an application- -// provided message loop to get the best balance between performance and CPU -// usage. This function should only be called on the main application thread and -// only if cef_initialize() is called with a -// CefSettings.multi_threaded_message_loop value of false (0). This function -// will block until a quit message is received by the system. -/// -CEF_EXPORT void cef_run_message_loop(); - -/// -// Quit the CEF message loop that was started by calling cef_run_message_loop(). -// This function should only be called on the main application thread and only -// if cef_run_message_loop() was used. -/// -CEF_EXPORT void cef_quit_message_loop(); - -/// -// Set to true (1) before calling Windows APIs like TrackPopupMenu that enter a -// modal message loop. Set to false (0) after exiting the modal message loop. -/// -CEF_EXPORT void cef_set_osmodal_loop(int osModalLoop); - -/// -// Call during process startup to enable High-DPI support on Windows 7 or newer. -// Older versions of Windows should be left DPI-unaware because they do not -// support DirectWrite and GDI fonts are kerned very badly. -/// -CEF_EXPORT void cef_enable_highdpi_support(); - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_ diff --git a/third_party/cef/include/capi/cef_auth_callback_capi.h b/third_party/cef/include/capi/cef_auth_callback_capi.h deleted file mode 100644 index 4a384b49..00000000 --- a/third_party/cef/include/capi/cef_auth_callback_capi.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// -// $hash=899e57614c5810d61b61d182ed823cfbd193b4d4$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_AUTH_CALLBACK_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_AUTH_CALLBACK_CAPI_H_ -#pragma once - -#include "include/capi/cef_base_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// -// Callback structure used for asynchronous continuation of authentication -// requests. -/// -typedef struct _cef_auth_callback_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Continue the authentication request. - /// - void(CEF_CALLBACK* cont)(struct _cef_auth_callback_t* self, - const cef_string_t* username, - const cef_string_t* password); - - /// - // Cancel the authentication request. - /// - void(CEF_CALLBACK* cancel)(struct _cef_auth_callback_t* self); -} cef_auth_callback_t; - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_AUTH_CALLBACK_CAPI_H_ diff --git a/third_party/cef/include/capi/cef_base_capi.h b/third_party/cef/include/capi/cef_base_capi.h deleted file mode 100644 index dbd0b9f3..00000000 --- a/third_party/cef/include/capi/cef_base_capi.h +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#ifndef CEF_INCLUDE_CAPI_CEF_BASE_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_BASE_CAPI_H_ - -#include - -#include "include/internal/cef_export.h" -#include "include/internal/cef_string.h" -#include "include/internal/cef_string_list.h" -#include "include/internal/cef_string_map.h" -#include "include/internal/cef_string_multimap.h" -#include "include/internal/cef_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// -// All ref-counted framework structures must include this structure first. -/// -typedef struct _cef_base_ref_counted_t { - /// - // Size of the data structure. - /// - size_t size; - - /// - // Called to increment the reference count for the object. Should be called - // for every new copy of a pointer to a given object. - /// - void(CEF_CALLBACK* add_ref)(struct _cef_base_ref_counted_t* self); - - /// - // Called to decrement the reference count for the object. If the reference - // count falls to 0 the object should self-delete. Returns true (1) if the - // resulting reference count is 0. - /// - int(CEF_CALLBACK* release)(struct _cef_base_ref_counted_t* self); - - /// - // Returns true (1) if the current reference count is 1. - /// - int(CEF_CALLBACK* has_one_ref)(struct _cef_base_ref_counted_t* self); - - /// - // Returns true (1) if the current reference count is at least 1. - /// - int(CEF_CALLBACK* has_at_least_one_ref)(struct _cef_base_ref_counted_t* self); -} cef_base_ref_counted_t; - -/// -// All scoped framework structures must include this structure first. -/// -typedef struct _cef_base_scoped_t { - /// - // Size of the data structure. - /// - size_t size; - - /// - // Called to delete this object. May be NULL if the object is not owned. - /// - void(CEF_CALLBACK* del)(struct _cef_base_scoped_t* self); - -} cef_base_scoped_t; - -// Check that the structure |s|, which is defined with a size_t member at the -// top, is large enough to contain the specified member |f|. -#define CEF_MEMBER_EXISTS(s, f) \ - ((intptr_t) & \ - ((s)->f) - (intptr_t)(s) + sizeof((s)->f) <= *reinterpret_cast(s)) - -#define CEF_MEMBER_MISSING(s, f) (!CEF_MEMBER_EXISTS(s, f) || !((s)->f)) - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_BASE_CAPI_H_ diff --git a/third_party/cef/include/capi/cef_browser_capi.h b/third_party/cef/include/capi/cef_browser_capi.h deleted file mode 100644 index e8a8d8df..00000000 --- a/third_party/cef/include/capi/cef_browser_capi.h +++ /dev/null @@ -1,872 +0,0 @@ -// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// -// $hash=ff3ebc51ed5743aabac0be94caf2edeedbd413b7$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ -#pragma once - -#include "include/capi/cef_base_capi.h" -#include "include/capi/cef_drag_data_capi.h" -#include "include/capi/cef_frame_capi.h" -#include "include/capi/cef_image_capi.h" -#include "include/capi/cef_navigation_entry_capi.h" -#include "include/capi/cef_process_message_capi.h" -#include "include/capi/cef_request_context_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct _cef_browser_host_t; -struct _cef_client_t; - -/// -// Structure used to represent a browser window. When used in the browser -// process the functions of this structure may be called on any thread unless -// otherwise indicated in the comments. When used in the render process the -// functions of this structure may only be called on the main thread. -/// -typedef struct _cef_browser_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Returns the browser host object. This function can only be called in the - // browser process. - /// - struct _cef_browser_host_t*(CEF_CALLBACK* get_host)( - struct _cef_browser_t* self); - - /// - // Returns true (1) if the browser can navigate backwards. - /// - int(CEF_CALLBACK* can_go_back)(struct _cef_browser_t* self); - - /// - // Navigate backwards. - /// - void(CEF_CALLBACK* go_back)(struct _cef_browser_t* self); - - /// - // Returns true (1) if the browser can navigate forwards. - /// - int(CEF_CALLBACK* can_go_forward)(struct _cef_browser_t* self); - - /// - // Navigate forwards. - /// - void(CEF_CALLBACK* go_forward)(struct _cef_browser_t* self); - - /// - // Returns true (1) if the browser is currently loading. - /// - int(CEF_CALLBACK* is_loading)(struct _cef_browser_t* self); - - /// - // Reload the current page. - /// - void(CEF_CALLBACK* reload)(struct _cef_browser_t* self); - - /// - // Reload the current page ignoring any cached data. - /// - void(CEF_CALLBACK* reload_ignore_cache)(struct _cef_browser_t* self); - - /// - // Stop loading the page. - /// - void(CEF_CALLBACK* stop_load)(struct _cef_browser_t* self); - - /// - // Returns the globally unique identifier for this browser. This value is also - // used as the tabId for extension APIs. - /// - int(CEF_CALLBACK* get_identifier)(struct _cef_browser_t* self); - - /// - // Returns true (1) if this object is pointing to the same handle as |that| - // object. - /// - int(CEF_CALLBACK* is_same)(struct _cef_browser_t* self, - struct _cef_browser_t* that); - - /// - // Returns true (1) if the window is a popup window. - /// - int(CEF_CALLBACK* is_popup)(struct _cef_browser_t* self); - - /// - // Returns true (1) if a document has been loaded in the browser. - /// - int(CEF_CALLBACK* has_document)(struct _cef_browser_t* self); - - /// - // Returns the main (top-level) frame for the browser window. - /// - struct _cef_frame_t*(CEF_CALLBACK* get_main_frame)( - struct _cef_browser_t* self); - - /// - // Returns the focused frame for the browser window. - /// - struct _cef_frame_t*(CEF_CALLBACK* get_focused_frame)( - struct _cef_browser_t* self); - - /// - // Returns the frame with the specified identifier, or NULL if not found. - /// - struct _cef_frame_t*(CEF_CALLBACK* get_frame_byident)( - struct _cef_browser_t* self, - int64 identifier); - - /// - // Returns the frame with the specified name, or NULL if not found. - /// - struct _cef_frame_t*(CEF_CALLBACK* get_frame)(struct _cef_browser_t* self, - const cef_string_t* name); - - /// - // Returns the number of frames that currently exist. - /// - size_t(CEF_CALLBACK* get_frame_count)(struct _cef_browser_t* self); - - /// - // Returns the identifiers of all existing frames. - /// - void(CEF_CALLBACK* get_frame_identifiers)(struct _cef_browser_t* self, - size_t* identifiersCount, - int64* identifiers); - - /// - // Returns the names of all existing frames. - /// - void(CEF_CALLBACK* get_frame_names)(struct _cef_browser_t* self, - cef_string_list_t names); - - /// - // Send a message to the specified |target_process|. Returns true (1) if the - // message was sent successfully. - /// - int(CEF_CALLBACK* send_process_message)( - struct _cef_browser_t* self, - cef_process_id_t target_process, - struct _cef_process_message_t* message); -} cef_browser_t; - -/// -// Callback structure for cef_browser_host_t::RunFileDialog. The functions of -// this structure will be called on the browser process UI thread. -/// -typedef struct _cef_run_file_dialog_callback_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Called asynchronously after the file dialog is dismissed. - // |selected_accept_filter| is the 0-based index of the value selected from - // the accept filters array passed to cef_browser_host_t::RunFileDialog. - // |file_paths| will be a single value or a list of values depending on the - // dialog mode. If the selection was cancelled |file_paths| will be NULL. - /// - void(CEF_CALLBACK* on_file_dialog_dismissed)( - struct _cef_run_file_dialog_callback_t* self, - int selected_accept_filter, - cef_string_list_t file_paths); -} cef_run_file_dialog_callback_t; - -/// -// Callback structure for cef_browser_host_t::GetNavigationEntries. The -// functions of this structure will be called on the browser process UI thread. -/// -typedef struct _cef_navigation_entry_visitor_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Method that will be executed. Do not keep a reference to |entry| outside of - // this callback. Return true (1) to continue visiting entries or false (0) to - // stop. |current| is true (1) if this entry is the currently loaded - // navigation entry. |index| is the 0-based index of this entry and |total| is - // the total number of entries. - /// - int(CEF_CALLBACK* visit)(struct _cef_navigation_entry_visitor_t* self, - struct _cef_navigation_entry_t* entry, - int current, - int index, - int total); -} cef_navigation_entry_visitor_t; - -/// -// Callback structure for cef_browser_host_t::PrintToPDF. The functions of this -// structure will be called on the browser process UI thread. -/// -typedef struct _cef_pdf_print_callback_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Method that will be executed when the PDF printing has completed. |path| is - // the output path. |ok| will be true (1) if the printing completed - // successfully or false (0) otherwise. - /// - void(CEF_CALLBACK* on_pdf_print_finished)( - struct _cef_pdf_print_callback_t* self, - const cef_string_t* path, - int ok); -} cef_pdf_print_callback_t; - -/// -// Callback structure for cef_browser_host_t::DownloadImage. The functions of -// this structure will be called on the browser process UI thread. -/// -typedef struct _cef_download_image_callback_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Method that will be executed when the image download has completed. - // |image_url| is the URL that was downloaded and |http_status_code| is the - // resulting HTTP status code. |image| is the resulting image, possibly at - // multiple scale factors, or NULL if the download failed. - /// - void(CEF_CALLBACK* on_download_image_finished)( - struct _cef_download_image_callback_t* self, - const cef_string_t* image_url, - int http_status_code, - struct _cef_image_t* image); -} cef_download_image_callback_t; - -/// -// Structure used to represent the browser process aspects of a browser window. -// The functions of this structure can only be called in the browser process. -// They may be called on any thread in that process unless otherwise indicated -// in the comments. -/// -typedef struct _cef_browser_host_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Returns the hosted browser object. - /// - struct _cef_browser_t*(CEF_CALLBACK* get_browser)( - struct _cef_browser_host_t* self); - - /// - // Request that the browser close. The JavaScript 'onbeforeunload' event will - // be fired. If |force_close| is false (0) the event handler, if any, will be - // allowed to prompt the user and the user can optionally cancel the close. If - // |force_close| is true (1) the prompt will not be displayed and the close - // will proceed. Results in a call to cef_life_span_handler_t::do_close() if - // the event handler allows the close or if |force_close| is true (1). See - // cef_life_span_handler_t::do_close() documentation for additional usage - // information. - /// - void(CEF_CALLBACK* close_browser)(struct _cef_browser_host_t* self, - int force_close); - - /// - // Helper for closing a browser. Call this function from the top-level window - // close handler. Internally this calls CloseBrowser(false (0)) if the close - // has not yet been initiated. This function returns false (0) while the close - // is pending and true (1) after the close has completed. See close_browser() - // and cef_life_span_handler_t::do_close() documentation for additional usage - // information. This function must be called on the browser process UI thread. - /// - int(CEF_CALLBACK* try_close_browser)(struct _cef_browser_host_t* self); - - /// - // Set whether the browser is focused. - /// - void(CEF_CALLBACK* set_focus)(struct _cef_browser_host_t* self, int focus); - - /// - // Retrieve the window handle for this browser. If this browser is wrapped in - // a cef_browser_view_t this function should be called on the browser process - // UI thread and it will return the handle for the top-level native window. - /// - cef_window_handle_t(CEF_CALLBACK* get_window_handle)( - struct _cef_browser_host_t* self); - - /// - // Retrieve the window handle of the browser that opened this browser. Will - // return NULL for non-popup windows or if this browser is wrapped in a - // cef_browser_view_t. This function can be used in combination with custom - // handling of modal windows. - /// - cef_window_handle_t(CEF_CALLBACK* get_opener_window_handle)( - struct _cef_browser_host_t* self); - - /// - // Returns true (1) if this browser is wrapped in a cef_browser_view_t. - /// - int(CEF_CALLBACK* has_view)(struct _cef_browser_host_t* self); - - /// - // Returns the client for this browser. - /// - struct _cef_client_t*(CEF_CALLBACK* get_client)( - struct _cef_browser_host_t* self); - - /// - // Returns the request context for this browser. - /// - struct _cef_request_context_t*(CEF_CALLBACK* get_request_context)( - struct _cef_browser_host_t* self); - - /// - // Get the current zoom level. The default zoom level is 0.0. This function - // can only be called on the UI thread. - /// - double(CEF_CALLBACK* get_zoom_level)(struct _cef_browser_host_t* self); - - /// - // Change the zoom level to the specified value. Specify 0.0 to reset the zoom - // level. If called on the UI thread the change will be applied immediately. - // Otherwise, the change will be applied asynchronously on the UI thread. - /// - void(CEF_CALLBACK* set_zoom_level)(struct _cef_browser_host_t* self, - double zoomLevel); - - /// - // Call to run a file chooser dialog. Only a single file chooser dialog may be - // pending at any given time. |mode| represents the type of dialog to display. - // |title| to the title to be used for the dialog and may be NULL to show the - // default title ("Open" or "Save" depending on the mode). |default_file_path| - // is the path with optional directory and/or file name component that will be - // initially selected in the dialog. |accept_filters| are used to restrict the - // selectable file types and may any combination of (a) valid lower-cased MIME - // types (e.g. "text/*" or "image/*"), (b) individual file extensions (e.g. - // ".txt" or ".png"), or (c) combined description and file extension delimited - // using "|" and ";" (e.g. "Image Types|.png;.gif;.jpg"). - // |selected_accept_filter| is the 0-based index of the filter that will be - // selected by default. |callback| will be executed after the dialog is - // dismissed or immediately if another dialog is already pending. The dialog - // will be initiated asynchronously on the UI thread. - /// - void(CEF_CALLBACK* run_file_dialog)( - struct _cef_browser_host_t* self, - cef_file_dialog_mode_t mode, - const cef_string_t* title, - const cef_string_t* default_file_path, - cef_string_list_t accept_filters, - int selected_accept_filter, - struct _cef_run_file_dialog_callback_t* callback); - - /// - // Download the file at |url| using cef_download_handler_t. - /// - void(CEF_CALLBACK* start_download)(struct _cef_browser_host_t* self, - const cef_string_t* url); - - /// - // Download |image_url| and execute |callback| on completion with the images - // received from the renderer. If |is_favicon| is true (1) then cookies are - // not sent and not accepted during download. Images with density independent - // pixel (DIP) sizes larger than |max_image_size| are filtered out from the - // image results. Versions of the image at different scale factors may be - // downloaded up to the maximum scale factor supported by the system. If there - // are no image results <= |max_image_size| then the smallest image is resized - // to |max_image_size| and is the only result. A |max_image_size| of 0 means - // unlimited. If |bypass_cache| is true (1) then |image_url| is requested from - // the server even if it is present in the browser cache. - /// - void(CEF_CALLBACK* download_image)( - struct _cef_browser_host_t* self, - const cef_string_t* image_url, - int is_favicon, - uint32 max_image_size, - int bypass_cache, - struct _cef_download_image_callback_t* callback); - - /// - // Print the current browser contents. - /// - void(CEF_CALLBACK* print)(struct _cef_browser_host_t* self); - - /// - // Print the current browser contents to the PDF file specified by |path| and - // execute |callback| on completion. The caller is responsible for deleting - // |path| when done. For PDF printing to work on Linux you must implement the - // cef_print_handler_t::GetPdfPaperSize function. - /// - void(CEF_CALLBACK* print_to_pdf)( - struct _cef_browser_host_t* self, - const cef_string_t* path, - const struct _cef_pdf_print_settings_t* settings, - struct _cef_pdf_print_callback_t* callback); - - /// - // Search for |searchText|. |identifier| must be a unique ID and these IDs - // must strictly increase so that newer requests always have greater IDs than - // older requests. If |identifier| is zero or less than the previous ID value - // then it will be automatically assigned a new valid ID. |forward| indicates - // whether to search forward or backward within the page. |matchCase| - // indicates whether the search should be case-sensitive. |findNext| indicates - // whether this is the first request or a follow-up. The cef_find_handler_t - // instance, if any, returned via cef_client_t::GetFindHandler will be called - // to report find results. - /// - void(CEF_CALLBACK* find)(struct _cef_browser_host_t* self, - int identifier, - const cef_string_t* searchText, - int forward, - int matchCase, - int findNext); - - /// - // Cancel all searches that are currently going on. - /// - void(CEF_CALLBACK* stop_finding)(struct _cef_browser_host_t* self, - int clearSelection); - - /// - // Open developer tools (DevTools) in its own browser. The DevTools browser - // will remain associated with this browser. If the DevTools browser is - // already open then it will be focused, in which case the |windowInfo|, - // |client| and |settings| parameters will be ignored. If |inspect_element_at| - // is non-NULL then the element at the specified (x,y) location will be - // inspected. The |windowInfo| parameter will be ignored if this browser is - // wrapped in a cef_browser_view_t. - /// - void(CEF_CALLBACK* show_dev_tools)( - struct _cef_browser_host_t* self, - const struct _cef_window_info_t* windowInfo, - struct _cef_client_t* client, - const struct _cef_browser_settings_t* settings, - const cef_point_t* inspect_element_at); - - /// - // Explicitly close the associated DevTools browser, if any. - /// - void(CEF_CALLBACK* close_dev_tools)(struct _cef_browser_host_t* self); - - /// - // Returns true (1) if this browser currently has an associated DevTools - // browser. Must be called on the browser process UI thread. - /// - int(CEF_CALLBACK* has_dev_tools)(struct _cef_browser_host_t* self); - - /// - // Retrieve a snapshot of current navigation entries as values sent to the - // specified visitor. If |current_only| is true (1) only the current - // navigation entry will be sent, otherwise all navigation entries will be - // sent. - /// - void(CEF_CALLBACK* get_navigation_entries)( - struct _cef_browser_host_t* self, - struct _cef_navigation_entry_visitor_t* visitor, - int current_only); - - /// - // Set whether mouse cursor change is disabled. - /// - void(CEF_CALLBACK* set_mouse_cursor_change_disabled)( - struct _cef_browser_host_t* self, - int disabled); - - /// - // Returns true (1) if mouse cursor change is disabled. - /// - int(CEF_CALLBACK* is_mouse_cursor_change_disabled)( - struct _cef_browser_host_t* self); - - /// - // If a misspelled word is currently selected in an editable node calling this - // function will replace it with the specified |word|. - /// - void(CEF_CALLBACK* replace_misspelling)(struct _cef_browser_host_t* self, - const cef_string_t* word); - - /// - // Add the specified |word| to the spelling dictionary. - /// - void(CEF_CALLBACK* add_word_to_dictionary)(struct _cef_browser_host_t* self, - const cef_string_t* word); - - /// - // Returns true (1) if window rendering is disabled. - /// - int(CEF_CALLBACK* is_window_rendering_disabled)( - struct _cef_browser_host_t* self); - - /// - // Notify the browser that the widget has been resized. The browser will first - // call cef_render_handler_t::GetViewRect to get the new size and then call - // cef_render_handler_t::OnPaint asynchronously with the updated regions. This - // function is only used when window rendering is disabled. - /// - void(CEF_CALLBACK* was_resized)(struct _cef_browser_host_t* self); - - /// - // Notify the browser that it has been hidden or shown. Layouting and - // cef_render_handler_t::OnPaint notification will stop when the browser is - // hidden. This function is only used when window rendering is disabled. - /// - void(CEF_CALLBACK* was_hidden)(struct _cef_browser_host_t* self, int hidden); - - /// - // Send a notification to the browser that the screen info has changed. The - // browser will then call cef_render_handler_t::GetScreenInfo to update the - // screen information with the new values. This simulates moving the webview - // window from one display to another, or changing the properties of the - // current display. This function is only used when window rendering is - // disabled. - /// - void(CEF_CALLBACK* notify_screen_info_changed)( - struct _cef_browser_host_t* self); - - /// - // Invalidate the view. The browser will call cef_render_handler_t::OnPaint - // asynchronously. This function is only used when window rendering is - // disabled. - /// - void(CEF_CALLBACK* invalidate)(struct _cef_browser_host_t* self, - cef_paint_element_type_t type); - - /// - // Send a key event to the browser. - /// - void(CEF_CALLBACK* send_key_event)(struct _cef_browser_host_t* self, - const struct _cef_key_event_t* event); - - /// - // Send a mouse click event to the browser. The |x| and |y| coordinates are - // relative to the upper-left corner of the view. - /// - void(CEF_CALLBACK* send_mouse_click_event)( - struct _cef_browser_host_t* self, - const struct _cef_mouse_event_t* event, - cef_mouse_button_type_t type, - int mouseUp, - int clickCount); - - /// - // Send a mouse move event to the browser. The |x| and |y| coordinates are - // relative to the upper-left corner of the view. - /// - void(CEF_CALLBACK* send_mouse_move_event)( - struct _cef_browser_host_t* self, - const struct _cef_mouse_event_t* event, - int mouseLeave); - - /// - // Send a mouse wheel event to the browser. The |x| and |y| coordinates are - // relative to the upper-left corner of the view. The |deltaX| and |deltaY| - // values represent the movement delta in the X and Y directions respectively. - // In order to scroll inside select popups with window rendering disabled - // cef_render_handler_t::GetScreenPoint should be implemented properly. - /// - void(CEF_CALLBACK* send_mouse_wheel_event)( - struct _cef_browser_host_t* self, - const struct _cef_mouse_event_t* event, - int deltaX, - int deltaY); - - /// - // Send a focus event to the browser. - /// - void(CEF_CALLBACK* send_focus_event)(struct _cef_browser_host_t* self, - int setFocus); - - /// - // Send a capture lost event to the browser. - /// - void(CEF_CALLBACK* send_capture_lost_event)(struct _cef_browser_host_t* self); - - /// - // Notify the browser that the window hosting it is about to be moved or - // resized. This function is only used on Windows and Linux. - /// - void(CEF_CALLBACK* notify_move_or_resize_started)( - struct _cef_browser_host_t* self); - - /// - // Returns the maximum rate in frames per second (fps) that - // cef_render_handler_t:: OnPaint will be called for a windowless browser. The - // actual fps may be lower if the browser cannot generate frames at the - // requested rate. The minimum value is 1 and the maximum value is 60 (default - // 30). This function can only be called on the UI thread. - /// - int(CEF_CALLBACK* get_windowless_frame_rate)( - struct _cef_browser_host_t* self); - - /// - // Set the maximum rate in frames per second (fps) that cef_render_handler_t:: - // OnPaint will be called for a windowless browser. The actual fps may be - // lower if the browser cannot generate frames at the requested rate. The - // minimum value is 1 and the maximum value is 60 (default 30). Can also be - // set at browser creation via cef_browser_tSettings.windowless_frame_rate. - /// - void(CEF_CALLBACK* set_windowless_frame_rate)( - struct _cef_browser_host_t* self, - int frame_rate); - - /// - // Begins a new composition or updates the existing composition. Blink has a - // special node (a composition node) that allows the input function to change - // text without affecting other DOM nodes. |text| is the optional text that - // will be inserted into the composition node. |underlines| is an optional set - // of ranges that will be underlined in the resulting text. - // |replacement_range| is an optional range of the existing text that will be - // replaced. |selection_range| is an optional range of the resulting text that - // will be selected after insertion or replacement. The |replacement_range| - // value is only used on OS X. - // - // This function may be called multiple times as the composition changes. When - // the client is done making changes the composition should either be canceled - // or completed. To cancel the composition call ImeCancelComposition. To - // complete the composition call either ImeCommitText or - // ImeFinishComposingText. Completion is usually signaled when: - // A. The client receives a WM_IME_COMPOSITION message with a GCS_RESULTSTR - // flag (on Windows), or; - // B. The client receives a "commit" signal of GtkIMContext (on Linux), or; - // C. insertText of NSTextInput is called (on Mac). - // - // This function is only used when window rendering is disabled. - /// - void(CEF_CALLBACK* ime_set_composition)( - struct _cef_browser_host_t* self, - const cef_string_t* text, - size_t underlinesCount, - cef_composition_underline_t const* underlines, - const cef_range_t* replacement_range, - const cef_range_t* selection_range); - - /// - // Completes the existing composition by optionally inserting the specified - // |text| into the composition node. |replacement_range| is an optional range - // of the existing text that will be replaced. |relative_cursor_pos| is where - // the cursor will be positioned relative to the current cursor position. See - // comments on ImeSetComposition for usage. The |replacement_range| and - // |relative_cursor_pos| values are only used on OS X. This function is only - // used when window rendering is disabled. - /// - void(CEF_CALLBACK* ime_commit_text)(struct _cef_browser_host_t* self, - const cef_string_t* text, - const cef_range_t* replacement_range, - int relative_cursor_pos); - - /// - // Completes the existing composition by applying the current composition node - // contents. If |keep_selection| is false (0) the current selection, if any, - // will be discarded. See comments on ImeSetComposition for usage. This - // function is only used when window rendering is disabled. - /// - void(CEF_CALLBACK* ime_finish_composing_text)( - struct _cef_browser_host_t* self, - int keep_selection); - - /// - // Cancels the existing composition and discards the composition node contents - // without applying them. See comments on ImeSetComposition for usage. This - // function is only used when window rendering is disabled. - /// - void(CEF_CALLBACK* ime_cancel_composition)(struct _cef_browser_host_t* self); - - /// - // Call this function when the user drags the mouse into the web view (before - // calling DragTargetDragOver/DragTargetLeave/DragTargetDrop). |drag_data| - // should not contain file contents as this type of data is not allowed to be - // dragged into the web view. File contents can be removed using - // cef_drag_data_t::ResetFileContents (for example, if |drag_data| comes from - // cef_render_handler_t::StartDragging). This function is only used when - // window rendering is disabled. - /// - void(CEF_CALLBACK* drag_target_drag_enter)( - struct _cef_browser_host_t* self, - struct _cef_drag_data_t* drag_data, - const struct _cef_mouse_event_t* event, - cef_drag_operations_mask_t allowed_ops); - - /// - // Call this function each time the mouse is moved across the web view during - // a drag operation (after calling DragTargetDragEnter and before calling - // DragTargetDragLeave/DragTargetDrop). This function is only used when window - // rendering is disabled. - /// - void(CEF_CALLBACK* drag_target_drag_over)( - struct _cef_browser_host_t* self, - const struct _cef_mouse_event_t* event, - cef_drag_operations_mask_t allowed_ops); - - /// - // Call this function when the user drags the mouse out of the web view (after - // calling DragTargetDragEnter). This function is only used when window - // rendering is disabled. - /// - void(CEF_CALLBACK* drag_target_drag_leave)(struct _cef_browser_host_t* self); - - /// - // Call this function when the user completes the drag operation by dropping - // the object onto the web view (after calling DragTargetDragEnter). The - // object being dropped is |drag_data|, given as an argument to the previous - // DragTargetDragEnter call. This function is only used when window rendering - // is disabled. - /// - void(CEF_CALLBACK* drag_target_drop)(struct _cef_browser_host_t* self, - const struct _cef_mouse_event_t* event); - - /// - // Call this function when the drag operation started by a - // cef_render_handler_t::StartDragging call has ended either in a drop or by - // being cancelled. |x| and |y| are mouse coordinates relative to the upper- - // left corner of the view. If the web view is both the drag source and the - // drag target then all DragTarget* functions should be called before - // DragSource* mthods. This function is only used when window rendering is - // disabled. - /// - void(CEF_CALLBACK* drag_source_ended_at)(struct _cef_browser_host_t* self, - int x, - int y, - cef_drag_operations_mask_t op); - - /// - // Call this function when the drag operation started by a - // cef_render_handler_t::StartDragging call has completed. This function may - // be called immediately without first calling DragSourceEndedAt to cancel a - // drag operation. If the web view is both the drag source and the drag target - // then all DragTarget* functions should be called before DragSource* mthods. - // This function is only used when window rendering is disabled. - /// - void(CEF_CALLBACK* drag_source_system_drag_ended)( - struct _cef_browser_host_t* self); - - /// - // Returns the current visible navigation entry for this browser. This - // function can only be called on the UI thread. - /// - struct _cef_navigation_entry_t*(CEF_CALLBACK* get_visible_navigation_entry)( - struct _cef_browser_host_t* self); - - /// - // Set accessibility state for all frames. |accessibility_state| may be - // default, enabled or disabled. If |accessibility_state| is STATE_DEFAULT - // then accessibility will be disabled by default and the state may be further - // controlled with the "force-renderer-accessibility" and "disable-renderer- - // accessibility" command-line switches. If |accessibility_state| is - // STATE_ENABLED then accessibility will be enabled. If |accessibility_state| - // is STATE_DISABLED then accessibility will be completely disabled. - // - // For windowed browsers accessibility will be enabled in Complete mode (which - // corresponds to kAccessibilityModeComplete in Chromium). In this mode all - // platform accessibility objects will be created and managed by Chromium's - // internal implementation. The client needs only to detect the screen reader - // and call this function appropriately. For example, on macOS the client can - // handle the @"AXEnhancedUserStructure" accessibility attribute to detect - // VoiceOver state changes and on Windows the client can handle WM_GETOBJECT - // with OBJID_CLIENT to detect accessibility readers. - // - // For windowless browsers accessibility will be enabled in TreeOnly mode - // (which corresponds to kAccessibilityModeWebContentsOnly in Chromium). In - // this mode renderer accessibility is enabled, the full tree is computed, and - // events are passed to CefAccessibiltyHandler, but platform accessibility - // objects are not created. The client may implement platform accessibility - // objects using CefAccessibiltyHandler callbacks if desired. - /// - void(CEF_CALLBACK* set_accessibility_state)(struct _cef_browser_host_t* self, - cef_state_t accessibility_state); - - /// - // Enable notifications of auto resize via - // cef_display_handler_t::OnAutoResize. Notifications are disabled by default. - // |min_size| and |max_size| define the range of allowed sizes. - /// - void(CEF_CALLBACK* set_auto_resize_enabled)(struct _cef_browser_host_t* self, - int enabled, - const cef_size_t* min_size, - const cef_size_t* max_size); - - /// - // Returns the extension hosted in this browser or NULL if no extension is - // hosted. See cef_request_tContext::LoadExtension for details. - /// - struct _cef_extension_t*(CEF_CALLBACK* get_extension)( - struct _cef_browser_host_t* self); - - /// - // Returns true (1) if this browser is hosting an extension background script. - // Background hosts do not have a window and are not displayable. See - // cef_request_tContext::LoadExtension for details. - /// - int(CEF_CALLBACK* is_background_host)(struct _cef_browser_host_t* self); -} cef_browser_host_t; - -/// -// Create a new browser window using the window parameters specified by -// |windowInfo|. All values will be copied internally and the actual window will -// be created on the UI thread. If |request_context| is NULL the global request -// context will be used. This function can be called on any browser process -// thread and will not block. -/// -CEF_EXPORT int cef_browser_host_create_browser( - const cef_window_info_t* windowInfo, - struct _cef_client_t* client, - const cef_string_t* url, - const struct _cef_browser_settings_t* settings, - struct _cef_request_context_t* request_context); - -/// -// Create a new browser window using the window parameters specified by -// |windowInfo|. If |request_context| is NULL the global request context will be -// used. This function can only be called on the browser process UI thread. -/// -CEF_EXPORT cef_browser_t* cef_browser_host_create_browser_sync( - const cef_window_info_t* windowInfo, - struct _cef_client_t* client, - const cef_string_t* url, - const struct _cef_browser_settings_t* settings, - struct _cef_request_context_t* request_context); - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ diff --git a/third_party/cef/include/capi/cef_browser_process_handler_capi.h b/third_party/cef/include/capi/cef_browser_process_handler_capi.h deleted file mode 100644 index 6a34ff91..00000000 --- a/third_party/cef/include/capi/cef_browser_process_handler_capi.h +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// -// $hash=437eae6454931ccf2687f60f8050fcf216966e09$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_PROCESS_HANDLER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_BROWSER_PROCESS_HANDLER_CAPI_H_ -#pragma once - -#include "include/capi/cef_base_capi.h" -#include "include/capi/cef_command_line_capi.h" -#include "include/capi/cef_print_handler_capi.h" -#include "include/capi/cef_values_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// -// Structure used to implement browser process callbacks. The functions of this -// structure will be called on the browser process main thread unless otherwise -// indicated. -/// -typedef struct _cef_browser_process_handler_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Called on the browser process UI thread immediately after the CEF context - // has been initialized. - /// - void(CEF_CALLBACK* on_context_initialized)( - struct _cef_browser_process_handler_t* self); - - /// - // Called before a child process is launched. Will be called on the browser - // process UI thread when launching a render process and on the browser - // process IO thread when launching a GPU or plugin process. Provides an - // opportunity to modify the child process command line. Do not keep a - // reference to |command_line| outside of this function. - /// - void(CEF_CALLBACK* on_before_child_process_launch)( - struct _cef_browser_process_handler_t* self, - struct _cef_command_line_t* command_line); - - /// - // Called on the browser process IO thread after the main thread has been - // created for a new render process. Provides an opportunity to specify extra - // information that will be passed to - // cef_render_process_handler_t::on_render_thread_created() in the render - // process. Do not keep a reference to |extra_info| outside of this function. - /// - void(CEF_CALLBACK* on_render_process_thread_created)( - struct _cef_browser_process_handler_t* self, - struct _cef_list_value_t* extra_info); - - /// - // Return the handler for printing on Linux. If a print handler is not - // provided then printing will not be supported on the Linux platform. - /// - struct _cef_print_handler_t*(CEF_CALLBACK* get_print_handler)( - struct _cef_browser_process_handler_t* self); - - /// - // Called from any thread when work has been scheduled for the browser process - // main (UI) thread. This callback is used in combination with CefSettings. - // external_message_pump and cef_do_message_loop_work() in cases where the CEF - // message loop must be integrated into an existing application message loop - // (see additional comments and warnings on CefDoMessageLoopWork). This - // callback should schedule a cef_do_message_loop_work() call to happen on the - // main (UI) thread. |delay_ms| is the requested delay in milliseconds. If - // |delay_ms| is <= 0 then the call should happen reasonably soon. If - // |delay_ms| is > 0 then the call should be scheduled to happen after the - // specified delay and any currently pending scheduled call should be - // cancelled. - /// - void(CEF_CALLBACK* on_schedule_message_pump_work)( - struct _cef_browser_process_handler_t* self, - int64 delay_ms); -} cef_browser_process_handler_t; - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_BROWSER_PROCESS_HANDLER_CAPI_H_ diff --git a/third_party/cef/include/capi/cef_callback_capi.h b/third_party/cef/include/capi/cef_callback_capi.h deleted file mode 100644 index 394ca1fb..00000000 --- a/third_party/cef/include/capi/cef_callback_capi.h +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// -// $hash=41c1f253d23f062f96debd7184f3b5e5dac03a89$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_CALLBACK_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_CALLBACK_CAPI_H_ -#pragma once - -#include "include/capi/cef_base_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// -// Generic callback structure used for asynchronous continuation. -/// -typedef struct _cef_callback_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Continue processing. - /// - void(CEF_CALLBACK* cont)(struct _cef_callback_t* self); - - /// - // Cancel processing. - /// - void(CEF_CALLBACK* cancel)(struct _cef_callback_t* self); -} cef_callback_t; - -/// -// Generic callback structure used for asynchronous completion. -/// -typedef struct _cef_completion_callback_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Method that will be called once the task is complete. - /// - void(CEF_CALLBACK* on_complete)(struct _cef_completion_callback_t* self); -} cef_completion_callback_t; - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_CALLBACK_CAPI_H_ diff --git a/third_party/cef/include/capi/cef_client_capi.h b/third_party/cef/include/capi/cef_client_capi.h deleted file mode 100644 index 5603646f..00000000 --- a/third_party/cef/include/capi/cef_client_capi.h +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// -// $hash=1dbb0adf7ac5fd42b5a79d271834781664a7fd47$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_ -#pragma once - -#include "include/capi/cef_base_capi.h" -#include "include/capi/cef_context_menu_handler_capi.h" -#include "include/capi/cef_dialog_handler_capi.h" -#include "include/capi/cef_display_handler_capi.h" -#include "include/capi/cef_download_handler_capi.h" -#include "include/capi/cef_drag_handler_capi.h" -#include "include/capi/cef_find_handler_capi.h" -#include "include/capi/cef_focus_handler_capi.h" -#include "include/capi/cef_jsdialog_handler_capi.h" -#include "include/capi/cef_keyboard_handler_capi.h" -#include "include/capi/cef_life_span_handler_capi.h" -#include "include/capi/cef_load_handler_capi.h" -#include "include/capi/cef_process_message_capi.h" -#include "include/capi/cef_render_handler_capi.h" -#include "include/capi/cef_request_handler_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// -// Implement this structure to provide handler implementations. -/// -typedef struct _cef_client_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Return the handler for context menus. If no handler is provided the default - // implementation will be used. - /// - struct _cef_context_menu_handler_t*(CEF_CALLBACK* get_context_menu_handler)( - struct _cef_client_t* self); - - /// - // Return the handler for dialogs. If no handler is provided the default - // implementation will be used. - /// - struct _cef_dialog_handler_t*(CEF_CALLBACK* get_dialog_handler)( - struct _cef_client_t* self); - - /// - // Return the handler for browser display state events. - /// - struct _cef_display_handler_t*(CEF_CALLBACK* get_display_handler)( - struct _cef_client_t* self); - - /// - // Return the handler for download events. If no handler is returned downloads - // will not be allowed. - /// - struct _cef_download_handler_t*(CEF_CALLBACK* get_download_handler)( - struct _cef_client_t* self); - - /// - // Return the handler for drag events. - /// - struct _cef_drag_handler_t*(CEF_CALLBACK* get_drag_handler)( - struct _cef_client_t* self); - - /// - // Return the handler for find result events. - /// - struct _cef_find_handler_t*(CEF_CALLBACK* get_find_handler)( - struct _cef_client_t* self); - - /// - // Return the handler for focus events. - /// - struct _cef_focus_handler_t*(CEF_CALLBACK* get_focus_handler)( - struct _cef_client_t* self); - - /// - // Return the handler for JavaScript dialogs. If no handler is provided the - // default implementation will be used. - /// - struct _cef_jsdialog_handler_t*(CEF_CALLBACK* get_jsdialog_handler)( - struct _cef_client_t* self); - - /// - // Return the handler for keyboard events. - /// - struct _cef_keyboard_handler_t*(CEF_CALLBACK* get_keyboard_handler)( - struct _cef_client_t* self); - - /// - // Return the handler for browser life span events. - /// - struct _cef_life_span_handler_t*(CEF_CALLBACK* get_life_span_handler)( - struct _cef_client_t* self); - - /// - // Return the handler for browser load status events. - /// - struct _cef_load_handler_t*(CEF_CALLBACK* get_load_handler)( - struct _cef_client_t* self); - - /// - // Return the handler for off-screen rendering events. - /// - struct _cef_render_handler_t*(CEF_CALLBACK* get_render_handler)( - struct _cef_client_t* self); - - /// - // Return the handler for browser request events. - /// - struct _cef_request_handler_t*(CEF_CALLBACK* get_request_handler)( - struct _cef_client_t* self); - - /// - // Called when a new message is received from a different process. Return true - // (1) if the message was handled or false (0) otherwise. Do not keep a - // reference to or attempt to access the message outside of this callback. - /// - int(CEF_CALLBACK* on_process_message_received)( - struct _cef_client_t* self, - struct _cef_browser_t* browser, - cef_process_id_t source_process, - struct _cef_process_message_t* message); -} cef_client_t; - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_ diff --git a/third_party/cef/include/capi/cef_command_line_capi.h b/third_party/cef/include/capi/cef_command_line_capi.h deleted file mode 100644 index 262ac180..00000000 --- a/third_party/cef/include/capi/cef_command_line_capi.h +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// -// $hash=4e9afcf5b6d90535ea4b98c3493e242244373f9e$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_COMMAND_LINE_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_COMMAND_LINE_CAPI_H_ -#pragma once - -#include "include/capi/cef_base_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// -// Structure used to create and/or parse command line arguments. Arguments with -// '--', '-' and, on Windows, '/' prefixes are considered switches. Switches -// will always precede any arguments without switch prefixes. Switches can -// optionally have a value specified using the '=' delimiter (e.g. -// "-switch=value"). An argument of "--" will terminate switch parsing with all -// subsequent tokens, regardless of prefix, being interpreted as non-switch -// arguments. Switch names are considered case-insensitive. This structure can -// be used before cef_initialize() is called. -/// -typedef struct _cef_command_line_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Returns true (1) if this object is valid. Do not call any other functions - // if this function returns false (0). - /// - int(CEF_CALLBACK* is_valid)(struct _cef_command_line_t* self); - - /// - // Returns true (1) if the values of this object are read-only. Some APIs may - // expose read-only objects. - /// - int(CEF_CALLBACK* is_read_only)(struct _cef_command_line_t* self); - - /// - // Returns a writable copy of this object. - /// - struct _cef_command_line_t*(CEF_CALLBACK* copy)( - struct _cef_command_line_t* self); - - /// - // Initialize the command line with the specified |argc| and |argv| values. - // The first argument must be the name of the program. This function is only - // supported on non-Windows platforms. - /// - void(CEF_CALLBACK* init_from_argv)(struct _cef_command_line_t* self, - int argc, - const char* const* argv); - - /// - // Initialize the command line with the string returned by calling - // GetCommandLineW(). This function is only supported on Windows. - /// - void(CEF_CALLBACK* init_from_string)(struct _cef_command_line_t* self, - const cef_string_t* command_line); - - /// - // Reset the command-line switches and arguments but leave the program - // component unchanged. - /// - void(CEF_CALLBACK* reset)(struct _cef_command_line_t* self); - - /// - // Retrieve the original command line string as a vector of strings. The argv - // array: { program, [(--|-|/)switch[=value]]*, [--], [argument]* } - /// - void(CEF_CALLBACK* get_argv)(struct _cef_command_line_t* self, - cef_string_list_t argv); - - /// - // Constructs and returns the represented command line string. Use this - // function cautiously because quoting behavior is unclear. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_command_line_string)( - struct _cef_command_line_t* self); - - /// - // Get the program part of the command line string (the first item). - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_program)( - struct _cef_command_line_t* self); - - /// - // Set the program part of the command line string (the first item). - /// - void(CEF_CALLBACK* set_program)(struct _cef_command_line_t* self, - const cef_string_t* program); - - /// - // Returns true (1) if the command line has switches. - /// - int(CEF_CALLBACK* has_switches)(struct _cef_command_line_t* self); - - /// - // Returns true (1) if the command line contains the given switch. - /// - int(CEF_CALLBACK* has_switch)(struct _cef_command_line_t* self, - const cef_string_t* name); - - /// - // Returns the value associated with the given switch. If the switch has no - // value or isn't present this function returns the NULL string. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_switch_value)( - struct _cef_command_line_t* self, - const cef_string_t* name); - - /// - // Returns the map of switch names and values. If a switch has no value an - // NULL string is returned. - /// - void(CEF_CALLBACK* get_switches)(struct _cef_command_line_t* self, - cef_string_map_t switches); - - /// - // Add a switch to the end of the command line. If the switch has no value - // pass an NULL value string. - /// - void(CEF_CALLBACK* append_switch)(struct _cef_command_line_t* self, - const cef_string_t* name); - - /// - // Add a switch with the specified value to the end of the command line. - /// - void(CEF_CALLBACK* append_switch_with_value)(struct _cef_command_line_t* self, - const cef_string_t* name, - const cef_string_t* value); - - /// - // True if there are remaining command line arguments. - /// - int(CEF_CALLBACK* has_arguments)(struct _cef_command_line_t* self); - - /// - // Get the remaining command line arguments. - /// - void(CEF_CALLBACK* get_arguments)(struct _cef_command_line_t* self, - cef_string_list_t arguments); - - /// - // Add an argument to the end of the command line. - /// - void(CEF_CALLBACK* append_argument)(struct _cef_command_line_t* self, - const cef_string_t* argument); - - /// - // Insert a command before the current command. Common for debuggers, like - // "valgrind" or "gdb --args". - /// - void(CEF_CALLBACK* prepend_wrapper)(struct _cef_command_line_t* self, - const cef_string_t* wrapper); -} cef_command_line_t; - -/// -// Create a new cef_command_line_t instance. -/// -CEF_EXPORT cef_command_line_t* cef_command_line_create(); - -/// -// Returns the singleton global cef_command_line_t object. The returned object -// will be read-only. -/// -CEF_EXPORT cef_command_line_t* cef_command_line_get_global(); - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_COMMAND_LINE_CAPI_H_ diff --git a/third_party/cef/include/capi/cef_context_menu_handler_capi.h b/third_party/cef/include/capi/cef_context_menu_handler_capi.h deleted file mode 100644 index ae717ce7..00000000 --- a/third_party/cef/include/capi/cef_context_menu_handler_capi.h +++ /dev/null @@ -1,308 +0,0 @@ -// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// -// $hash=fdd4de9c81a7b01a94aee020b2c314e519cd8e55$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_CONTEXT_MENU_HANDLER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_CONTEXT_MENU_HANDLER_CAPI_H_ -#pragma once - -#include "include/capi/cef_base_capi.h" -#include "include/capi/cef_browser_capi.h" -#include "include/capi/cef_frame_capi.h" -#include "include/capi/cef_menu_model_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct _cef_context_menu_params_t; - -/// -// Callback structure used for continuation of custom context menu display. -/// -typedef struct _cef_run_context_menu_callback_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Complete context menu display by selecting the specified |command_id| and - // |event_flags|. - /// - void(CEF_CALLBACK* cont)(struct _cef_run_context_menu_callback_t* self, - int command_id, - cef_event_flags_t event_flags); - - /// - // Cancel context menu display. - /// - void(CEF_CALLBACK* cancel)(struct _cef_run_context_menu_callback_t* self); -} cef_run_context_menu_callback_t; - -/// -// Implement this structure to handle context menu events. The functions of this -// structure will be called on the UI thread. -/// -typedef struct _cef_context_menu_handler_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Called before a context menu is displayed. |params| provides information - // about the context menu state. |model| initially contains the default - // context menu. The |model| can be cleared to show no context menu or - // modified to show a custom menu. Do not keep references to |params| or - // |model| outside of this callback. - /// - void(CEF_CALLBACK* on_before_context_menu)( - struct _cef_context_menu_handler_t* self, - struct _cef_browser_t* browser, - struct _cef_frame_t* frame, - struct _cef_context_menu_params_t* params, - struct _cef_menu_model_t* model); - - /// - // Called to allow custom display of the context menu. |params| provides - // information about the context menu state. |model| contains the context menu - // model resulting from OnBeforeContextMenu. For custom display return true - // (1) and execute |callback| either synchronously or asynchronously with the - // selected command ID. For default display return false (0). Do not keep - // references to |params| or |model| outside of this callback. - /// - int(CEF_CALLBACK* run_context_menu)( - struct _cef_context_menu_handler_t* self, - struct _cef_browser_t* browser, - struct _cef_frame_t* frame, - struct _cef_context_menu_params_t* params, - struct _cef_menu_model_t* model, - struct _cef_run_context_menu_callback_t* callback); - - /// - // Called to execute a command selected from the context menu. Return true (1) - // if the command was handled or false (0) for the default implementation. See - // cef_menu_id_t for the command ids that have default implementations. All - // user-defined command ids should be between MENU_ID_USER_FIRST and - // MENU_ID_USER_LAST. |params| will have the same values as what was passed to - // on_before_context_menu(). Do not keep a reference to |params| outside of - // this callback. - /// - int(CEF_CALLBACK* on_context_menu_command)( - struct _cef_context_menu_handler_t* self, - struct _cef_browser_t* browser, - struct _cef_frame_t* frame, - struct _cef_context_menu_params_t* params, - int command_id, - cef_event_flags_t event_flags); - - /// - // Called when the context menu is dismissed irregardless of whether the menu - // was NULL or a command was selected. - /// - void(CEF_CALLBACK* on_context_menu_dismissed)( - struct _cef_context_menu_handler_t* self, - struct _cef_browser_t* browser, - struct _cef_frame_t* frame); -} cef_context_menu_handler_t; - -/// -// Provides information about the context menu state. The ethods of this -// structure can only be accessed on browser process the UI thread. -/// -typedef struct _cef_context_menu_params_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Returns the X coordinate of the mouse where the context menu was invoked. - // Coords are relative to the associated RenderView's origin. - /// - int(CEF_CALLBACK* get_xcoord)(struct _cef_context_menu_params_t* self); - - /// - // Returns the Y coordinate of the mouse where the context menu was invoked. - // Coords are relative to the associated RenderView's origin. - /// - int(CEF_CALLBACK* get_ycoord)(struct _cef_context_menu_params_t* self); - - /// - // Returns flags representing the type of node that the context menu was - // invoked on. - /// - cef_context_menu_type_flags_t(CEF_CALLBACK* get_type_flags)( - struct _cef_context_menu_params_t* self); - - /// - // Returns the URL of the link, if any, that encloses the node that the - // context menu was invoked on. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_link_url)( - struct _cef_context_menu_params_t* self); - - /// - // Returns the link URL, if any, to be used ONLY for "copy link address". We - // don't validate this field in the frontend process. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_unfiltered_link_url)( - struct _cef_context_menu_params_t* self); - - /// - // Returns the source URL, if any, for the element that the context menu was - // invoked on. Example of elements with source URLs are img, audio, and video. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_source_url)( - struct _cef_context_menu_params_t* self); - - /// - // Returns true (1) if the context menu was invoked on an image which has non- - // NULL contents. - /// - int(CEF_CALLBACK* has_image_contents)( - struct _cef_context_menu_params_t* self); - - /// - // Returns the title text or the alt text if the context menu was invoked on - // an image. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_title_text)( - struct _cef_context_menu_params_t* self); - - /// - // Returns the URL of the top level page that the context menu was invoked on. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_page_url)( - struct _cef_context_menu_params_t* self); - - /// - // Returns the URL of the subframe that the context menu was invoked on. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_frame_url)( - struct _cef_context_menu_params_t* self); - - /// - // Returns the character encoding of the subframe that the context menu was - // invoked on. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_frame_charset)( - struct _cef_context_menu_params_t* self); - - /// - // Returns the type of context node that the context menu was invoked on. - /// - cef_context_menu_media_type_t(CEF_CALLBACK* get_media_type)( - struct _cef_context_menu_params_t* self); - - /// - // Returns flags representing the actions supported by the media element, if - // any, that the context menu was invoked on. - /// - cef_context_menu_media_state_flags_t(CEF_CALLBACK* get_media_state_flags)( - struct _cef_context_menu_params_t* self); - - /// - // Returns the text of the selection, if any, that the context menu was - // invoked on. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_selection_text)( - struct _cef_context_menu_params_t* self); - - /// - // Returns the text of the misspelled word, if any, that the context menu was - // invoked on. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_misspelled_word)( - struct _cef_context_menu_params_t* self); - - /// - // Returns true (1) if suggestions exist, false (0) otherwise. Fills in - // |suggestions| from the spell check service for the misspelled word if there - // is one. - /// - int(CEF_CALLBACK* get_dictionary_suggestions)( - struct _cef_context_menu_params_t* self, - cef_string_list_t suggestions); - - /// - // Returns true (1) if the context menu was invoked on an editable node. - /// - int(CEF_CALLBACK* is_editable)(struct _cef_context_menu_params_t* self); - - /// - // Returns true (1) if the context menu was invoked on an editable node where - // spell-check is enabled. - /// - int(CEF_CALLBACK* is_spell_check_enabled)( - struct _cef_context_menu_params_t* self); - - /// - // Returns flags representing the actions supported by the editable node, if - // any, that the context menu was invoked on. - /// - cef_context_menu_edit_state_flags_t(CEF_CALLBACK* get_edit_state_flags)( - struct _cef_context_menu_params_t* self); - - /// - // Returns true (1) if the context menu contains items specified by the - // renderer process (for example, plugin placeholder or pepper plugin menu - // items). - /// - int(CEF_CALLBACK* is_custom_menu)(struct _cef_context_menu_params_t* self); - - /// - // Returns true (1) if the context menu was invoked from a pepper plugin. - /// - int(CEF_CALLBACK* is_pepper_menu)(struct _cef_context_menu_params_t* self); -} cef_context_menu_params_t; - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_CONTEXT_MENU_HANDLER_CAPI_H_ diff --git a/third_party/cef/include/capi/cef_cookie_capi.h b/third_party/cef/include/capi/cef_cookie_capi.h deleted file mode 100644 index 20609656..00000000 --- a/third_party/cef/include/capi/cef_cookie_capi.h +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// -// $hash=00e6d1aa80d5998d89cc272dcb199cde0add12fa$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_ -#pragma once - -#include "include/capi/cef_base_capi.h" -#include "include/capi/cef_callback_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct _cef_cookie_visitor_t; -struct _cef_delete_cookies_callback_t; -struct _cef_set_cookie_callback_t; - -/// -// Structure used for managing cookies. The functions of this structure may be -// called on any thread unless otherwise indicated. -/// -typedef struct _cef_cookie_manager_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Set the schemes supported by this manager. The default schemes ("http", - // "https", "ws" and "wss") will always be supported. If |callback| is non- - // NULL it will be executed asnychronously on the IO thread after the change - // has been applied. Must be called before any cookies are accessed. - /// - void(CEF_CALLBACK* set_supported_schemes)( - struct _cef_cookie_manager_t* self, - cef_string_list_t schemes, - struct _cef_completion_callback_t* callback); - - /// - // Visit all cookies on the IO thread. The returned cookies are ordered by - // longest path, then by earliest creation date. Returns false (0) if cookies - // cannot be accessed. - /// - int(CEF_CALLBACK* visit_all_cookies)(struct _cef_cookie_manager_t* self, - struct _cef_cookie_visitor_t* visitor); - - /// - // Visit a subset of cookies on the IO thread. The results are filtered by the - // given url scheme, host, domain and path. If |includeHttpOnly| is true (1) - // HTTP-only cookies will also be included in the results. The returned - // cookies are ordered by longest path, then by earliest creation date. - // Returns false (0) if cookies cannot be accessed. - /// - int(CEF_CALLBACK* visit_url_cookies)(struct _cef_cookie_manager_t* self, - const cef_string_t* url, - int includeHttpOnly, - struct _cef_cookie_visitor_t* visitor); - - /// - // Sets a cookie given a valid URL and explicit user-provided cookie - // attributes. This function expects each attribute to be well-formed. It will - // check for disallowed characters (e.g. the ';' character is disallowed - // within the cookie value attribute) and fail without setting the cookie if - // such characters are found. If |callback| is non-NULL it will be executed - // asnychronously on the IO thread after the cookie has been set. Returns - // false (0) if an invalid URL is specified or if cookies cannot be accessed. - /// - int(CEF_CALLBACK* set_cookie)(struct _cef_cookie_manager_t* self, - const cef_string_t* url, - const struct _cef_cookie_t* cookie, - struct _cef_set_cookie_callback_t* callback); - - /// - // Delete all cookies that match the specified parameters. If both |url| and - // |cookie_name| values are specified all host and domain cookies matching - // both will be deleted. If only |url| is specified all host cookies (but not - // domain cookies) irrespective of path will be deleted. If |url| is NULL all - // cookies for all hosts and domains will be deleted. If |callback| is non- - // NULL it will be executed asnychronously on the IO thread after the cookies - // have been deleted. Returns false (0) if a non-NULL invalid URL is specified - // or if cookies cannot be accessed. Cookies can alternately be deleted using - // the Visit*Cookies() functions. - /// - int(CEF_CALLBACK* delete_cookies)( - struct _cef_cookie_manager_t* self, - const cef_string_t* url, - const cef_string_t* cookie_name, - struct _cef_delete_cookies_callback_t* callback); - - /// - // Sets the directory path that will be used for storing cookie data. If - // |path| is NULL data will be stored in memory only. Otherwise, data will be - // stored at the specified |path|. To persist session cookies (cookies without - // an expiry date or validity interval) set |persist_session_cookies| to true - // (1). Session cookies are generally intended to be transient and most Web - // browsers do not persist them. If |callback| is non-NULL it will be executed - // asnychronously on the IO thread after the manager's storage has been - // initialized. Returns false (0) if cookies cannot be accessed. - /// - int(CEF_CALLBACK* set_storage_path)( - struct _cef_cookie_manager_t* self, - const cef_string_t* path, - int persist_session_cookies, - struct _cef_completion_callback_t* callback); - - /// - // Flush the backing store (if any) to disk. If |callback| is non-NULL it will - // be executed asnychronously on the IO thread after the flush is complete. - // Returns false (0) if cookies cannot be accessed. - /// - int(CEF_CALLBACK* flush_store)(struct _cef_cookie_manager_t* self, - struct _cef_completion_callback_t* callback); -} cef_cookie_manager_t; - -/// -// Returns the global cookie manager. By default data will be stored at -// CefSettings.cache_path if specified or in memory otherwise. If |callback| is -// non-NULL it will be executed asnychronously on the IO thread after the -// manager's storage has been initialized. Using this function is equivalent to -// calling cef_request_tContext::cef_request_context_get_global_context()->get_d -// efault_cookie_manager(). -/// -CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_global_manager( - struct _cef_completion_callback_t* callback); - -/// -// Returns a cookie manager that neither stores nor retrieves cookies. All usage -// of cookies will be blocked including cookies accessed via the network -// (request/response headers), via JavaScript (document.cookie), and via -// cef_cookie_manager_t functions. No cookies will be displayed in DevTools. If -// you wish to only block cookies sent via the network use the -// cef_request_tHandler CanGetCookies and CanSetCookie functions instead. -/// -CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_blocking_manager(); - -/// -// Creates a new cookie manager. If |path| is NULL data will be stored in memory -// only. Otherwise, data will be stored at the specified |path|. To persist -// session cookies (cookies without an expiry date or validity interval) set -// |persist_session_cookies| to true (1). Session cookies are generally intended -// to be transient and most Web browsers do not persist them. If |callback| is -// non-NULL it will be executed asnychronously on the IO thread after the -// manager's storage has been initialized. -/// -CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_create_manager( - const cef_string_t* path, - int persist_session_cookies, - struct _cef_completion_callback_t* callback); - -/// -// Structure to implement for visiting cookie values. The functions of this -// structure will always be called on the IO thread. -/// -typedef struct _cef_cookie_visitor_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Method that will be called once for each cookie. |count| is the 0-based - // index for the current cookie. |total| is the total number of cookies. Set - // |deleteCookie| to true (1) to delete the cookie currently being visited. - // Return false (0) to stop visiting cookies. This function may never be - // called if no cookies are found. - /// - int(CEF_CALLBACK* visit)(struct _cef_cookie_visitor_t* self, - const struct _cef_cookie_t* cookie, - int count, - int total, - int* deleteCookie); -} cef_cookie_visitor_t; - -/// -// Structure to implement to be notified of asynchronous completion via -// cef_cookie_manager_t::set_cookie(). -/// -typedef struct _cef_set_cookie_callback_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Method that will be called upon completion. |success| will be true (1) if - // the cookie was set successfully. - /// - void(CEF_CALLBACK* on_complete)(struct _cef_set_cookie_callback_t* self, - int success); -} cef_set_cookie_callback_t; - -/// -// Structure to implement to be notified of asynchronous completion via -// cef_cookie_manager_t::delete_cookies(). -/// -typedef struct _cef_delete_cookies_callback_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Method that will be called upon completion. |num_deleted| will be the - // number of cookies that were deleted or -1 if unknown. - /// - void(CEF_CALLBACK* on_complete)(struct _cef_delete_cookies_callback_t* self, - int num_deleted); -} cef_delete_cookies_callback_t; - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_ diff --git a/third_party/cef/include/capi/cef_crash_util_capi.h b/third_party/cef/include/capi/cef_crash_util_capi.h deleted file mode 100644 index edf269ab..00000000 --- a/third_party/cef/include/capi/cef_crash_util_capi.h +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// -// $hash=e4da4fab11e33d34d70714be22e6f72579586ffe$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_CRASH_UTIL_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_CRASH_UTIL_CAPI_H_ -#pragma once - -#include "include/capi/cef_base_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// -// Crash reporting is configured using an INI-style config file named -// "crash_reporter.cfg". On Windows and Linux this file must be placed next to -// the main application executable. On macOS this file must be placed in the -// top-level app bundle Resources directory (e.g. -// ".app/Contents/Resources"). File contents are as follows: -// -// # Comments start with a hash character and must be on their own line. -// -// [Config] -// ProductName= -// ProductVersion= -// AppName= -// ExternalHandler= -// BrowserCrashForwardingEnabled= -// ServerURL= -// RateLimitEnabled= -// MaxUploadsPerDay= -// MaxDatabaseSizeInMb= -// MaxDatabaseAgeInDays= -// -// [CrashKeys] -// my_key1= -// my_key2= -// -// Config section: -// -// If "ProductName" and/or "ProductVersion" are set then the specified values -// will be included in the crash dump metadata. On macOS if these values are set -// to NULL then they will be retrieved from the Info.plist file using the -// "CFBundleName" and "CFBundleShortVersionString" keys respectively. -// -// If "AppName" is set on Windows then crash report information (metrics, -// database and dumps) will be stored locally on disk under the -// "C:\Users\[CurrentUser]\AppData\Local\[AppName]\User Data" folder. On other -// platforms the CefSettings.user_data_path value will be used. -// -// If "ExternalHandler" is set on Windows then the specified exe will be -// launched as the crashpad-handler instead of re-launching the main process -// exe. The value can be an absolute path or a path relative to the main exe -// directory. On Linux the CefSettings.browser_subprocess_path value will be -// used. On macOS the existing subprocess app bundle will be used. -// -// If "BrowserCrashForwardingEnabled" is set to true (1) on macOS then browser -// process crashes will be forwarded to the system crash reporter. This results -// in the crash UI dialog being displayed to the user and crash reports being -// logged under "~/Library/Logs/DiagnosticReports". Forwarding of crash reports -// from non-browser processes and Debug builds is always disabled. -// -// If "ServerURL" is set then crashes will be uploaded as a multi-part POST -// request to the specified URL. Otherwise, reports will only be stored locally -// on disk. -// -// If "RateLimitEnabled" is set to true (1) then crash report uploads will be -// rate limited as follows: -// 1. If "MaxUploadsPerDay" is set to a positive value then at most the -// specified number of crashes will be uploaded in each 24 hour period. -// 2. If crash upload fails due to a network or server error then an -// incremental backoff delay up to a maximum of 24 hours will be applied for -// retries. -// 3. If a backoff delay is applied and "MaxUploadsPerDay" is > 1 then the -// "MaxUploadsPerDay" value will be reduced to 1 until the client is -// restarted. This helps to avoid an upload flood when the network or -// server error is resolved. -// Rate limiting is not supported on Linux. -// -// If "MaxDatabaseSizeInMb" is set to a positive value then crash report storage -// on disk will be limited to that size in megabytes. For example, on Windows -// each dump is about 600KB so a "MaxDatabaseSizeInMb" value of 20 equates to -// about 34 crash reports stored on disk. Not supported on Linux. -// -// If "MaxDatabaseAgeInDays" is set to a positive value then crash reports older -// than the specified age in days will be deleted. Not supported on Linux. -// -// CrashKeys section: -// -// A maximum of 26 crash keys of each size can be specified for use by the -// application. Crash key values will be truncated based on the specified size -// (small = 64 bytes, medium = 256 bytes, large = 1024 bytes). The value of -// crash keys can be set from any thread or process using the -// CefSetCrashKeyValue function. These key/value pairs will be sent to the crash -// server along with the crash dump file. -/// -CEF_EXPORT int cef_crash_reporting_enabled(); - -/// -// Sets or clears a specific key-value pair from the crash metadata. -/// -CEF_EXPORT void cef_set_crash_key_value(const cef_string_t* key, - const cef_string_t* value); - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_CRASH_UTIL_CAPI_H_ diff --git a/third_party/cef/include/capi/cef_dialog_handler_capi.h b/third_party/cef/include/capi/cef_dialog_handler_capi.h deleted file mode 100644 index 6a91ef82..00000000 --- a/third_party/cef/include/capi/cef_dialog_handler_capi.h +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// -// $hash=ddf4110dadc49faf08ac2744d851511c41ca403f$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_DIALOG_HANDLER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_DIALOG_HANDLER_CAPI_H_ -#pragma once - -#include "include/capi/cef_base_capi.h" -#include "include/capi/cef_browser_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// -// Callback structure for asynchronous continuation of file dialog requests. -/// -typedef struct _cef_file_dialog_callback_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Continue the file selection. |selected_accept_filter| should be the 0-based - // index of the value selected from the accept filters array passed to - // cef_dialog_handler_t::OnFileDialog. |file_paths| should be a single value - // or a list of values depending on the dialog mode. An NULL |file_paths| - // value is treated the same as calling cancel(). - /// - void(CEF_CALLBACK* cont)(struct _cef_file_dialog_callback_t* self, - int selected_accept_filter, - cef_string_list_t file_paths); - - /// - // Cancel the file selection. - /// - void(CEF_CALLBACK* cancel)(struct _cef_file_dialog_callback_t* self); -} cef_file_dialog_callback_t; - -/// -// Implement this structure to handle dialog events. The functions of this -// structure will be called on the browser process UI thread. -/// -typedef struct _cef_dialog_handler_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Called to run a file chooser dialog. |mode| represents the type of dialog - // to display. |title| to the title to be used for the dialog and may be NULL - // to show the default title ("Open" or "Save" depending on the mode). - // |default_file_path| is the path with optional directory and/or file name - // component that should be initially selected in the dialog. |accept_filters| - // are used to restrict the selectable file types and may any combination of - // (a) valid lower-cased MIME types (e.g. "text/*" or "image/*"), (b) - // individual file extensions (e.g. ".txt" or ".png"), or (c) combined - // description and file extension delimited using "|" and ";" (e.g. "Image - // Types|.png;.gif;.jpg"). |selected_accept_filter| is the 0-based index of - // the filter that should be selected by default. To display a custom dialog - // return true (1) and execute |callback| either inline or at a later time. To - // display the default dialog return false (0). - /// - int(CEF_CALLBACK* on_file_dialog)( - struct _cef_dialog_handler_t* self, - struct _cef_browser_t* browser, - cef_file_dialog_mode_t mode, - const cef_string_t* title, - const cef_string_t* default_file_path, - cef_string_list_t accept_filters, - int selected_accept_filter, - struct _cef_file_dialog_callback_t* callback); -} cef_dialog_handler_t; - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_DIALOG_HANDLER_CAPI_H_ diff --git a/third_party/cef/include/capi/cef_display_handler_capi.h b/third_party/cef/include/capi/cef_display_handler_capi.h deleted file mode 100644 index 69f3d925..00000000 --- a/third_party/cef/include/capi/cef_display_handler_capi.h +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// -// $hash=c7641e41aca6bf30b9c36092861f061d2b16ff82$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_DISPLAY_HANDLER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_DISPLAY_HANDLER_CAPI_H_ -#pragma once - -#include "include/capi/cef_base_capi.h" -#include "include/capi/cef_browser_capi.h" -#include "include/capi/cef_frame_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// -// Implement this structure to handle events related to browser display state. -// The functions of this structure will be called on the UI thread. -/// -typedef struct _cef_display_handler_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Called when a frame's address has changed. - /// - void(CEF_CALLBACK* on_address_change)(struct _cef_display_handler_t* self, - struct _cef_browser_t* browser, - struct _cef_frame_t* frame, - const cef_string_t* url); - - /// - // Called when the page title changes. - /// - void(CEF_CALLBACK* on_title_change)(struct _cef_display_handler_t* self, - struct _cef_browser_t* browser, - const cef_string_t* title); - - /// - // Called when the page icon changes. - /// - void(CEF_CALLBACK* on_favicon_urlchange)(struct _cef_display_handler_t* self, - struct _cef_browser_t* browser, - cef_string_list_t icon_urls); - - /// - // Called when web content in the page has toggled fullscreen mode. If - // |fullscreen| is true (1) the content will automatically be sized to fill - // the browser content area. If |fullscreen| is false (0) the content will - // automatically return to its original size and position. The client is - // responsible for resizing the browser if desired. - /// - void(CEF_CALLBACK* on_fullscreen_mode_change)( - struct _cef_display_handler_t* self, - struct _cef_browser_t* browser, - int fullscreen); - - /// - // Called when the browser is about to display a tooltip. |text| contains the - // text that will be displayed in the tooltip. To handle the display of the - // tooltip yourself return true (1). Otherwise, you can optionally modify - // |text| and then return false (0) to allow the browser to display the - // tooltip. When window rendering is disabled the application is responsible - // for drawing tooltips and the return value is ignored. - /// - int(CEF_CALLBACK* on_tooltip)(struct _cef_display_handler_t* self, - struct _cef_browser_t* browser, - cef_string_t* text); - - /// - // Called when the browser receives a status message. |value| contains the - // text that will be displayed in the status message. - /// - void(CEF_CALLBACK* on_status_message)(struct _cef_display_handler_t* self, - struct _cef_browser_t* browser, - const cef_string_t* value); - - /// - // Called to display a console message. Return true (1) to stop the message - // from being output to the console. - /// - int(CEF_CALLBACK* on_console_message)(struct _cef_display_handler_t* self, - struct _cef_browser_t* browser, - cef_log_severity_t level, - const cef_string_t* message, - const cef_string_t* source, - int line); - - /// - // Called when auto-resize is enabled via - // cef_browser_host_t::SetAutoResizeEnabled and the contents have auto- - // resized. |new_size| will be the desired size in view coordinates. Return - // true (1) if the resize was handled or false (0) for default handling. - /// - int(CEF_CALLBACK* on_auto_resize)(struct _cef_display_handler_t* self, - struct _cef_browser_t* browser, - const cef_size_t* new_size); - - /// - // Called when the overall page loading progress has changed. |progress| - // ranges from 0.0 to 1.0. - /// - void(CEF_CALLBACK* on_loading_progress_change)( - struct _cef_display_handler_t* self, - struct _cef_browser_t* browser, - double progress); -} cef_display_handler_t; - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_DISPLAY_HANDLER_CAPI_H_ diff --git a/third_party/cef/include/capi/cef_dom_capi.h b/third_party/cef/include/capi/cef_dom_capi.h deleted file mode 100644 index b66d4a8c..00000000 --- a/third_party/cef/include/capi/cef_dom_capi.h +++ /dev/null @@ -1,347 +0,0 @@ -// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// -// $hash=b9bef5257ecbd1933356fcc02687bf725bff9277$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_DOM_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_DOM_CAPI_H_ -#pragma once - -#include "include/capi/cef_base_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct _cef_domdocument_t; -struct _cef_domnode_t; - -/// -// Structure to implement for visiting the DOM. The functions of this structure -// will be called on the render process main thread. -/// -typedef struct _cef_domvisitor_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Method executed for visiting the DOM. The document object passed to this - // function represents a snapshot of the DOM at the time this function is - // executed. DOM objects are only valid for the scope of this function. Do not - // keep references to or attempt to access any DOM objects outside the scope - // of this function. - /// - void(CEF_CALLBACK* visit)(struct _cef_domvisitor_t* self, - struct _cef_domdocument_t* document); -} cef_domvisitor_t; - -/// -// Structure used to represent a DOM document. The functions of this structure -// should only be called on the render process main thread thread. -/// -typedef struct _cef_domdocument_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Returns the document type. - /// - cef_dom_document_type_t(CEF_CALLBACK* get_type)( - struct _cef_domdocument_t* self); - - /// - // Returns the root document node. - /// - struct _cef_domnode_t*(CEF_CALLBACK* get_document)( - struct _cef_domdocument_t* self); - - /// - // Returns the BODY node of an HTML document. - /// - struct _cef_domnode_t*(CEF_CALLBACK* get_body)( - struct _cef_domdocument_t* self); - - /// - // Returns the HEAD node of an HTML document. - /// - struct _cef_domnode_t*(CEF_CALLBACK* get_head)( - struct _cef_domdocument_t* self); - - /// - // Returns the title of an HTML document. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_title)( - struct _cef_domdocument_t* self); - - /// - // Returns the document element with the specified ID value. - /// - struct _cef_domnode_t*(CEF_CALLBACK* get_element_by_id)( - struct _cef_domdocument_t* self, - const cef_string_t* id); - - /// - // Returns the node that currently has keyboard focus. - /// - struct _cef_domnode_t*(CEF_CALLBACK* get_focused_node)( - struct _cef_domdocument_t* self); - - /// - // Returns true (1) if a portion of the document is selected. - /// - int(CEF_CALLBACK* has_selection)(struct _cef_domdocument_t* self); - - /// - // Returns the selection offset within the start node. - /// - int(CEF_CALLBACK* get_selection_start_offset)( - struct _cef_domdocument_t* self); - - /// - // Returns the selection offset within the end node. - /// - int(CEF_CALLBACK* get_selection_end_offset)(struct _cef_domdocument_t* self); - - /// - // Returns the contents of this selection as markup. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_selection_as_markup)( - struct _cef_domdocument_t* self); - - /// - // Returns the contents of this selection as text. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_selection_as_text)( - struct _cef_domdocument_t* self); - - /// - // Returns the base URL for the document. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_base_url)( - struct _cef_domdocument_t* self); - - /// - // Returns a complete URL based on the document base URL and the specified - // partial URL. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_complete_url)( - struct _cef_domdocument_t* self, - const cef_string_t* partialURL); -} cef_domdocument_t; - -/// -// Structure used to represent a DOM node. The functions of this structure -// should only be called on the render process main thread. -/// -typedef struct _cef_domnode_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Returns the type for this node. - /// - cef_dom_node_type_t(CEF_CALLBACK* get_type)(struct _cef_domnode_t* self); - - /// - // Returns true (1) if this is a text node. - /// - int(CEF_CALLBACK* is_text)(struct _cef_domnode_t* self); - - /// - // Returns true (1) if this is an element node. - /// - int(CEF_CALLBACK* is_element)(struct _cef_domnode_t* self); - - /// - // Returns true (1) if this is an editable node. - /// - int(CEF_CALLBACK* is_editable)(struct _cef_domnode_t* self); - - /// - // Returns true (1) if this is a form control element node. - /// - int(CEF_CALLBACK* is_form_control_element)(struct _cef_domnode_t* self); - - /// - // Returns the type of this form control element node. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_form_control_element_type)( - struct _cef_domnode_t* self); - - /// - // Returns true (1) if this object is pointing to the same handle as |that| - // object. - /// - int(CEF_CALLBACK* is_same)(struct _cef_domnode_t* self, - struct _cef_domnode_t* that); - - /// - // Returns the name of this node. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_name)(struct _cef_domnode_t* self); - - /// - // Returns the value of this node. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_value)(struct _cef_domnode_t* self); - - /// - // Set the value of this node. Returns true (1) on success. - /// - int(CEF_CALLBACK* set_value)(struct _cef_domnode_t* self, - const cef_string_t* value); - - /// - // Returns the contents of this node as markup. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_as_markup)( - struct _cef_domnode_t* self); - - /// - // Returns the document associated with this node. - /// - struct _cef_domdocument_t*(CEF_CALLBACK* get_document)( - struct _cef_domnode_t* self); - - /// - // Returns the parent node. - /// - struct _cef_domnode_t*(CEF_CALLBACK* get_parent)(struct _cef_domnode_t* self); - - /// - // Returns the previous sibling node. - /// - struct _cef_domnode_t*(CEF_CALLBACK* get_previous_sibling)( - struct _cef_domnode_t* self); - - /// - // Returns the next sibling node. - /// - struct _cef_domnode_t*(CEF_CALLBACK* get_next_sibling)( - struct _cef_domnode_t* self); - - /// - // Returns true (1) if this node has child nodes. - /// - int(CEF_CALLBACK* has_children)(struct _cef_domnode_t* self); - - /// - // Return the first child node. - /// - struct _cef_domnode_t*(CEF_CALLBACK* get_first_child)( - struct _cef_domnode_t* self); - - /// - // Returns the last child node. - /// - struct _cef_domnode_t*(CEF_CALLBACK* get_last_child)( - struct _cef_domnode_t* self); - - // The following functions are valid only for element nodes. - - /// - // Returns the tag name of this element. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_element_tag_name)( - struct _cef_domnode_t* self); - - /// - // Returns true (1) if this element has attributes. - /// - int(CEF_CALLBACK* has_element_attributes)(struct _cef_domnode_t* self); - - /// - // Returns true (1) if this element has an attribute named |attrName|. - /// - int(CEF_CALLBACK* has_element_attribute)(struct _cef_domnode_t* self, - const cef_string_t* attrName); - - /// - // Returns the element attribute named |attrName|. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_element_attribute)( - struct _cef_domnode_t* self, - const cef_string_t* attrName); - - /// - // Returns a map of all element attributes. - /// - void(CEF_CALLBACK* get_element_attributes)(struct _cef_domnode_t* self, - cef_string_map_t attrMap); - - /// - // Set the value for the element attribute named |attrName|. Returns true (1) - // on success. - /// - int(CEF_CALLBACK* set_element_attribute)(struct _cef_domnode_t* self, - const cef_string_t* attrName, - const cef_string_t* value); - - /// - // Returns the inner text of the element. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_element_inner_text)( - struct _cef_domnode_t* self); - - /// - // Returns the bounds of the element. - /// - cef_rect_t(CEF_CALLBACK* get_element_bounds)(struct _cef_domnode_t* self); -} cef_domnode_t; - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_DOM_CAPI_H_ diff --git a/third_party/cef/include/capi/cef_download_handler_capi.h b/third_party/cef/include/capi/cef_download_handler_capi.h deleted file mode 100644 index 5dca0db2..00000000 --- a/third_party/cef/include/capi/cef_download_handler_capi.h +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// -// $hash=d9cedd8c411dd064eacde55a95d6e05303dea365$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_DOWNLOAD_HANDLER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_DOWNLOAD_HANDLER_CAPI_H_ -#pragma once - -#include "include/capi/cef_base_capi.h" -#include "include/capi/cef_browser_capi.h" -#include "include/capi/cef_download_item_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// -// Callback structure used to asynchronously continue a download. -/// -typedef struct _cef_before_download_callback_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Call to continue the download. Set |download_path| to the full file path - // for the download including the file name or leave blank to use the - // suggested name and the default temp directory. Set |show_dialog| to true - // (1) if you do wish to show the default "Save As" dialog. - /// - void(CEF_CALLBACK* cont)(struct _cef_before_download_callback_t* self, - const cef_string_t* download_path, - int show_dialog); -} cef_before_download_callback_t; - -/// -// Callback structure used to asynchronously cancel a download. -/// -typedef struct _cef_download_item_callback_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Call to cancel the download. - /// - void(CEF_CALLBACK* cancel)(struct _cef_download_item_callback_t* self); - - /// - // Call to pause the download. - /// - void(CEF_CALLBACK* pause)(struct _cef_download_item_callback_t* self); - - /// - // Call to resume the download. - /// - void(CEF_CALLBACK* resume)(struct _cef_download_item_callback_t* self); -} cef_download_item_callback_t; - -/// -// Structure used to handle file downloads. The functions of this structure will -// called on the browser process UI thread. -/// -typedef struct _cef_download_handler_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Called before a download begins. |suggested_name| is the suggested name for - // the download file. By default the download will be canceled. Execute - // |callback| either asynchronously or in this function to continue the - // download if desired. Do not keep a reference to |download_item| outside of - // this function. - /// - void(CEF_CALLBACK* on_before_download)( - struct _cef_download_handler_t* self, - struct _cef_browser_t* browser, - struct _cef_download_item_t* download_item, - const cef_string_t* suggested_name, - struct _cef_before_download_callback_t* callback); - - /// - // Called when a download's status or progress information has been updated. - // This may be called multiple times before and after on_before_download(). - // Execute |callback| either asynchronously or in this function to cancel the - // download if desired. Do not keep a reference to |download_item| outside of - // this function. - /// - void(CEF_CALLBACK* on_download_updated)( - struct _cef_download_handler_t* self, - struct _cef_browser_t* browser, - struct _cef_download_item_t* download_item, - struct _cef_download_item_callback_t* callback); -} cef_download_handler_t; - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_DOWNLOAD_HANDLER_CAPI_H_ diff --git a/third_party/cef/include/capi/cef_download_item_capi.h b/third_party/cef/include/capi/cef_download_item_capi.h deleted file mode 100644 index 800a958a..00000000 --- a/third_party/cef/include/capi/cef_download_item_capi.h +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// -// $hash=c17ff4fd6d85b1db10dce2e1a5dbea5a4b17e4da$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_DOWNLOAD_ITEM_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_DOWNLOAD_ITEM_CAPI_H_ -#pragma once - -#include "include/capi/cef_base_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// -// Structure used to represent a download item. -/// -typedef struct _cef_download_item_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Returns true (1) if this object is valid. Do not call any other functions - // if this function returns false (0). - /// - int(CEF_CALLBACK* is_valid)(struct _cef_download_item_t* self); - - /// - // Returns true (1) if the download is in progress. - /// - int(CEF_CALLBACK* is_in_progress)(struct _cef_download_item_t* self); - - /// - // Returns true (1) if the download is complete. - /// - int(CEF_CALLBACK* is_complete)(struct _cef_download_item_t* self); - - /// - // Returns true (1) if the download has been canceled or interrupted. - /// - int(CEF_CALLBACK* is_canceled)(struct _cef_download_item_t* self); - - /// - // Returns a simple speed estimate in bytes/s. - /// - int64(CEF_CALLBACK* get_current_speed)(struct _cef_download_item_t* self); - - /// - // Returns the rough percent complete or -1 if the receive total size is - // unknown. - /// - int(CEF_CALLBACK* get_percent_complete)(struct _cef_download_item_t* self); - - /// - // Returns the total number of bytes. - /// - int64(CEF_CALLBACK* get_total_bytes)(struct _cef_download_item_t* self); - - /// - // Returns the number of received bytes. - /// - int64(CEF_CALLBACK* get_received_bytes)(struct _cef_download_item_t* self); - - /// - // Returns the time that the download started. - /// - cef_time_t(CEF_CALLBACK* get_start_time)(struct _cef_download_item_t* self); - - /// - // Returns the time that the download ended. - /// - cef_time_t(CEF_CALLBACK* get_end_time)(struct _cef_download_item_t* self); - - /// - // Returns the full path to the downloaded or downloading file. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_full_path)( - struct _cef_download_item_t* self); - - /// - // Returns the unique identifier for this download. - /// - uint32(CEF_CALLBACK* get_id)(struct _cef_download_item_t* self); - - /// - // Returns the URL. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_url)( - struct _cef_download_item_t* self); - - /// - // Returns the original URL before any redirections. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_original_url)( - struct _cef_download_item_t* self); - - /// - // Returns the suggested file name. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_suggested_file_name)( - struct _cef_download_item_t* self); - - /// - // Returns the content disposition. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_content_disposition)( - struct _cef_download_item_t* self); - - /// - // Returns the mime type. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_mime_type)( - struct _cef_download_item_t* self); -} cef_download_item_t; - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_DOWNLOAD_ITEM_CAPI_H_ diff --git a/third_party/cef/include/capi/cef_drag_data_capi.h b/third_party/cef/include/capi/cef_drag_data_capi.h deleted file mode 100644 index 1c0fb960..00000000 --- a/third_party/cef/include/capi/cef_drag_data_capi.h +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// -// $hash=b72ebf98f79f28a18366c037e65e98326d4a350a$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_DRAG_DATA_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_DRAG_DATA_CAPI_H_ -#pragma once - -#include "include/capi/cef_base_capi.h" -#include "include/capi/cef_image_capi.h" -#include "include/capi/cef_stream_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// -// Structure used to represent drag data. The functions of this structure may be -// called on any thread. -/// -typedef struct _cef_drag_data_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Returns a copy of the current object. - /// - struct _cef_drag_data_t*(CEF_CALLBACK* clone)(struct _cef_drag_data_t* self); - - /// - // Returns true (1) if this object is read-only. - /// - int(CEF_CALLBACK* is_read_only)(struct _cef_drag_data_t* self); - - /// - // Returns true (1) if the drag data is a link. - /// - int(CEF_CALLBACK* is_link)(struct _cef_drag_data_t* self); - - /// - // Returns true (1) if the drag data is a text or html fragment. - /// - int(CEF_CALLBACK* is_fragment)(struct _cef_drag_data_t* self); - - /// - // Returns true (1) if the drag data is a file. - /// - int(CEF_CALLBACK* is_file)(struct _cef_drag_data_t* self); - - /// - // Return the link URL that is being dragged. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_link_url)( - struct _cef_drag_data_t* self); - - /// - // Return the title associated with the link being dragged. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_link_title)( - struct _cef_drag_data_t* self); - - /// - // Return the metadata, if any, associated with the link being dragged. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_link_metadata)( - struct _cef_drag_data_t* self); - - /// - // Return the plain text fragment that is being dragged. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_fragment_text)( - struct _cef_drag_data_t* self); - - /// - // Return the text/html fragment that is being dragged. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_fragment_html)( - struct _cef_drag_data_t* self); - - /// - // Return the base URL that the fragment came from. This value is used for - // resolving relative URLs and may be NULL. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_fragment_base_url)( - struct _cef_drag_data_t* self); - - /// - // Return the name of the file being dragged out of the browser window. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_file_name)( - struct _cef_drag_data_t* self); - - /// - // Write the contents of the file being dragged out of the web view into - // |writer|. Returns the number of bytes sent to |writer|. If |writer| is NULL - // this function will return the size of the file contents in bytes. Call - // get_file_name() to get a suggested name for the file. - /// - size_t(CEF_CALLBACK* get_file_contents)(struct _cef_drag_data_t* self, - struct _cef_stream_writer_t* writer); - - /// - // Retrieve the list of file names that are being dragged into the browser - // window. - /// - int(CEF_CALLBACK* get_file_names)(struct _cef_drag_data_t* self, - cef_string_list_t names); - - /// - // Set the link URL that is being dragged. - /// - void(CEF_CALLBACK* set_link_url)(struct _cef_drag_data_t* self, - const cef_string_t* url); - - /// - // Set the title associated with the link being dragged. - /// - void(CEF_CALLBACK* set_link_title)(struct _cef_drag_data_t* self, - const cef_string_t* title); - - /// - // Set the metadata associated with the link being dragged. - /// - void(CEF_CALLBACK* set_link_metadata)(struct _cef_drag_data_t* self, - const cef_string_t* data); - - /// - // Set the plain text fragment that is being dragged. - /// - void(CEF_CALLBACK* set_fragment_text)(struct _cef_drag_data_t* self, - const cef_string_t* text); - - /// - // Set the text/html fragment that is being dragged. - /// - void(CEF_CALLBACK* set_fragment_html)(struct _cef_drag_data_t* self, - const cef_string_t* html); - - /// - // Set the base URL that the fragment came from. - /// - void(CEF_CALLBACK* set_fragment_base_url)(struct _cef_drag_data_t* self, - const cef_string_t* base_url); - - /// - // Reset the file contents. You should do this before calling - // cef_browser_host_t::DragTargetDragEnter as the web view does not allow us - // to drag in this kind of data. - /// - void(CEF_CALLBACK* reset_file_contents)(struct _cef_drag_data_t* self); - - /// - // Add a file that is being dragged into the webview. - /// - void(CEF_CALLBACK* add_file)(struct _cef_drag_data_t* self, - const cef_string_t* path, - const cef_string_t* display_name); - - /// - // Get the image representation of drag data. May return NULL if no image - // representation is available. - /// - struct _cef_image_t*(CEF_CALLBACK* get_image)(struct _cef_drag_data_t* self); - - /// - // Get the image hotspot (drag start location relative to image dimensions). - /// - cef_point_t(CEF_CALLBACK* get_image_hotspot)(struct _cef_drag_data_t* self); - - /// - // Returns true (1) if an image representation of drag data is available. - /// - int(CEF_CALLBACK* has_image)(struct _cef_drag_data_t* self); -} cef_drag_data_t; - -/// -// Create a new cef_drag_data_t object. -/// -CEF_EXPORT cef_drag_data_t* cef_drag_data_create(); - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_DRAG_DATA_CAPI_H_ diff --git a/third_party/cef/include/capi/cef_drag_handler_capi.h b/third_party/cef/include/capi/cef_drag_handler_capi.h deleted file mode 100644 index 6f975e3b..00000000 --- a/third_party/cef/include/capi/cef_drag_handler_capi.h +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// -// $hash=88d9a33295e7fb7238bcb18b25d12906ba4cb791$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_DRAG_HANDLER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_DRAG_HANDLER_CAPI_H_ -#pragma once - -#include "include/capi/cef_base_capi.h" -#include "include/capi/cef_browser_capi.h" -#include "include/capi/cef_drag_data_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/// -// Implement this structure to handle events related to dragging. The functions -// of this structure will be called on the UI thread. -/// -typedef struct _cef_drag_handler_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Called when an external drag event enters the browser window. |dragData| - // contains the drag event data and |mask| represents the type of drag - // operation. Return false (0) for default drag handling behavior or true (1) - // to cancel the drag event. - /// - int(CEF_CALLBACK* on_drag_enter)(struct _cef_drag_handler_t* self, - struct _cef_browser_t* browser, - struct _cef_drag_data_t* dragData, - cef_drag_operations_mask_t mask); - - /// - // Called whenever draggable regions for the browser window change. These can - // be specified using the '-webkit-app-region: drag/no-drag' CSS-property. If - // draggable regions are never defined in a document this function will also - // never be called. If the last draggable region is removed from a document - // this function will be called with an NULL vector. - /// - void(CEF_CALLBACK* on_draggable_regions_changed)( - struct _cef_drag_handler_t* self, - struct _cef_browser_t* browser, - size_t regionsCount, - cef_draggable_region_t const* regions); -} cef_drag_handler_t; - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_DRAG_HANDLER_CAPI_H_ diff --git a/third_party/cef/include/capi/cef_extension_capi.h b/third_party/cef/include/capi/cef_extension_capi.h deleted file mode 100644 index def2cb1d..00000000 --- a/third_party/cef/include/capi/cef_extension_capi.h +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// -// $hash=b681f766235613cce8a09617e7ffb76fee5545a2$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_EXTENSION_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_EXTENSION_CAPI_H_ -#pragma once - -#include "include/capi/cef_base_capi.h" -#include "include/capi/cef_values_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct _cef_extension_handler_t; -struct _cef_request_context_t; - -/// -// Object representing an extension. Methods may be called on any thread unless -// otherwise indicated. -/// -typedef struct _cef_extension_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Returns the unique extension identifier. This is calculated based on the - // extension public key, if available, or on the extension path. See - // https://developer.chrome.com/extensions/manifest/key for details. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_identifier)( - struct _cef_extension_t* self); - - /// - // Returns the absolute path to the extension directory on disk. This value - // will be prefixed with PK_DIR_RESOURCES if a relative path was passed to - // cef_request_tContext::LoadExtension. - /// - // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_path)(struct _cef_extension_t* self); - - /// - // Returns the extension manifest contents as a cef_dictionary_value_t object. - // See https://developer.chrome.com/extensions/manifest for details. - /// - struct _cef_dictionary_value_t*(CEF_CALLBACK* get_manifest)( - struct _cef_extension_t* self); - - /// - // Returns true (1) if this object is the same extension as |that| object. - // Extensions are considered the same if identifier, path and loader context - // match. - /// - int(CEF_CALLBACK* is_same)(struct _cef_extension_t* self, - struct _cef_extension_t* that); - - /// - // Returns the handler for this extension. Will return NULL for internal - // extensions or if no handler was passed to - // cef_request_tContext::LoadExtension. - /// - struct _cef_extension_handler_t*(CEF_CALLBACK* get_handler)( - struct _cef_extension_t* self); - - /// - // Returns the request context that loaded this extension. Will return NULL - // for internal extensions or if the extension has been unloaded. See the - // cef_request_tContext::LoadExtension documentation for more information - // about loader contexts. Must be called on the browser process UI thread. - /// - struct _cef_request_context_t*(CEF_CALLBACK* get_loader_context)( - struct _cef_extension_t* self); - - /// - // Returns true (1) if this extension is currently loaded. Must be called on - // the browser process UI thread. - /// - int(CEF_CALLBACK* is_loaded)(struct _cef_extension_t* self); - - /// - // Unload this extension if it is not an internal extension and is currently - // loaded. Will result in a call to - // cef_extension_tHandler::OnExtensionUnloaded on success. - /// - void(CEF_CALLBACK* unload)(struct _cef_extension_t* self); -} cef_extension_t; - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_EXTENSION_CAPI_H_ diff --git a/third_party/cef/include/capi/cef_extension_handler_capi.h b/third_party/cef/include/capi/cef_extension_handler_capi.h deleted file mode 100644 index e9848b23..00000000 --- a/third_party/cef/include/capi/cef_extension_handler_capi.h +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// -// $hash=9ce34129b7058aaba2e2f77cd63e3edb23e70bb7$ -// - -#ifndef CEF_INCLUDE_CAPI_CEF_EXTENSION_HANDLER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_EXTENSION_HANDLER_CAPI_H_ -#pragma once - -#include "include/capi/cef_base_capi.h" -#include "include/capi/cef_browser_capi.h" -#include "include/capi/cef_extension_capi.h" -#include "include/capi/cef_stream_capi.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct _cef_client_t; - -/// -// Callback structure used for asynchronous continuation of -// cef_extension_tHandler::GetExtensionResource. -/// -typedef struct _cef_get_extension_resource_callback_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Continue the request. Read the resource contents from |stream|. - /// - void(CEF_CALLBACK* cont)(struct _cef_get_extension_resource_callback_t* self, - struct _cef_stream_reader_t* stream); - - /// - // Cancel the request. - /// - void(CEF_CALLBACK* cancel)( - struct _cef_get_extension_resource_callback_t* self); -} cef_get_extension_resource_callback_t; - -/// -// Implement this structure to handle events related to browser extensions. The -// functions of this structure will be called on the UI thread. See -// cef_request_tContext::LoadExtension for information about extension loading. -/// -typedef struct _cef_extension_handler_t { - /// - // Base structure. - /// - cef_base_ref_counted_t base; - - /// - // Called if the cef_request_tContext::LoadExtension request fails. |result| - // will be the error code. - /// - void(CEF_CALLBACK* on_extension_load_failed)( - struct _cef_extension_handler_t* self, - cef_errorcode_t result); - - /// - // Called if the cef_request_tContext::LoadExtension request succeeds. - // |extension| is the loaded extension. - /// - void(CEF_CALLBACK* on_extension_loaded)(struct _cef_extension_handler_t* self, - struct _cef_extension_t* extension); - - /// - // Called after the cef_extension_t::Unload request has completed. - /// - void(CEF_CALLBACK* on_extension_unloaded)( - struct _cef_extension_handler_t* self, - struct _cef_extension_t* extension); - - /// - // Called when an extension needs a browser to host a background script - // specified via the "background" manifest key. The browser will have no - // visible window and cannot be displayed. |extension| is the extension that - // is loading the background script. |url| is an internally generated - // reference to an HTML page that will be used to load the background script - // via a