From 3b2be7001c7e8d87bddc1ff5655473007ec4ea3b Mon Sep 17 00:00:00 2001 From: Gautam Jha Date: Mon, 24 Sep 2018 17:17:38 +0530 Subject: [PATCH 1/5] CEF 3202 Mac --- Gruntfile.js | 6 +++--- appshell.gyp | 5 ++++- appshell/appshell_extension_handler.h | 2 +- appshell/client_app.h | 6 +++--- appshell/client_app_delegates.cpp | 2 +- appshell/client_handler.cpp | 2 -- appshell/client_handler.h | 6 ++---- appshell/command_callbacks.h | 2 +- appshell_paths.gypi | 4 ++-- common.gypi | 2 ++ package.json | 2 +- tasks/setup.js | 6 +++--- 12 files changed, 23 insertions(+), 22 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 2603d6977..e9867bab7 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -27,7 +27,7 @@ module.exports = function (grunt) { var common = require("./tasks/common")(grunt), platform = common.platform(), staging, - cef_version = "3.2623.1397"; + cef_version = "3.3202.1694.gf061c23"; if (platform === "mac") { staging = "installer/mac/staging/<%= build.name %>.app/Contents"; @@ -323,7 +323,7 @@ module.exports = function (grunt) { } }, "cef": { - "url" : "http://s3.amazonaws.com/files.brackets.io/cef", + "url" : "http://localhost:8000", "version" : cef_version }, "node": { @@ -346,4 +346,4 @@ module.exports = function (grunt) { grunt.loadNpmTasks("grunt-curl"); grunt.registerTask("default", ["setup", "build"]); -}; \ No newline at end of file +}; diff --git a/appshell.gyp b/appshell.gyp index 366557118..37a7fab2c 100755 --- a/appshell.gyp +++ b/appshell.gyp @@ -51,6 +51,7 @@ ], 'defines': [ 'USING_CEF_SHARED', + 'WRAPING_CEF_SHARED', ], 'include_dirs': [ '.', @@ -444,6 +445,7 @@ 'msvs_guid': 'A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9', 'defines': [ 'USING_CEF_SHARED', + 'WRAPPING_CEF_SHARED', ], 'configurations': { 'Common_Base': { @@ -521,6 +523,7 @@ ], 'defines': [ 'USING_CEF_SHARED', + 'WRAPING_CEF_SHARED', ], 'include_dirs': [ '.', @@ -628,4 +631,4 @@ }, }], ], -} \ No newline at end of file +} diff --git a/appshell/appshell_extension_handler.h b/appshell/appshell_extension_handler.h index 588f42bbf..48138d3bf 100644 --- a/appshell/appshell_extension_handler.h +++ b/appshell/appshell_extension_handler.h @@ -157,7 +157,7 @@ class AppShellExtensionHandler : public CefV8Handler { CefRefPtr object, const CefV8ValueList& arguments, CefRefPtr& retval, - CefString& exception) { + CefString& exception) OVERRIDE { // The only messages that are handled here is getElapsedMilliseconds(), // GetCurrentLanguage(), GetApplicationSupportDirectory(), and GetRemoteDebuggingPort(). diff --git a/appshell/client_app.h b/appshell/client_app.h index f1a64940c..7e16eb5c7 100644 --- a/appshell/client_app.h +++ b/appshell/client_app.h @@ -20,7 +20,7 @@ class ClientApp : public CefApp, // Interface for renderer delegates. All RenderDelegates must be returned via // CreateRenderDelegates. Do not perform work in the RenderDelegate // constructor. See CefRenderProcessHandler for documentation. - class RenderDelegate : public virtual CefBase { + class RenderDelegate : public virtual CefBaseRefCounted { public: virtual void OnRenderThreadCreated(CefRefPtr app, CefRefPtr extra_info) {} @@ -93,11 +93,11 @@ class ClientApp : public CefApp, static void CreateRenderDelegates(RenderDelegateSet& delegates); // Registers custom schemes. Implemented in client_app_delegates. - static void RegisterCustomSchemes(CefRefPtr registrar); + static void RegisterCustomSchemes(CefRawPtr registrar); // CefApp methods. virtual void OnRegisterCustomSchemes( - CefRefPtr registrar) OVERRIDE { + CefRawPtr registrar) OVERRIDE { RegisterCustomSchemes(registrar); } virtual CefRefPtr GetRenderProcessHandler() diff --git a/appshell/client_app_delegates.cpp b/appshell/client_app_delegates.cpp index f8345d852..a093b358c 100644 --- a/appshell/client_app_delegates.cpp +++ b/appshell/client_app_delegates.cpp @@ -9,5 +9,5 @@ void ClientApp::CreateRenderDelegates(RenderDelegateSet& delegates) { } // static -void ClientApp::RegisterCustomSchemes(CefRefPtr registrar) { +void ClientApp::RegisterCustomSchemes(CefRawPtr registrar) { } diff --git a/appshell/client_handler.cpp b/appshell/client_handler.cpp index 83d3d8f6f..b4a32c777 100644 --- a/appshell/client_handler.cpp +++ b/appshell/client_handler.cpp @@ -205,9 +205,7 @@ bool ClientHandler::OnDragEnter(CefRefPtr browser, void ClientHandler::OnLoadStart(CefRefPtr browser, CefRefPtr frame - #ifdef OS_LINUX ,TransitionType transition_type - #endif ) { CEF_REQUIRE_UI_THREAD(); diff --git a/appshell/client_handler.h b/appshell/client_handler.h index 7c67a3598..0395e2d25 100644 --- a/appshell/client_handler.h +++ b/appshell/client_handler.h @@ -37,7 +37,7 @@ class ClientHandler : public CefClient, public: // Interface for process message delegates. Do not perform work in the // RenderDelegate constructor. - class ProcessMessageDelegate : public virtual CefBase { + class ProcessMessageDelegate : public virtual CefBaseRefCounted { public: // Called when a process message is received. Return true if the message was // handled and should not be passed on to other handlers. @@ -57,7 +57,7 @@ class ClientHandler : public CefClient, // Interface for request handler delegates. Do not perform work in the // RequestDelegate constructor. - class RequestDelegate : public virtual CefBase { + class RequestDelegate : public virtual CefBaseRefCounted { public: // Called to retrieve a resource handler. virtual CefRefPtr GetResourceHandler( @@ -135,9 +135,7 @@ virtual bool OnBeforePopup(CefRefPtr browser, // CefLoadHandler methods virtual void OnLoadStart(CefRefPtr browser, CefRefPtr frame - #ifdef OS_LINUX ,TransitionType transition_type - #endif ) OVERRIDE; virtual void OnLoadEnd(CefRefPtr browser, CefRefPtr frame, diff --git a/appshell/command_callbacks.h b/appshell/command_callbacks.h index 709797c48..8ff25fe51 100644 --- a/appshell/command_callbacks.h +++ b/appshell/command_callbacks.h @@ -53,7 +53,7 @@ const ExtensionString EDIT_SELECT_ALL = "edit.selectAll"; #endif // Base CommandCallback class -class CommandCallback : public CefBase { +class CommandCallback : public CefBaseRefCounted { public: // Called when the command is complete. When handled=true, the command diff --git a/appshell_paths.gypi b/appshell_paths.gypi index 3b14692a1..a9af24301 100755 --- a/appshell_paths.gypi +++ b/appshell_paths.gypi @@ -120,8 +120,8 @@ 'libcef_dll/base/cef_thread_checker_impl.cc', 'libcef_dll/base/cef_thread_collision_warner.cc', 'libcef_dll/base/cef_weak_ptr.cc', - 'libcef_dll/cpptoc/base_cpptoc.cc', - 'libcef_dll/cpptoc/base_cpptoc.h', + 'libcef_dll/cpptoc/base_ref_counted_cpptoc.cc', + 'libcef_dll/cpptoc/base_ref_counted_cpptoc.h', 'libcef_dll/cpptoc/cpptoc.h', 'libcef_dll/ctocpp/ctocpp.h', 'libcef_dll/transfer_util.cc', diff --git a/common.gypi b/common.gypi index 8289d37fe..d84667a39 100644 --- a/common.gypi +++ b/common.gypi @@ -2266,6 +2266,7 @@ # Note: this is *required* to make some plugins work. '-fvisibility=hidden', '-pipe', + '-Wno-undefined-var-template', ], 'cflags_cc': [ '-fno-rtti', @@ -3119,6 +3120,7 @@ # Don't warn about the "struct foo f = {0};" initialization # pattern. '-Wno-missing-field-initializers', + '-Wno-undefined-var-template', ], 'conditions': [ ['chromium_mac_pch', {'GCC_PRECOMPILE_PREFIX_HEADER': 'YES'}, diff --git a/package.json b/package.json index e8dbf740e..12068a7d2 100644 --- a/package.json +++ b/package.json @@ -28,4 +28,4 @@ "install": "", "postinstall": "bash -c 'mv .appshell.gyp appshell.gyp;'" } -} \ No newline at end of file +} diff --git a/tasks/setup.js b/tasks/setup.js index 381fe2fbc..464bd71fc 100644 --- a/tasks/setup.js +++ b/tasks/setup.js @@ -384,10 +384,10 @@ module.exports = function (grunt) { var memo = path.resolve(process.cwd(), "deps/cef/" + zipName + ".txt"), permissionsPromise; - if (platform === "mac") { + /*if (platform === "mac") { // FIXME figure out how to use fs.chmod to only do additive mode u+x permissionsPromise = exec("chmod u+x deps/cef/tools/*"); - } else { + } else */{ permissionsPromise = q.resolve(); } @@ -688,4 +688,4 @@ module.exports = function (grunt) { } else { grunt.registerTask("setup", ["cef", "node", "node-check", "icu", "create-project"]); } -}; \ No newline at end of file +}; From e0eadaa81e686f52d29f6c3ce6370932619e601c Mon Sep 17 00:00:00 2001 From: Gautam Jha Date: Mon, 24 Sep 2018 23:28:07 +0530 Subject: [PATCH 2/5] CEF 3202 --- appshell.gyp | 32 +++--- appshell/cefclient_mac.mm | 1 - common.gypi | 220 +++++++++++++++++++------------------- 3 files changed, 126 insertions(+), 127 deletions(-) diff --git a/appshell.gyp b/appshell.gyp index 37a7fab2c..0bc4706bd 100755 --- a/appshell.gyp +++ b/appshell.gyp @@ -305,22 +305,22 @@ '${BUILT_PRODUCTS_DIR}/${EXECUTABLE_FOLDER_PATH}/Brackets-node', ], }, - { - # This postbuid step is responsible for creating the following - # helpers: - # - # <(appname) Helper EH.app and <(appname) Helper NP.app are created - # from <(appname) Helper.app. - # - # The EH helper is marked for an executable heap. The NP helper - # is marked for no PIE (ASLR). - 'postbuild_name': 'Make More Helpers', - 'action': [ - 'tools/make_more_helpers.sh', - 'Frameworks', - '<(appname)', - ], - }, +# { +# # This postbuid step is responsible for creating the following +# # helpers: +# # +# # <(appname) Helper EH.app and <(appname) Helper NP.app are created +# # from <(appname) Helper.app. +# # +# # The EH helper is marked for an executable heap. The NP helper +# # is marked for no PIE (ASLR). +# 'postbuild_name': 'Make More Helpers', +# 'action': [ +# 'tools/make_more_helpers.sh', +# 'Frameworks', +# '<(appname)', +# ], +# }, ], 'link_settings': { 'libraries': [ diff --git a/appshell/cefclient_mac.mm b/appshell/cefclient_mac.mm index d588bbd30..09eb5e61a 100644 --- a/appshell/cefclient_mac.mm +++ b/appshell/cefclient_mac.mm @@ -13,7 +13,6 @@ #import "include/cef_application_mac.h" #include "include/cef_browser.h" #include "include/cef_frame.h" -#include "include/cef_runnable.h" #include "client_handler.h" #include "appshell/browser/resource_util.h" #include "config.h" diff --git a/common.gypi b/common.gypi index d84667a39..69b294238 100644 --- a/common.gypi +++ b/common.gypi @@ -3241,116 +3241,116 @@ '-fno-strict-aliasing', # See http://crbug.com/32204 ], }, - 'target_conditions': [ - ['_type=="executable"', { - 'postbuilds': [ - { - # Arranges for data (heap) pages to be protected against - # code execution when running on Mac OS X 10.7 ("Lion"), and - # ensures that the position-independent executable (PIE) bit - # is set for ASLR when running on Mac OS X 10.5 ("Leopard"). - 'variables': { - # Define change_mach_o_flags in a variable ending in _path - # so that GYP understands it's a path and performs proper - # relativization during dict merging. - 'change_mach_o_flags_path': - 'mac/change_mach_o_flags_from_xcode.sh', - 'change_mach_o_flags_options%': [ - ], - 'target_conditions': [ - ['mac_pie==0 or release_valgrind_build==1', { - # Don't enable PIE if it's unwanted. It's unwanted if - # the target specifies mac_pie=0 or if building for - # Valgrind, because Valgrind doesn't understand slide. - # See the similar mac_pie/release_valgrind_build check - # below. - 'change_mach_o_flags_options': [ - '--no-pie', - ], - }], - ], - }, - 'postbuild_name': 'Change Mach-O Flags', - 'action': [ - '<(change_mach_o_flags_path)', - '>@(change_mach_o_flags_options)', - ], - }, - ], - 'conditions': [ - ['asan==1', { - 'variables': { - 'asan_saves_file': 'asan.saves', - }, - 'xcode_settings': { - 'CHROMIUM_STRIP_SAVE_FILE': '<(asan_saves_file)', - }, - }], - ], - 'target_conditions': [ - ['mac_pie==1 and release_valgrind_build==0', { - # Turn on position-independence (ASLR) for executables. When - # PIE is on for the Chrome executables, the framework will - # also be subject to ASLR. - # Don't do this when building for Valgrind, because Valgrind - # doesn't understand slide. TODO: Make Valgrind on Mac OS X - # understand slide, and get rid of the Valgrind check. - 'xcode_settings': { - 'OTHER_LDFLAGS': [ - '-Wl,-pie', # Position-independent executable (MH_PIE) - ], - }, - }], - ], - }], - ['(_type=="executable" or _type=="shared_library" or \ - _type=="loadable_module") and mac_strip!=0', { - 'target_conditions': [ - ['mac_real_dsym == 1', { - # To get a real .dSYM bundle produced by dsymutil, set the - # debug information format to dwarf-with-dsym. Since - # strip_from_xcode will not be used, set Xcode to do the - # stripping as well. - 'configurations': { - 'Release_Base': { - 'xcode_settings': { - 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym', - 'DEPLOYMENT_POSTPROCESSING': 'YES', - 'STRIP_INSTALLED_PRODUCT': 'YES', - 'target_conditions': [ - ['_type=="shared_library" or _type=="loadable_module"', { - # The Xcode default is to strip debugging symbols - # only (-S). Local symbols should be stripped as - # well, which will be handled by -x. Xcode will - # continue to insert -S when stripping even when - # additional flags are added with STRIPFLAGS. - 'STRIPFLAGS': '-x', - }], # _type=="shared_library" or _type=="loadable_module"' - ], # target_conditions - }, # xcode_settings - }, # configuration "Release" - }, # configurations - }, { # mac_real_dsym != 1 - # To get a fast fake .dSYM bundle, use a post-build step to - # produce the .dSYM and strip the executable. strip_from_xcode - # only operates in the Release configuration. - 'postbuilds': [ - { - 'variables': { - # Define strip_from_xcode in a variable ending in _path - # so that gyp understands it's a path and performs proper - # relativization during dict merging. - 'strip_from_xcode_path': 'mac/strip_from_xcode' - }, - 'postbuild_name': 'Strip If Needed', - 'action': ['scripts/strip_from_xcode.sh'] - }, - ], # postbuilds - }], # mac_real_dsym - ], # target_conditions - }], # (_type=="executable" or _type=="shared_library" or - # _type=="loadable_module") and mac_strip!=0 - ], # target_conditions +# 'target_conditions': [ +# ['_type=="executable"', { +# 'postbuilds': [ +# { +# # Arranges for data (heap) pages to be protected against +# # code execution when running on Mac OS X 10.7 ("Lion"), and +# # ensures that the position-independent executable (PIE) bit +# # is set for ASLR when running on Mac OS X 10.5 ("Leopard"). +# 'variables': { +# # Define change_mach_o_flags in a variable ending in _path +# # so that GYP understands it's a path and performs proper +# # relativization during dict merging. +# 'change_mach_o_flags_path': +# 'mac/change_mach_o_flags_from_xcode.sh', +# 'change_mach_o_flags_options%': [ +# ], +# 'target_conditions': [ +# ['mac_pie==0 or release_valgrind_build==1', { +# # Don't enable PIE if it's unwanted. It's unwanted if +# # the target specifies mac_pie=0 or if building for +# # Valgrind, because Valgrind doesn't understand slide. +# # See the similar mac_pie/release_valgrind_build check +# # below. +# 'change_mach_o_flags_options': [ +# '--no-pie', +# ], +# }], +# ], +# }, +# 'postbuild_name': 'Change Mach-O Flags', +# 'action': [ +# '<(change_mach_o_flags_path)', +# '>@(change_mach_o_flags_options)', +# ], +# }, +# ], +# 'conditions': [ +# ['asan==1', { +# 'variables': { +# 'asan_saves_file': 'asan.saves', +# }, +# 'xcode_settings': { +# 'CHROMIUM_STRIP_SAVE_FILE': '<(asan_saves_file)', +# }, +# }], +# ], +# 'target_conditions': [ +# ['mac_pie==1 and release_valgrind_build==0', { +# # Turn on position-independence (ASLR) for executables. When +# # PIE is on for the Chrome executables, the framework will +# # also be subject to ASLR. +# # Don't do this when building for Valgrind, because Valgrind +# # doesn't understand slide. TODO: Make Valgrind on Mac OS X +# # understand slide, and get rid of the Valgrind check. +# 'xcode_settings': { +# 'OTHER_LDFLAGS': [ +# '-Wl,-pie', # Position-independent executable (MH_PIE) +# ], +# }, +# }], +# ], +# }], +# ['(_type=="executable" or _type=="shared_library" or \ +# _type=="loadable_module") and mac_strip!=0', { +# 'target_conditions': [ +# ['mac_real_dsym == 1', { +# # To get a real .dSYM bundle produced by dsymutil, set the +# # debug information format to dwarf-with-dsym. Since +# # strip_from_xcode will not be used, set Xcode to do the +# # stripping as well. +# 'configurations': { +# 'Release_Base': { +# 'xcode_settings': { +# 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym', +# 'DEPLOYMENT_POSTPROCESSING': 'YES', +# 'STRIP_INSTALLED_PRODUCT': 'YES', +# 'target_conditions': [ +# ['_type=="shared_library" or _type=="loadable_module"', { +# # The Xcode default is to strip debugging symbols +# # only (-S). Local symbols should be stripped as +# # well, which will be handled by -x. Xcode will +# # continue to insert -S when stripping even when +# # additional flags are added with STRIPFLAGS. +# 'STRIPFLAGS': '-x', +# }], # _type=="shared_library" or _type=="loadable_module"' +# ], # target_conditions +# }, # xcode_settings +# }, # configuration "Release" +# }, # configurations +# }, { # mac_real_dsym != 1 +# # To get a fast fake .dSYM bundle, use a post-build step to +# # produce the .dSYM and strip the executable. strip_from_xcode +# # only operates in the Release configuration. +# 'postbuilds': [ +# { +# 'variables': { +# # Define strip_from_xcode in a variable ending in _path +# # so that gyp understands it's a path and performs proper +# # relativization during dict merging. +# 'strip_from_xcode_path': 'mac/strip_from_xcode' +# }, +# 'postbuild_name': 'Strip If Needed', +# 'action': ['scripts/strip_from_xcode.sh'] +# }, +# ], # postbuilds +# }], # mac_real_dsym +# ], # target_conditions +# }], # (_type=="executable" or _type=="shared_library" or +# # _type=="loadable_module") and mac_strip!=0 +# ], # target_conditions }, # target_defaults }], # OS=="mac" ['OS=="ios"', { From 1b4eec0d15e38d05a80dd6a91dc477844a229acb Mon Sep 17 00:00:00 2001 From: Gautam Jha Date: Tue, 2 Oct 2018 17:49:43 +0530 Subject: [PATCH 3/5] Win64 build fix --- Gruntfile.js | 32 +++++++++++--- appshell/appshell_extension_handler.h | 6 +-- appshell/appshell_extensions_platform.cpp | 2 +- appshell/appshell_extensions_win.cpp | 39 +++++++++-------- appshell/appshell_node_process_win.cpp | 2 +- appshell/cef_dark_window.cpp | 10 ++--- appshell/cef_host_window.cpp | 2 +- appshell/cef_main_window.cpp | 2 +- appshell/cef_registry.cpp | 2 +- appshell/cef_window.cpp | 6 +-- appshell/cef_window.h | 53 +++++++++++++++++++---- appshell/cefclient_win.cpp | 5 +-- appshell/client_app.cpp | 2 +- tasks/setup.js | 21 ++++++--- 14 files changed, 125 insertions(+), 59 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index e9867bab7..7fed4c702 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -89,23 +89,43 @@ module.exports = function (grunt) { "src" : "<%= icu.url %>/icu_<%= icu.version %>_macosx64.zip" }, /* win */ - "cef-win": { + "cef-win32": { "dest" : "<%= downloads %>", "src" : "<%= cef.url %>/cef_binary_<%= cef.version %>_windows32.zip" }, - "cef-win-symbols": { + "cef-win32-symbols": { "src" : ["<%= cef.url %>/cef_binary_<%= cef.version %>_windows32_debug_symbols.zip", "<%= cef.url %>/cef_binary_<%= cef.version %>_windows32_release_symbols.zip"], "dest" : "<%= downloads %>/cefsymbols" }, - "node-win": { + "node-win32": { "dest" : "<%= downloads %>", "src" : "http://nodejs.org/dist/v<%= node.version %>/win-x86/node.exe" }, - "icu-win": { + "icu-win32": { "dest" : "<%= downloads %>", "src" : "<%= icu.url %>/icu_<%= icu.version %>_windows32.zip" }, - "vs-crt-win": { + "vs-crt-win32": { + "dest" : "<%= downloads %>", + "src" : "<%= vsCrt.url %>/vs<%= vsCrt.version %>-crt-ia32.zip" + }, + "cef-win64": { + "dest" : "<%= downloads %>", + "src" : "<%= cef.url %>/cef_binary_<%= cef.version %>_windows64.zip" + }, + "cef-win64-symbols": { + "src" : ["<%= cef.url %>/cef_binary_<%= cef.version %>_windows64_debug_symbols.zip", "<%= cef.url %>/cef_binary_<%= cef.version %>_windows64_release_symbols.zip"], + "dest" : "<%= downloads %>/cefsymbols" + }, + "node-win64": { + "dest" : "<%= downloads %>", + "src" : "http://nodejs.org/dist/v<%= node.version %>/win-x86/node.exe" + }, + "icu-win64": { + "dest" : "<%= downloads %>", + "src" : "<%= icu.url %>/icu_<%= icu.version %>_windows64.zip" + }, + "vs-crt-win64": { "dest" : "<%= downloads %>", "src" : "<%= vsCrt.url %>/vs<%= vsCrt.version %>-crt-ia32.zip" } @@ -330,7 +350,7 @@ module.exports = function (grunt) { "version" : "6.11.0" }, "icu": { - "url" : "http://s3.amazonaws.com/files.brackets.io/icu", + "url" : "http://localhost:8001", "version" : "58" }, "vsCrt": { diff --git a/appshell/appshell_extension_handler.h b/appshell/appshell_extension_handler.h index 48138d3bf..d84891b90 100644 --- a/appshell/appshell_extension_handler.h +++ b/appshell/appshell_extension_handler.h @@ -74,7 +74,7 @@ CefRefPtr ListValueToV8Value(CefRefPtr value, int inde switch (type) { case VTYPE_LIST: { CefRefPtr list = value->GetList(index); - new_value = CefV8Value::CreateArray(list->GetSize()); + new_value = CefV8Value::CreateArray(static_cast(list->GetSize())); SetList(list, new_value); } break; case VTYPE_BOOL: @@ -106,7 +106,7 @@ void SetListValue(CefRefPtr list, int index, switch (type) { case VTYPE_LIST: { CefRefPtr listValue = value->GetList(index); - new_value = CefV8Value::CreateArray(listValue->GetSize()); + new_value = CefV8Value::CreateArray(static_cast(listValue->GetSize())); SetList(listValue, new_value); } break; case VTYPE_BOOL: @@ -136,7 +136,7 @@ void SetListValue(CefRefPtr list, int index, void SetList(CefRefPtr source, CefRefPtr target) { DCHECK(target->IsArray()); - int arg_length = source->GetSize(); + int arg_length = static_cast(source->GetSize()); if (arg_length == 0) return; diff --git a/appshell/appshell_extensions_platform.cpp b/appshell/appshell_extensions_platform.cpp index 943b003d4..3865b4969 100644 --- a/appshell/appshell_extensions_platform.cpp +++ b/appshell/appshell_extensions_platform.cpp @@ -31,7 +31,7 @@ void CharSetDetect::operator()(const char* bufferData, size_t bufferLength, std: const UCharsetMatch* charsetMatch_; // send text - ucsdet_setText(m_charsetDetector_, bufferData, bufferLength, &error); + ucsdet_setText(m_charsetDetector_, bufferData, static_cast(bufferLength), &error); if (U_FAILURE(error)) throw "Failed to set text"; diff --git a/appshell/appshell_extensions_win.cpp b/appshell/appshell_extensions_win.cpp index e5666fa7f..bde79f125 100644 --- a/appshell/appshell_extensions_win.cpp +++ b/appshell/appshell_extensions_win.cpp @@ -25,6 +25,7 @@ #include "appshell/appshell_helpers.h" #include "native_menu_model.h" +#include "cef_window.h" #include #include @@ -278,7 +279,7 @@ void CALLBACK LiveBrowserMgrWin::CloseLiveBrowserAsyncCallback( HWND hwnd, UINT } else if(s_instance->m_closeLiveBrowserHeartbeatTimerId == 0){ //start a heartbeat timer to see if it closes after the message returned - s_instance->m_closeLiveBrowserHeartbeatTimerId = ::SetTimer(NULL, 0, 30, CloseLiveBrowserTimerCallback); + s_instance->m_closeLiveBrowserHeartbeatTimerId = ::SetTimer(NULL, 0, 30, bit_cast(&CloseLiveBrowserTimerCallback)); } } @@ -356,7 +357,7 @@ int32 OpenLiveBrowser(ExtensionString argURL, bool enableRemoteDebugging) args += argURL; // Args must be mutable - int argsBufSize = args.length() +1; + int argsBufSize = static_cast(args.length()) +1; std::vector argsBuf; argsBuf.resize(argsBufSize); wcscpy(&argsBuf[0], args.c_str()); @@ -399,13 +400,13 @@ void CloseLiveBrowser(CefRefPtr browser, CefRefPtrCloseLiveBrowserFireCallback(NO_ERROR); } else if (liveBrowserMgr->GetCloseCallback()) { // set a timeout for up to 10 seconds to close the browser - liveBrowserMgr->SetCloseTimeoutTimerId( ::SetTimer(NULL, 0, 10 * 1000, LiveBrowserMgrWin::CloseLiveBrowserTimerCallback) ); + liveBrowserMgr->SetCloseTimeoutTimerId( ::SetTimer(NULL, 0, 10 * 1000, bit_cast(&LiveBrowserMgrWin::CloseLiveBrowserTimerCallback)) ); } } int32 OpenURLInDefaultBrowser(ExtensionString url) { - DWORD result = (DWORD)ShellExecute(NULL, L"open", url.c_str(), NULL, NULL, SW_SHOWNORMAL); + DWORD_PTR result = bit_cast(ShellExecute(NULL, L"open", url.c_str(), NULL, NULL, SW_SHOWNORMAL)); // If the result > 32, the function suceeded. If the result is <= 32, it is an // error code. @@ -498,7 +499,7 @@ int32 ShowOpenDialog(bool allowMultipleSelection, } else { // Multiple files are selected wchar_t fullPath[MAX_UNC_PATH]; - for (int i = (dir.length() + 1), fileIndex = 0; ; fileIndex++) { + for (int i = static_cast(dir.length() + 1), fileIndex = 0; ; fileIndex++) { // Get the next file name std::wstring file(&szFile[i]); @@ -515,7 +516,7 @@ int32 ShowOpenDialog(bool allowMultipleSelection, } // Go to the start of the next file name - i += file.length() + 1; + i += static_cast(file.length()) + 1; } } @@ -885,7 +886,7 @@ static void CharSetToWide(const std::string &aString, long codePage, std::wstrin int aUTF16Length = ::MultiByteToWideChar(codePage, // get destination buffer length 0, aString.data(), - aString.size(), + static_cast(aString.size()), NULL, NULL); @@ -896,7 +897,7 @@ static void CharSetToWide(const std::string &aString, long codePage, std::wstrin int wcharsWritten = ::MultiByteToWideChar(codePage, 0, aString.data(), - aString.size(), + static_cast(aString.size()), buf.get(), aUTF16Length); @@ -1024,7 +1025,7 @@ static void WideToCharSet(const std::wstring &aUTF16string, long codePage, std:: int aUTF8Length = ::WideCharToMultiByte(codePage, 0, aUTF16string.data(), - aUTF16string.size(), + static_cast(aUTF16string.size()), NULL, 0, NULL, @@ -1036,7 +1037,7 @@ static void WideToCharSet(const std::wstring &aUTF16string, long codePage, std:: int bytesWritten = ::WideCharToMultiByte(codePage, 0, aUTF16string.data(), - aUTF16string.size(), + static_cast(aUTF16string.size()), buf.get(), aUTF8Length, NULL, @@ -1083,7 +1084,7 @@ int32 WriteFile(ExtensionString filename, std::string contents, ExtensionString return ConvertWinErrorCode(GetLastError(), false); // TODO (issue 67) - Should write to temp file - if (!WriteFile(hFile, contents.c_str(), contents.length(), &dwBytesWritten, NULL)) { + if (!WriteFile(hFile, contents.c_str(), static_cast(contents.length()), &dwBytesWritten, NULL)) { error = ConvertWinErrorCode(GetLastError(), false); } @@ -1207,7 +1208,7 @@ bool isSlash(ExtensionString::value_type wc) { return wc == '/' || wc == '\\'; } void RemoveTrailingSlash(ExtensionString& filename) { - int last = filename.length() - 1; + int last = static_cast(filename.length()) - 1; if ((last >= 0) && isSlash(filename.at(last))) { filename.erase(last); } @@ -1285,7 +1286,7 @@ int32 ShowFolderInOSWindow(ExtensionString pathname) { } else { // File: open its containing folder with this file selected - ITEMIDLIST *pidl = ILCreateFromPath(pathname.c_str()); + auto pidl = ILCreateFromPath(pathname.c_str()); if (pidl) { SHOpenFolderAndSelectItems(pidl,0,0,0); ILFree(pidl); @@ -1518,7 +1519,7 @@ int32 AddMenu(CefRefPtr browser, ExtensionString itemTitle, Extensio menuInfo.fType = MFT_STRING; #endif menuInfo.dwTypeData = (LPWSTR)itemTitle.c_str(); - menuInfo.cch = itemTitle.size(); + menuInfo.cch = static_cast(itemTitle.size()); if (positionIdx == kAppend) { if (!InsertMenuItem(mainMenu, -1, TRUE, &menuInfo)) { @@ -1551,7 +1552,7 @@ bool canBeUsedAsShortcutKey(int unicode) bool UpdateAcceleratorTable(int32 tag, ExtensionString& keyStr) { - int keyStrLen = keyStr.length(); + int keyStrLen = static_cast(keyStr.length()); if (keyStrLen) { LPACCEL lpaccelNew; // pointer to new accelerator table HACCEL haccelOld; // handle to old accelerator table @@ -1826,7 +1827,7 @@ int32 AddMenuItem(CefRefPtr browser, ExtensionString parentCommand, menuInfo.fType = MFT_SEPARATOR; } menuInfo.dwTypeData = (LPWSTR)title.c_str(); - menuInfo.cch = itemTitle.size(); + menuInfo.cch = static_cast(itemTitle.size()); if (positionIdx >= 0) { InsertMenuItem(submenu, positionIdx, TRUE, &menuInfo); inserted = true; @@ -2006,7 +2007,7 @@ int32 SetMenuTitle(CefRefPtr browser, ExtensionString command, Exten #endif menuInfo.dwTypeData = (LPWSTR)newTitle.c_str(); menuInfo.hSubMenu = itemInfo.hSubMenu; - menuInfo.cch = newTitle.size(); + menuInfo.cch = static_cast(newTitle.size()); InsertMenuItem(mainMenu, position, TRUE, &menuInfo); } @@ -2014,7 +2015,7 @@ int32 SetMenuTitle(CefRefPtr browser, ExtensionString command, Exten } else { itemInfo.fType = MFT_STRING; // just to make sure itemInfo.dwTypeData = (LPWSTR)newTitle.c_str(); - itemInfo.cch = newTitle.size(); + itemInfo.cch = static_cast(newTitle.size()); if (!SetMenuItemInfo(menu, tag, FALSE, &itemInfo)) { return ConvertErrnoCode(GetLastError()); } @@ -2114,7 +2115,7 @@ int32 SetMenuItemShortcut(CefRefPtr browser, ExtensionString command itemInfo.fType = MFT_STRING; // just to make sure itemInfo.dwTypeData = (LPWSTR)titleStr.c_str(); - itemInfo.cch = titleStr.size(); + itemInfo.cch = static_cast(titleStr.size()); if (!SetMenuItemInfo(menu, tag, FALSE, &itemInfo)) { return ConvertErrnoCode(GetLastError()); diff --git a/appshell/appshell_node_process_win.cpp b/appshell/appshell_node_process_win.cpp index f7d6629d6..eb9d5b3da 100644 --- a/appshell/appshell_node_process_win.cpp +++ b/appshell/appshell_node_process_win.cpp @@ -302,7 +302,7 @@ void sendData(const std::string &data) { BOOL bSuccess = FALSE; dwWaitResult = WaitForSingleObject(hNodeMutex, INFINITE); if (dwWaitResult == WAIT_OBJECT_0) { // got the mutex - bSuccess = WriteFile(g_hChildStd_IN_Wr, data.c_str(), data.length(), &dwWritten, NULL); + bSuccess = WriteFile(g_hChildStd_IN_Wr, data.c_str(), static_cast(data.length()), &dwWritten, NULL); ReleaseMutex(hNodeMutex); if (!bSuccess) { // Failed to write, there's something wrong with this process. diff --git a/appshell/cef_dark_window.cpp b/appshell/cef_dark_window.cpp index b4c73b875..6e8e6211b 100644 --- a/appshell/cef_dark_window.cpp +++ b/appshell/cef_dark_window.cpp @@ -509,11 +509,11 @@ void cef_dark_window::DoDrawSystemMenuIcon(HDC hdc) // Start with the small if (!mWindowIcon) - mWindowIcon = reinterpret_cast(GetClassLongPtr(GCLP_HICONSM)); + mWindowIcon = bit_cast(GetClassLongPtr(GCLP_HICONSM)); // Then try to load the big icon if (!mWindowIcon) - mWindowIcon = reinterpret_cast(GetClassLongPtr(GCLP_HICON)); + mWindowIcon = bit_cast(GetClassLongPtr(GCLP_HICON)); // Otherwise we need an icon, so just use the standard Windows default // application Icon which may very between versions @@ -554,7 +554,7 @@ void cef_dark_window::DoDrawTitlebarText(HDC hdc) // Figure out how much space we need to draw ethe whole thing RECT rectTemp; ::SetRectEmpty(&rectTemp); - ::DrawText(hdc, szCaption, ::wcslen(szCaption), &rectTemp, DT_SINGLELINE|DT_CALCRECT|DT_NOPREFIX); + ::DrawText(hdc, szCaption, static_cast(::wcslen(szCaption)), &rectTemp, DT_SINGLELINE|DT_CALCRECT|DT_NOPREFIX); // Can it be centered within the window? if (((::RectWidth(windowRect) / 2) + (::RectWidth(rectTemp) / 2) + 1) < textRect.right) { @@ -945,7 +945,7 @@ BOOL cef_dark_window::HandleMeasureItem(LPMEASUREITEMSTRUCT lpMIS) SetRectEmpty(&rectTemp); // Calc the size of this menu item - ::DrawText(dc, szMenuString, ::wcslen(szMenuString), &rectTemp, DT_SINGLELINE|DT_CALCRECT); + ::DrawText(dc, szMenuString, static_cast(::wcslen(szMenuString)), &rectTemp, DT_SINGLELINE|DT_CALCRECT); lpMIS->itemHeight = ::RectHeight(rectTemp); lpMIS->itemWidth = ::RectWidth(rectTemp); @@ -999,7 +999,7 @@ BOOL cef_dark_window::HandleDrawItem(LPDRAWITEMSTRUCT lpDIS) int oldBkMode = ::SetBkMode(lpDIS->hDC, TRANSPARENT); - ::DrawText(lpDIS->hDC, szMenuString, ::wcslen(szMenuString), &lpDIS->rcItem, format); + ::DrawText(lpDIS->hDC, szMenuString, static_cast(::wcslen(szMenuString)), &lpDIS->rcItem, format); ::SelectObject(lpDIS->hDC, fontOld); ::SetBkMode(lpDIS->hDC, oldBkMode); diff --git a/appshell/cef_host_window.cpp b/appshell/cef_host_window.cpp index add7b5107..693dfd2e4 100644 --- a/appshell/cef_host_window.cpp +++ b/appshell/cef_host_window.cpp @@ -168,7 +168,7 @@ BOOL cef_host_window::HandleSize(BOOL bMinimize) if (GetProp(L"WasMinimized")) { DoRepaintClientArea(); } - SetProp(L"WasMinimized", (HANDLE)bMinimize); + SetPropW(L"WasMinimized", bit_cast(&bMinimize)); #endif NotifyWindowMovedOrResized(); return FALSE; diff --git a/appshell/cef_main_window.cpp b/appshell/cef_main_window.cpp index 2718c3fd9..836ee76be 100644 --- a/appshell/cef_main_window.cpp +++ b/appshell/cef_main_window.cpp @@ -292,7 +292,7 @@ BOOL cef_main_window::HandleClose() CefWindowHandle hwnd = SafeGetCefBrowserHwnd(); if (hwnd) { - BOOL closing = (BOOL)::GetProp(hwnd, ::kCefWindowClosingPropName); + DWORD_PTR closing = bit_cast(::GetProp(hwnd, ::kCefWindowClosingPropName)); if (closing) { if (!g_handler->CanCloseBrowser(GetBrowser())) { diff --git a/appshell/cef_registry.cpp b/appshell/cef_registry.cpp index 57319d900..db28ba5cf 100644 --- a/appshell/cef_registry.cpp +++ b/appshell/cef_registry.cpp @@ -36,7 +36,7 @@ void EnsureTrailingSeparator(LPWSTR pRet) if (!pRet) return; - int len = wcslen(pRet); + int len = static_cast(wcslen(pRet)); if (len > 0 && wcscmp(&(pRet[len-1]), L"\\") != 0) { wcscat(pRet, L"\\"); diff --git a/appshell/cef_window.cpp b/appshell/cef_window.cpp index 31c86b180..a749ed32b 100644 --- a/appshell/cef_window.cpp +++ b/appshell/cef_window.cpp @@ -125,7 +125,7 @@ bool cef_window::SubclassWindow(HWND hWnd) if (::GetProp(hWnd, ::gCefClientWindowPropName) != NULL) return false; mWnd = hWnd; - mSuperWndProc = (WNDPROC)SetWindowLongPtr(GWLP_WNDPROC, (LONG_PTR)&_WindowProc); + mSuperWndProc = bit_cast(SetWindowLongPtr(GWLP_WNDPROC, (LONG_PTR)&_WindowProc)); SetProp(::gCefClientWindowPropName, (HANDLE)this); return true; } @@ -178,13 +178,13 @@ LRESULT cef_window::DefaultWindowProc(UINT message, WPARAM wParam, LPARAM lParam // calls PostNcDestroy BOOL cef_window::HandleNcDestroy() { - WNDPROC superWndProc = WNDPROC(GetWindowLongPtr(GWLP_WNDPROC)); + WNDPROC superWndProc = bit_cast(GetWindowLongPtr(GWLP_WNDPROC)); RemoveProp(::gCefClientWindowPropName); DefaultWindowProc(WM_NCDESTROY, 0, 0); - if ((WNDPROC(GetWindowLongPtr(GWLP_WNDPROC)) == superWndProc) && (mSuperWndProc != NULL)) + if ((bit_cast(GetWindowLongPtr(GWLP_WNDPROC)) == superWndProc) && (mSuperWndProc != NULL)) SetWindowLongPtr(GWLP_WNDPROC, reinterpret_cast(mSuperWndProc)); mSuperWndProc = NULL; diff --git a/appshell/cef_window.h b/appshell/cef_window.h index d7e0361f7..031047e48 100644 --- a/appshell/cef_window.h +++ b/appshell/cef_window.h @@ -148,13 +148,13 @@ class cef_window HANDLE RemoveProp(LPCWSTR lpString) { return ::RemoveProp(mWnd, lpString); } - LONG GetWindowLongPtr(int nIndex) const + LONG_PTR GetWindowLongPtr(int nIndex) const { return ::GetWindowLongPtr(mWnd, nIndex); } - LONG SetWindowLongPtr(int nIndex, LONG dwNewLong) + LONG_PTR SetWindowLongPtr(int nIndex, LONG_PTR dwNewLong) { return ::SetWindowLongPtr(mWnd, nIndex, dwNewLong); } - LONG GetClassLongPtr(int nIndex) const + ULONG_PTR GetClassLongPtr(int nIndex) const { return ::GetClassLongPtr(mWnd, nIndex); } BOOL GetWindowInfo (PWINDOWINFO pwi) const @@ -200,10 +200,22 @@ class cef_window { return ::IsWindowVisible(mWnd); } void SetStyle(DWORD dwStyle) - { SetWindowLong(GWL_STYLE, dwStyle); } + { +#ifdef _WIN64 + SetWindowLong(mWnd, GWL_STYLE, dwStyle); +#else + SetWindowLong(GWL_STYLE, dwStyle); +#endif // __WIN64 + } DWORD GetStyle() const - { return GetWindowLong(GWL_STYLE); } + { +#ifdef _WIN64 + return GetWindowLong(mWnd,GWL_STYLE); +#else + return GetWindowLong(GWL_STYLE); +#endif // __WIN64 + } void RemoveStyle(DWORD dwStyle) { SetStyle(GetStyle() & ~dwStyle); } @@ -212,11 +224,22 @@ class cef_window { SetStyle(GetStyle() & dwStyle); } void SetExStyle(DWORD dwExStyle) - { SetWindowLong(GWL_EXSTYLE, dwExStyle); } - - DWORD GetExStyle() const - { return GetWindowLong(GWL_EXSTYLE); } + { +#ifdef _WIN64 + SetWindowLong(mWnd,GWL_EXSTYLE, dwExStyle); +#else + SetWindowLong(GWL_EXSTYLE, dwExStyle); +#endif // __WIN64 + } + DWORD GetExStyle() const + { +#ifdef _WIN64 + return GetWindowLong(mWnd, GWL_EXSTYLE); +#else + return GetWindowLong(GWL_EXSTYLE); +#endif // __WIN64 + } void RemoveExStyle(DWORD dwExStyle) { SetExStyle(GetExStyle() & ~dwExStyle); } @@ -249,3 +272,15 @@ class cef_window BOOL TrackNonClientMouseEvents(bool track = true); }; + + +#include +template +inline Dest bit_cast(Source const & src) +{ + static_assert(sizeof(Source) == sizeof(Dest), "Size of Source and Destination type must be same"); + Dest dest; + std::memcpy(&dest, &src, sizeof(Dest)); + return dest; +} + diff --git a/appshell/cefclient_win.cpp b/appshell/cefclient_win.cpp index a53ceb07a..492f994f4 100644 --- a/appshell/cefclient_win.cpp +++ b/appshell/cefclient_win.cpp @@ -13,7 +13,6 @@ #include "include/cef_version.h" #include "include/cef_browser.h" #include "include/cef_frame.h" -#include "include/cef_runnable.h" #include "client_handler.h" #include "config.h" #include "appshell/browser/resource.h" @@ -63,7 +62,7 @@ extern CefRefPtr g_handler; void StripColonNumber(std::wstring& str) { bool gotDigits = false; int index; - for (index = str.size() - 1; index >= 0; index--) { + for (index = static_cast(str.size()) - 1; index >= 0; index--) { if (!isdigit(str[index])) break; gotDigits = true; @@ -213,7 +212,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance, // note: WM_COPYDATA will manage passing the string across process space COPYDATASTRUCT data; data.dwData = ID_WM_COPYDATA_SENDOPENFILECOMMAND; - data.cbData = (wstrFilename.length() + 1) * sizeof(WCHAR); + data.cbData = static_cast((wstrFilename.length() + 1) * sizeof(WCHAR)); data.lpData = (LPVOID)wstrFilename.c_str(); ::SendMessage(hFirstInstanceWnd, WM_COPYDATA, (WPARAM)(HWND)hFirstInstanceWnd, (LPARAM)(LPVOID)&data); // exit this instance diff --git a/appshell/client_app.cpp b/appshell/client_app.cpp index 828ac8084..e08cb7cdd 100644 --- a/appshell/client_app.cpp +++ b/appshell/client_app.cpp @@ -113,7 +113,7 @@ bool ClientApp::OnProcessMessageReceived( // which can lead to bad things. If the browser instance has been deleted, don't // invoke this callback. if (context->GetBrowser()) { - for (size_t i = 1; i < messageArgs->GetSize(); i++) { + for (int i = 1; i < static_cast(messageArgs->GetSize()); ++i) { arguments.push_back(appshell::ListValueToV8Value(messageArgs, i)); } diff --git a/tasks/setup.js b/tasks/setup.js index 464bd71fc..da56efac7 100644 --- a/tasks/setup.js +++ b/tasks/setup.js @@ -65,9 +65,20 @@ module.exports = function (grunt) { return exec("unzip -q \"" + src + "\" -d \"" + dest + "\""); } + var target_archbit = grunt.option('force-target-word-size') || "32"; + + function platform_arch_suffix() + { + var arch = common.arch(); + if( arch == "") + { + return target_archbit; + } + return arch; + } // task: cef grunt.registerTask("cef", "Download and setup CEF", function () { - var config = "cef-" + platform + common.arch(), + var config = "cef-" + platform + platform_arch_suffix(), zipSrc = grunt.config("curl-dir." + config + ".src"), zipName = path.basename(zipSrc), zipDest = path.resolve(process.cwd(), path.join(grunt.config("curl-dir." + config + ".dest"), zipName)), @@ -127,7 +138,7 @@ module.exports = function (grunt) { // task: icu grunt.registerTask("icu", "Download and setup ICU", function () { - var config = "icu-" + platform + common.arch(), + var config = "icu-" + platform + platform_arch_suffix(), zipSrc = grunt.config("curl-dir." + config + ".src"), zipName = path.basename(zipSrc), zipDest = path.resolve(process.cwd(), path.join(grunt.config("curl-dir." + config + ".dest"), zipName)), @@ -181,7 +192,7 @@ module.exports = function (grunt) { // task: vs-crt grunt.registerTask("vs-crt", "Download and setup VS CRT dlls", function () { if (platform === "win") { - var config = "vs-crt-" + platform + common.arch(), + var config = "vs-crt-" + platform + platform_arch_suffix(), zipSrc = grunt.config("curl-dir." + config + ".src"), zipName = path.basename(zipSrc), zipDest = path.resolve(process.cwd(), path.join(grunt.config("curl-dir." + config + ".dest"), zipName)), @@ -255,7 +266,7 @@ module.exports = function (grunt) { } grunt.registerTask("cef-symbols", "Download and unpack the CEF symbols", function () { - var config = "cef-" + platform + common.arch() + "-symbols", + var config = "cef-" + platform + platform_arch_suffix() + "-symbols", zipSymbols = grunt.config("curl-dir." + config + ".src"); if (zipSymbols) { @@ -511,7 +522,7 @@ module.exports = function (grunt) { // task: node-download grunt.registerTask("node", "Download Node.js binaries and setup dependencies", function () { - var config = "node-" + platform + common.arch(), + var config = "node-" + platform + platform_arch_suffix(), nodeSrc = grunt.config("curl-dir." + config + ".src"), nodeDest = [], dest = grunt.config("curl-dir." + config + ".dest"), From 5cb1ce8214ec2bea1dcbe922deb93bb374958281 Mon Sep 17 00:00:00 2001 From: Gautam Jha Date: Wed, 3 Oct 2018 16:09:26 +0530 Subject: [PATCH 4/5] Updated CEF version to 3.3497.1836.gb472a8d --- Gruntfile.js | 2 +- appshell/client_handler.cpp | 59 ------------------------------------- appshell/client_handler.h | 15 ---------- appshell_paths.gypi | 2 -- tasks/setup.js | 12 ++++---- 5 files changed, 6 insertions(+), 84 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index a1a299c52..b48b0fa34 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -27,7 +27,7 @@ module.exports = function (grunt) { var common = require("./tasks/common")(grunt), platform = common.platform(), staging, - cef_version = "3.3202.1694.gf061c23"; + cef_version = "3.3497.1836.gb472a8d"; if (platform === "mac") { staging = "installer/mac/staging/<%= build.name %>.app/Contents"; diff --git a/appshell/client_handler.cpp b/appshell/client_handler.cpp index b4a32c777..075e24810 100644 --- a/appshell/client_handler.cpp +++ b/appshell/client_handler.cpp @@ -278,65 +278,6 @@ void ClientHandler::OnLoadingStateChange(CefRefPtr browser, SetNavState(canGoBack, canGoForward); } -bool ClientHandler::OnConsoleMessage(CefRefPtr browser, - const CefString& message, - const CefString& source, - int line) { - // Don't write the message to a console.log file. Instead, we'll just - // return false here so the message gets written to the console (output window - // in xcode, or console window in dev tools) - -/* - CEF_REQUIRE_UI_THREAD(); - - bool first_message; - std::string logFile; - - { - AutoLock lock_scope(this); - - first_message = m_LogFile.empty(); - if (first_message) { - std::stringstream ss; - ss << AppGetWorkingDirectory(); -#if defined(OS_WIN) - ss << "\\"; -#else - ss << "/"; -#endif - ss << "console.log"; - m_LogFile = ss.str(); - } - logFile = m_LogFile; - } - - FILE* file = fopen(logFile.c_str(), "a"); - if (file) { - std::stringstream ss; - ss << "Message: " << std::string(message) << "\r\nSource: " << - std::string(source) << "\r\nLine: " << line << - "\r\n-----------------------\r\n"; - fputs(ss.str().c_str(), file); - fclose(file); - - if (first_message) - SendNotification(NOTIFY_CONSOLE_MESSAGE); - } -*/ - return false; -} - -bool ClientHandler::OnRequestGeolocationPermission( - CefRefPtr browser, - const CefString& requesting_url, - int request_id, - CefRefPtr callback) { - // Allow geolocation access from all websites. - // TODO: What does ref app do? - callback->Continue(true); - return true; -} - void ClientHandler::OnBeforeContextMenu( CefRefPtr browser, CefRefPtr frame, diff --git a/appshell/client_handler.h b/appshell/client_handler.h index 0395e2d25..774885b7f 100644 --- a/appshell/client_handler.h +++ b/appshell/client_handler.h @@ -31,7 +31,6 @@ class ClientHandler : public CefClient, public CefRequestHandler, public CefDisplayHandler, public CefKeyboardHandler, - public CefGeolocationHandler, public CefContextMenuHandler { public: @@ -94,9 +93,6 @@ class ClientHandler : public CefClient, virtual CefRefPtr GetDisplayHandler() OVERRIDE { return this; } - virtual CefRefPtr GetGeolocationHandler() OVERRIDE { - return this; - } virtual CefRefPtr GetContextMenuHandler() OVERRIDE { return this; } @@ -162,17 +158,6 @@ virtual bool OnBeforePopup(CefRefPtr browser, const CefString& url) OVERRIDE; virtual void OnTitleChange(CefRefPtr browser, const CefString& title) OVERRIDE; - virtual bool OnConsoleMessage(CefRefPtr browser, - const CefString& message, - const CefString& source, - int line) OVERRIDE; - - // CefGeolocationHandler methods - virtual bool OnRequestGeolocationPermission( - CefRefPtr browser, - const CefString& requesting_url, - int request_id, - CefRefPtr callback) OVERRIDE; // CefContextMenuHandler methods virtual void OnBeforeContextMenu(CefRefPtr browser, diff --git a/appshell_paths.gypi b/appshell_paths.gypi index a9af24301..ce7bad19f 100755 --- a/appshell_paths.gypi +++ b/appshell_paths.gypi @@ -30,7 +30,6 @@ 'include/base/cef_string16.h', 'include/base/cef_template_util.h', 'include/base/cef_thread_checker.h', - 'include/base/cef_thread_collision_warner.h', 'include/base/cef_trace_event.h', 'include/base/cef_tuple.h', 'include/base/cef_weak_ptr.h', @@ -118,7 +117,6 @@ 'libcef_dll/base/cef_ref_counted.cc', 'libcef_dll/base/cef_string16.cc', 'libcef_dll/base/cef_thread_checker_impl.cc', - 'libcef_dll/base/cef_thread_collision_warner.cc', 'libcef_dll/base/cef_weak_ptr.cc', 'libcef_dll/cpptoc/base_ref_counted_cpptoc.cc', 'libcef_dll/cpptoc/base_ref_counted_cpptoc.h', diff --git a/tasks/setup.js b/tasks/setup.js index da56efac7..968691f32 100644 --- a/tasks/setup.js +++ b/tasks/setup.js @@ -65,16 +65,14 @@ module.exports = function (grunt) { return exec("unzip -q \"" + src + "\" -d \"" + dest + "\""); } - var target_archbit = grunt.option('force-target-word-size') || "32"; + //Not to be used for MacOS + var target_wordsize_arg = grunt.option('force-target-word-size') || undefined; function platform_arch_suffix() { - var arch = common.arch(); - if( arch == "") - { - return target_archbit; - } - return arch; + if(target_wordsize_arg){ return target_wordsize_arg; } + if (process.platform === "win32") { return "32"; } + return common.arch(); } // task: cef grunt.registerTask("cef", "Download and setup CEF", function () { From da814a3dd92657fb25a2b9f6cef5268059b6b7c9 Mon Sep 17 00:00:00 2001 From: dwshared Date: Mon, 8 Oct 2018 07:31:33 +0530 Subject: [PATCH 5/5] Linux build is complete, we are getting empty Brackets window this time --- Gruntfile.js | 6 -- appshell/appshell_extensions_platform.cpp | 5 +- appshell/browser/client_app_browser.h | 2 +- appshell/browser/client_handler.cc | 62 ++++--------------- appshell/browser/client_handler.h | 18 +----- appshell/browser/print_handler_gtk.cc | 5 +- appshell/browser/print_handler_gtk.h | 9 ++- appshell/browser/root_window_manager.cc | 1 + appshell/cefclient.cpp | 2 +- appshell/common/client_app.cc | 2 +- appshell/common/client_app.h | 4 +- .../common/client_app_delegates_common.cc | 2 +- appshell/renderer/client_app_renderer.cc | 16 ----- appshell/renderer/client_app_renderer.h | 16 +---- 14 files changed, 36 insertions(+), 114 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index b48b0fa34..b9eff9414 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -37,12 +37,6 @@ module.exports = function (grunt) { staging = "installer/linux/debian/package-root/opt/brackets"; } - /*if (platform === "mac") { - cef_version = "3.2704.1434"; - } else*/ if (platform === "linux") { - cef_version = "3.2785.1487"; - } - grunt.initConfig({ "pkg": grunt.file.readJSON("package.json"), "config-json": staging + "/www/config.json", diff --git a/appshell/appshell_extensions_platform.cpp b/appshell/appshell_extensions_platform.cpp index d7ac43625..09711c319 100644 --- a/appshell/appshell_extensions_platform.cpp +++ b/appshell/appshell_extensions_platform.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #ifdef OS_LINUX #include "appshell/browser/main_context.h" @@ -71,7 +72,7 @@ void CharSetEncode::operator()(std::string &contents) { if(error != U_BUFFER_OVERFLOW_ERROR) { throw "Unable to convert encoding"; } - std::auto_ptr target(new char[targetLen + 1]()); + std::unique_ptr target(new char[targetLen + 1]()); error = U_ZERO_ERROR; ustr.extract(target.get(), targetLen, m_conv, error); target.get()[targetLen] = '\0'; @@ -87,7 +88,7 @@ void DecodeContents(std::string &contents, const std::string& encoding) { if(status != U_BUFFER_OVERFLOW_ERROR) { throw "Unable to decode contents"; } - std::auto_ptr target(new char[targetLen + 1]()); + std::unique_ptr target(new char[targetLen + 1]()); status = U_ZERO_ERROR; ustr.extract(target.get(), targetLen, NULL, status); target.get()[targetLen] = '\0'; diff --git a/appshell/browser/client_app_browser.h b/appshell/browser/client_app_browser.h index 0b58f0d22..6663ba226 100644 --- a/appshell/browser/client_app_browser.h +++ b/appshell/browser/client_app_browser.h @@ -19,7 +19,7 @@ class ClientAppBrowser : public ClientApp, // Interface for browser delegates. All Delegates must be returned via // CreateDelegates. Do not perform work in the Delegate // constructor. See CefBrowserProcessHandler for documentation. - class Delegate : public virtual CefBase { + class Delegate : public virtual CefBaseRefCounted { public: virtual void OnBeforeCommandLineProcessing( CefRefPtr app, diff --git a/appshell/browser/client_handler.cc b/appshell/browser/client_handler.cc index 81d5e1830..5ee820142 100644 --- a/appshell/browser/client_handler.cc +++ b/appshell/browser/client_handler.cc @@ -272,32 +272,6 @@ void ClientHandler::OnFullscreenModeChange(CefRefPtr browser, NotifyFullscreen(fullscreen); } -bool ClientHandler::OnConsoleMessage(CefRefPtr browser, - const CefString& message, - const CefString& source, - int line) { - CEF_REQUIRE_UI_THREAD(); - - // FILE* file = fopen(console_log_file_.c_str(), "a"); - // if (file) { - // std::stringstream ss; - // ss << "Message: " << message.ToString() << NEWLINE << - // "Source: " << source.ToString() << NEWLINE << - // "Line: " << line << NEWLINE << - // "-----------------------" << NEWLINE; - // fputs(ss.str().c_str(), file); - // fclose(file); - - // if (first_console_message_) { - // test_runner::Alert( - // browser, "Console messages written to \"" + console_log_file_ + "\""); - // first_console_message_ = false; - // } - // } - - return false; -} - void ClientHandler::OnBeforeDownload( CefRefPtr browser, CefRefPtr download_item, @@ -349,18 +323,6 @@ void ClientHandler::OnDraggableRegionsChanged( } #endif -bool ClientHandler::OnRequestGeolocationPermission( - CefRefPtr browser, - const CefString& requesting_url, - int request_id, - CefRefPtr callback) { - CEF_REQUIRE_UI_THREAD(); - - // Allow geolocation access from all websites. - callback->Continue(true); - return true; -} - bool ClientHandler::OnPreKeyEvent(CefRefPtr browser, const CefKeyEvent& event, CefEventHandle os_event, @@ -486,6 +448,7 @@ void ClientHandler::OnLoadError(CefRefPtr browser, bool ClientHandler::OnBeforeBrowse(CefRefPtr browser, CefRefPtr frame, CefRefPtr request, + bool user_gesture, bool is_redirect) { CEF_REQUIRE_UI_THREAD(); @@ -577,8 +540,9 @@ bool ClientHandler::OnCertificateError( CefRefPtr callback) { CEF_REQUIRE_UI_THREAD(); - CefRefPtr subject = ssl_info->GetSubject(); - CefRefPtr issuer = ssl_info->GetIssuer(); + CefRefPtr cert = ssl_info->GetX509Certificate(); + CefRefPtr subject = cert->GetSubject(); + CefRefPtr issuer = cert->GetIssuer(); // Build a table showing certificate information. Various types of invalid // certificates can be tested using https://badssl.com/. @@ -592,22 +556,22 @@ bool ClientHandler::OnCertificateError( (issuer.get() ? issuer->GetDisplayName().ToString() : " ") << "" "Serial #*" << - GetBinaryString(ssl_info->GetSerialNumber()) << "" + GetBinaryString(cert->GetSerialNumber()) << "" "Status" << GetCertStatusString(ssl_info->GetCertStatus()) << "" "Valid Start" << - GetTimeString(ssl_info->GetValidStart()) << "" + GetTimeString(cert->GetValidStart()) << "" "Valid Expiry" << - GetTimeString(ssl_info->GetValidExpiry()) << ""; + GetTimeString(cert->GetValidExpiry()) << ""; - CefSSLInfo::IssuerChainBinaryList der_chain_list; - CefSSLInfo::IssuerChainBinaryList pem_chain_list; - ssl_info->GetDEREncodedIssuerChain(der_chain_list); - ssl_info->GetPEMEncodedIssuerChain(pem_chain_list); + CefX509Certificate::IssuerChainBinaryList der_chain_list; + CefX509Certificate::IssuerChainBinaryList pem_chain_list; + cert->GetDEREncodedIssuerChain(der_chain_list); + cert->GetPEMEncodedIssuerChain(pem_chain_list); DCHECK_EQ(der_chain_list.size(), pem_chain_list.size()); - der_chain_list.insert(der_chain_list.begin(), ssl_info->GetDEREncoded()); - pem_chain_list.insert(pem_chain_list.begin(), ssl_info->GetPEMEncoded()); + der_chain_list.insert(der_chain_list.begin(), cert->GetDEREncoded()); + pem_chain_list.insert(pem_chain_list.begin(), cert->GetPEMEncoded()); for (size_t i = 0U; i < der_chain_list.size(); ++i) { ss << "DER Encoded*" diff --git a/appshell/browser/client_handler.h b/appshell/browser/client_handler.h index 13e32e621..bc579b2f3 100644 --- a/appshell/browser/client_handler.h +++ b/appshell/browser/client_handler.h @@ -40,7 +40,6 @@ class ClientHandler : public CefDisplayHandler, public CefDownloadHandler, public CefDragHandler, - public CefGeolocationHandler, public CefKeyboardHandler, public CefLifeSpanHandler, public CefLoadHandler, @@ -111,9 +110,6 @@ class ClientHandler : } #endif - CefRefPtr GetGeolocationHandler() OVERRIDE { - return this; - } CefRefPtr GetKeyboardHandler() OVERRIDE { return this; } @@ -159,10 +155,6 @@ class ClientHandler : const CefString& title) OVERRIDE; void OnFullscreenModeChange(CefRefPtr browser, bool fullscreen) OVERRIDE; - bool OnConsoleMessage(CefRefPtr browser, - const CefString& message, - const CefString& source, - int line) OVERRIDE; // CefDownloadHandler methods void OnBeforeDownload( @@ -190,13 +182,6 @@ class ClientHandler : const std::vector& regions) OVERRIDE; #endif - // CefGeolocationHandler methods - bool OnRequestGeolocationPermission( - CefRefPtr browser, - const CefString& requesting_url, - int request_id, - CefRefPtr callback) OVERRIDE; - // CefKeyboardHandler methods bool OnPreKeyEvent(CefRefPtr browser, const CefKeyEvent& event, @@ -235,7 +220,8 @@ class ClientHandler : bool OnBeforeBrowse(CefRefPtr browser, CefRefPtr frame, CefRefPtr request, - bool is_redirect) OVERRIDE; + bool user_gesture, + bool is_redirect) OVERRIDE; bool OnOpenURLFromTab( CefRefPtr browser, CefRefPtr frame, diff --git a/appshell/browser/print_handler_gtk.cc b/appshell/browser/print_handler_gtk.cc index 377e30289..be2db080b 100644 --- a/appshell/browser/print_handler_gtk.cc +++ b/appshell/browser/print_handler_gtk.cc @@ -286,6 +286,7 @@ void ClientPrintHandlerGtk::OnPrintStart(CefRefPtr browser) { } void ClientPrintHandlerGtk::OnPrintSettings( + CefRefPtr browser, CefRefPtr settings, bool get_defaults) { if (get_defaults) { @@ -357,6 +358,7 @@ void ClientPrintHandlerGtk::OnPrintSettings( } bool ClientPrintHandlerGtk::OnPrintDialog( + CefRefPtr browser, bool has_selection, CefRefPtr callback) { dialog_callback_ = callback; @@ -398,6 +400,7 @@ bool ClientPrintHandlerGtk::OnPrintDialog( } bool ClientPrintHandlerGtk::OnPrintJob( + CefRefPtr browser, const CefString& document_name, const CefString& pdf_file_path, CefRefPtr callback) { @@ -424,7 +427,7 @@ bool ClientPrintHandlerGtk::OnPrintJob( return true; } -void ClientPrintHandlerGtk::OnPrintReset() { +void ClientPrintHandlerGtk::OnPrintReset(CefRefPtr browser) { if (dialog_) { gtk_widget_destroy(dialog_); dialog_ = NULL; diff --git a/appshell/browser/print_handler_gtk.h b/appshell/browser/print_handler_gtk.h index 11618e67d..1cd73c234 100644 --- a/appshell/browser/print_handler_gtk.h +++ b/appshell/browser/print_handler_gtk.h @@ -20,15 +20,18 @@ class ClientPrintHandlerGtk : public CefPrintHandler { // CefPrintHandler methods. void OnPrintStart(CefRefPtr browser) OVERRIDE; - void OnPrintSettings(CefRefPtr settings, + void OnPrintSettings(CefRefPtr browser, + CefRefPtr settings, bool get_defaults) OVERRIDE; bool OnPrintDialog( + CefRefPtr browser, bool has_selection, CefRefPtr callback) OVERRIDE; - bool OnPrintJob(const CefString& document_name, + bool OnPrintJob(CefRefPtr browser, + const CefString& document_name, const CefString& pdf_file_path, CefRefPtr callback) OVERRIDE; - void OnPrintReset() OVERRIDE; + void OnPrintReset(CefRefPtr browser) OVERRIDE; CefSize GetPdfPaperSize(int device_units_per_inch) OVERRIDE; private: diff --git a/appshell/browser/root_window_manager.cc b/appshell/browser/root_window_manager.cc index 92a735dbd..760dc01b8 100644 --- a/appshell/browser/root_window_manager.cc +++ b/appshell/browser/root_window_manager.cc @@ -22,6 +22,7 @@ class ClientRequestContextHandler : public CefRequestContextHandler { bool OnBeforePluginLoad(const CefString& mime_type, const CefString& plugin_url, + bool is_main_frame, const CefString& top_origin_url, CefRefPtr plugin_info, PluginPolicy* plugin_policy) OVERRIDE { diff --git a/appshell/cefclient.cpp b/appshell/cefclient.cpp index 72777401b..eba9fc304 100644 --- a/appshell/cefclient.cpp +++ b/appshell/cefclient.cpp @@ -28,7 +28,7 @@ CefRefPtr AppGetBrowser() { CefWindowHandle AppGetMainHwnd() { if (!g_handler.get()) - return NULL; + return 0; return g_handler->GetMainHwnd(); } diff --git a/appshell/common/client_app.cc b/appshell/common/client_app.cc index 662e2b654..3b05bf964 100644 --- a/appshell/common/client_app.cc +++ b/appshell/common/client_app.cc @@ -42,7 +42,7 @@ ClientApp::ProcessType ClientApp::GetProcessType( } void ClientApp::OnRegisterCustomSchemes( - CefRefPtr registrar) { + CefRawPtr registrar) { RegisterCustomSchemes(registrar, cookieable_schemes_); } diff --git a/appshell/common/client_app.h b/appshell/common/client_app.h index cdbbfdadd..534b75e79 100644 --- a/appshell/common/client_app.h +++ b/appshell/common/client_app.h @@ -34,12 +34,12 @@ class ClientApp : public CefApp { private: // Registers custom schemes. Implemented by cefclient in // client_app_delegates_common.cc - static void RegisterCustomSchemes(CefRefPtr registrar, + static void RegisterCustomSchemes(CefRawPtr registrar, std::vector& cookiable_schemes); // CefApp methods. void OnRegisterCustomSchemes( - CefRefPtr registrar) OVERRIDE; + CefRawPtr registrar) OVERRIDE; DISALLOW_COPY_AND_ASSIGN(ClientApp); }; diff --git a/appshell/common/client_app_delegates_common.cc b/appshell/common/client_app_delegates_common.cc index 67c091f63..9c37ea378 100644 --- a/appshell/common/client_app_delegates_common.cc +++ b/appshell/common/client_app_delegates_common.cc @@ -9,7 +9,7 @@ namespace client { // static void ClientApp::RegisterCustomSchemes( - CefRefPtr registrar, + CefRawPtr registrar, std::vector& cookiable_schemes) { // Brackets specific change. //scheme_test::RegisterCustomSchemes(registrar, cookiable_schemes); diff --git a/appshell/renderer/client_app_renderer.cc b/appshell/renderer/client_app_renderer.cc index e918f3e1c..730b690fc 100644 --- a/appshell/renderer/client_app_renderer.cc +++ b/appshell/renderer/client_app_renderer.cc @@ -46,22 +46,6 @@ CefRefPtr ClientAppRenderer::GetLoadHandler() { return load_handler; } -bool ClientAppRenderer::OnBeforeNavigation(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr request, - NavigationType navigation_type, - bool is_redirect) { - DelegateSet::iterator it = delegates_.begin(); - for (; it != delegates_.end(); ++it) { - if ((*it)->OnBeforeNavigation(this, browser, frame, request, - navigation_type, is_redirect)) { - return true; - } - } - - return false; -} - void ClientAppRenderer::OnContextCreated(CefRefPtr browser, CefRefPtr frame, CefRefPtr context) { diff --git a/appshell/renderer/client_app_renderer.h b/appshell/renderer/client_app_renderer.h index ad1048adf..cbc62b0ab 100644 --- a/appshell/renderer/client_app_renderer.h +++ b/appshell/renderer/client_app_renderer.h @@ -19,7 +19,7 @@ class ClientAppRenderer : public ClientApp, // Interface for renderer delegates. All Delegates must be returned via // CreateDelegates. Do not perform work in the Delegate // constructor. See CefRenderProcessHandler for documentation. - class Delegate : public virtual CefBase { + class Delegate : public virtual CefBaseRefCounted { public: virtual void OnRenderThreadCreated(CefRefPtr app, CefRefPtr extra_info) {} @@ -37,15 +37,6 @@ class ClientAppRenderer : public ClientApp, return NULL; } - virtual bool OnBeforeNavigation(CefRefPtr app, - CefRefPtr browser, - CefRefPtr frame, - CefRefPtr request, - cef_navigation_type_t navigation_type, - bool is_redirect) { - return false; - } - virtual void OnContextCreated(CefRefPtr app, CefRefPtr browser, CefRefPtr frame, @@ -101,11 +92,6 @@ class ClientAppRenderer : public ClientApp, void OnBrowserCreated(CefRefPtr browser) OVERRIDE; void OnBrowserDestroyed(CefRefPtr browser) OVERRIDE; CefRefPtr GetLoadHandler() OVERRIDE; - bool OnBeforeNavigation(CefRefPtr browser, - CefRefPtr frame, - CefRefPtr request, - NavigationType navigation_type, - bool is_redirect) OVERRIDE; void OnContextCreated(CefRefPtr browser, CefRefPtr frame, CefRefPtr context) OVERRIDE;