diff options
332 files changed, 3260 insertions, 712 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000000..7e99e367f84 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.pyc
\ No newline at end of file diff --git a/chromium/.gn b/chromium/.gn index 7a7160de63c..86ed4fa6f39 100644 --- a/chromium/.gn +++ b/chromium/.gn @@ -212,36 +212,3 @@ check_targets = [ # using glob, and it's possible to mess it up without glob, but globs make # this situation much easier to create. if the build always lists the # files and passes them to a script, it will always be correct. - -exec_script_whitelist = - build_dotfile_settings.exec_script_whitelist + [ - # Whitelist entries for //build should go into - # //build/dotfile_settings.gni instead, so that they can be shared - # with other repos. The entries in this list should be only for files - # in the Chromium repo outside of //build. - "//build_overrides/build.gni", - - # TODO(dgn): Layer violation but breaks the build otherwise, see - # https://crbug.com/474506. - "//clank/java/BUILD.gn", - "//clank/native/BUILD.gn", - - "//remoting/host/installer/linux/BUILD.gn", - "//remoting/remoting_version.gni", - "//remoting/host/installer/win/generate_clsids.gni", - - # TODO(dpranke): Get these from the appropriate repos instead. - "//third_party/angle/BUILD.gn", - "//third_party/angle/src/tests/BUILD.gn", - "//third_party/angle/src/vulkan_support/BUILD.gn", - "//third_party/catapult/tracing/BUILD.gn", - "//third_party/google_input_tools/inputview.gni", - - # CLD2 should be removed soon, delete this when we do. - "//third_party/cld_2/BUILD.gn", - "//tools/grit/grit_rule.gni", - - # Not gypi-to-gn. - "//google_apis/BUILD.gn", - "//printing/BUILD.gn", - ] diff --git a/chromium/BUILD.gn b/chromium/BUILD.gn index df54a97736b..b95533bac8b 100644 --- a/chromium/BUILD.gn +++ b/chromium/BUILD.gn @@ -21,6 +21,7 @@ import("//remoting/remoting_enable.gni") import("//third_party/openh264/openh264_args.gni") import("//tools/ipc_fuzzer/ipc_fuzzer.gni") import("//ui/base/ui_features.gni") +import("//ui/gl/ui_gl.gni") import("//ui/ozone/ozone.gni") import("//v8/gni/v8.gni") import("//v8/snapshot_toolchain.gni") @@ -34,6 +35,7 @@ declare_args() { # checkout to add additional targets without explicitly changing any checked- # in files. root_extra_deps = [] + qtwebengine_target = "//tools/gn" } if (is_official_build) { @@ -155,6 +157,14 @@ group("gn_all") { "//ui/accessibility:accessibility_unittests", "//ui/accessibility/extensions", ] + if (use_qt) { + deps -= [ + "//chrome/test:browser_tests", + "//chrome/test:interactive_ui_tests", + "//chrome/test:sync_integration_tests", + "//chrome/test/chromedriver:chromedriver_unittests", + ] + } } if (!is_ios) { @@ -223,6 +233,13 @@ group("gn_all") { "//url/ipc:url_ipc_unittests", "//v8:gn_all", ] + if (use_qt) { + deps -= [ + "//chrome/test:telemetry_perf_unittests", + "//chrome/test:unit_tests", + "//third_party/catapult/telemetry:bitmaptools($host_toolchain)", + ] + } } else if (is_ios) { deps += [ "//ios:all" ] } else if (is_fuchsia) { @@ -432,7 +449,7 @@ group("gn_all") { ] } - if ((is_win || is_mac || is_linux || is_chromeos) && + if (enable_swiftshader && (target_cpu == "x86" || target_cpu == "x64")) { deps += [ "//third_party/swiftshader" ] } @@ -485,6 +502,14 @@ group("gn_all") { "//third_party/leveldatabase:env_chromium_unittests", "//third_party/libaddressinput:libaddressinput_unittests", ] + if (use_qt) { + deps -= [ + "//chrome/test:load_library_perf_tests", + "//chrome/test:sync_performance_tests", + "//chrome/test/chromedriver:chromedriver", + "//chrome/test/chromedriver:chromedriver_tests", + ] + } } if (enable_extensions) { @@ -629,7 +654,7 @@ group("gn_all") { deps += [ "//components/proximity_auth:proximity_auth_unittests" ] } - if (is_win || is_linux) { + if ((is_win || is_linux) && !use_qt) { deps += [ "//mash:all", "//media/mojo/services:media_service_unittests", @@ -687,6 +712,9 @@ group("gn_all") { if (target_cpu == "x86" || target_cpu == "x64") { if (!is_android) { deps += [ "//chrome/test:load_library_perf_tests" ] + if (use_qt) { + deps -= [ "//chrome/test:load_library_perf_tests" ] + } } deps += [ "//native_client/src/trusted/platform_qualify:vcpuid", @@ -754,7 +782,7 @@ if (is_fuchsia) { # TODO(GYP_GONE): Figure out if we really need this target or if there's # some better way to specify things. -if (is_win) { +if (is_win && !use_qt) { group("chrome_official_builder_no_unittests") { deps = [ "//chrome/common/win:eventlog_provider", @@ -1042,12 +1070,19 @@ group("chromium_builder_perf") { "//media:media_perftests", "//tools/perf/chrome_telemetry_build:telemetry_chrome_test", ] + if (use_qt) { + data_deps -= [ + "//chrome/test:load_library_perf_tests", + "//chrome/test:telemetry_perf_tests", + "//tools/perf/chrome_telemetry_build:telemetry_chrome_test", + ] + } if (is_android) { data += [ "//third_party/android_tools/sdk/platform-tools/adb" ] } - if (!is_chromeos) { + if (!is_chromeos && !use_qt) { data_deps += [ "//chrome/test:performance_browser_tests" ] } if (is_linux && !is_chromeos) { @@ -1149,3 +1184,7 @@ template("assert_valid_out_dir") { assert_valid_out_dir("_unused") { actual_sources = [ "$root_build_dir/foo" ] } + +group("qtwebengine") { + deps = [ qtwebengine_target ] +} diff --git a/chromium/base/BUILD.gn b/chromium/base/BUILD.gn index 6ecbad17b20..67a12c31024 100644 --- a/chromium/base/BUILD.gn +++ b/chromium/base/BUILD.gn @@ -1125,7 +1125,7 @@ component("base") { # Needed for <atomic> if using newer C++ library than sysroot, except if # building inside the cros_sdk environment - use host_toolchain as a # more robust check for this. - if (!use_sysroot && (is_android || (is_linux && !is_chromecast)) && + if (!use_sysroot && (is_android || (is_linux && !is_chromecast && !use_qt)) && host_toolchain != "//build/toolchain/cros:host") { libs = [ "atomic" ] } diff --git a/chromium/base/allocator/allocator_check.cc b/chromium/base/allocator/allocator_check.cc index fba38d151d3..9cd5d2207de 100644 --- a/chromium/base/allocator/allocator_check.cc +++ b/chromium/base/allocator/allocator_check.cc @@ -34,7 +34,7 @@ bool IsAllocatorInitialized() { #define TC_MALLOPT_IS_OVERRIDDEN_BY_TCMALLOC 0xbeef42 return (mallopt(TC_MALLOPT_IS_OVERRIDDEN_BY_TCMALLOC, 0) == TC_MALLOPT_IS_OVERRIDDEN_BY_TCMALLOC); -#elif defined(OS_MACOSX) && !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) +#elif defined(OS_MACOSX) && !defined(MEMORY_TOOL_REPLACES_ALLOCATOR) && !defined(TOOLKIT_QT) // From allocator_interception_mac.mm. return base::allocator::g_replaced_default_zone; #else diff --git a/chromium/base/base_paths.h b/chromium/base/base_paths.h index ef6aa828362..c50142f15da 100644 --- a/chromium/base/base_paths.h +++ b/chromium/base/base_paths.h @@ -46,6 +46,9 @@ enum BasePathKey { DIR_TEST_DATA, // Used only for testing. + DIR_QT_LIBRARY_DATA, + DIR_APP_DICTIONARIES, + DIR_USER_DATA, PATH_END }; diff --git a/chromium/base/command_line.cc b/chromium/base/command_line.cc index 873da813483..a09fc467421 100644 --- a/chromium/base/command_line.cc +++ b/chromium/base/command_line.cc @@ -212,7 +212,7 @@ void CommandLine::InitUsingArgvForTesting(int argc, const char* const* argv) { #endif // static -bool CommandLine::Init(int argc, const char* const* argv) { +bool CommandLine::CreateEmpty() { if (current_process_commandline_) { // If this is intentional, Reset() must be called first. If we are using // the shared build mode, we have to share a single object across multiple @@ -221,6 +221,14 @@ bool CommandLine::Init(int argc, const char* const* argv) { } current_process_commandline_ = new CommandLine(NO_PROGRAM); + return true; +} + +// static +bool CommandLine::Init(int argc, const char* const* argv) { + if (!CreateEmpty()) + return false; + #if defined(OS_WIN) current_process_commandline_->ParseFromString(::GetCommandLineW()); #elif defined(OS_POSIX) diff --git a/chromium/base/command_line.h b/chromium/base/command_line.h index 3d29f8fee7f..d3a3fe4d3e2 100644 --- a/chromium/base/command_line.h +++ b/chromium/base/command_line.h @@ -78,6 +78,8 @@ class BASE_EXPORT CommandLine { static void InitUsingArgvForTesting(int argc, const char* const* argv); #endif + static bool CreateEmpty(); + // Initialize the current process CommandLine singleton. On Windows, ignores // its arguments (we instead parse GetCommandLineW() directly) because we // don't trust the CRT's parsing of the command line, but it still must be diff --git a/chromium/base/i18n/icu_util.cc b/chromium/base/i18n/icu_util.cc index 4a1327bf156..a5d680ee9cf 100644 --- a/chromium/base/i18n/icu_util.cc +++ b/chromium/base/i18n/icu_util.cc @@ -96,7 +96,12 @@ void LazyInitIcuDataFile() { } // For unit tests, data file is located on disk, so try there as a fallback. #endif // defined(OS_ANDROID) -#if !defined(OS_MACOSX) +#if defined(TOOLKIT_QT) + FilePath data_path; + bool path_ok = PathService::Get(base::DIR_QT_LIBRARY_DATA, &data_path); + DCHECK(path_ok); + data_path = data_path.AppendASCII(kIcuDataFileName); +#elif !defined(OS_MACOSX) FilePath data_path; #if defined(OS_WIN) // The data file will be in the same directory as the current module. diff --git a/chromium/base/logging.h b/chromium/base/logging.h index a2cdaa13d70..f81fb18c202 100644 --- a/chromium/base/logging.h +++ b/chromium/base/logging.h @@ -660,6 +660,11 @@ class CheckOpResult { #endif // !(OFFICIAL_BUILD && NDEBUG) +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Waddress" +#endif // __GNUC__ + // This formats a value for a failing CHECK_XX statement. Ordinarily, // it uses the definition for operator<<, with a few special cases below. template <typename T> @@ -695,6 +700,10 @@ MakeCheckOpValueString(std::ostream* os, const T& v) { (*os) << static_cast<typename std::underlying_type<T>::type>(v); } +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif + // We need an explicit overload for std::nullptr_t. BASE_EXPORT void MakeCheckOpValueString(std::ostream* os, std::nullptr_t p); diff --git a/chromium/base/mac/sdk_forward_declarations.h b/chromium/base/mac/sdk_forward_declarations.h index cc405f91e55..0deec42c37a 100644 --- a/chromium/base/mac/sdk_forward_declarations.h +++ b/chromium/base/mac/sdk_forward_declarations.h @@ -217,9 +217,11 @@ BASE_EXPORT extern NSString* const CIDetectorTypeText; #if !defined(MAC_OS_X_VERSION_10_12) || \ MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12 +#ifndef TOOLKIT_QT @interface NSWindow (SierraSDK) @property(class) BOOL allowsAutomaticWindowTabbing; @end +#endif #endif // MAC_OS_X_VERSION_10_12 diff --git a/chromium/base/message_loop/message_loop.cc b/chromium/base/message_loop/message_loop.cc index f60fd180641..d50472dccf0 100644 --- a/chromium/base/message_loop/message_loop.cc +++ b/chromium/base/message_loop/message_loop.cc @@ -287,15 +287,15 @@ MessageLoop::MessageLoop(Type type, MessagePumpFactoryCallback pump_factory) } void MessageLoop::BindToCurrentThread() { + DCHECK(!current()) << "should only have one message loop per thread"; + GetTLSMessageLoop()->Set(this); + DCHECK(!pump_); if (!pump_factory_.is_null()) pump_ = std::move(pump_factory_).Run(); else pump_ = CreateMessagePumpForType(type_); - DCHECK(!current()) << "should only have one message loop per thread"; - GetTLSMessageLoop()->Set(this); - incoming_task_queue_->StartScheduling(); unbound_task_runner_->BindToCurrentThread(); unbound_task_runner_ = nullptr; diff --git a/chromium/base/metrics/persistent_memory_allocator.cc b/chromium/base/metrics/persistent_memory_allocator.cc index f3ade51dd36..4460e44aedb 100644 --- a/chromium/base/metrics/persistent_memory_allocator.cc +++ b/chromium/base/metrics/persistent_memory_allocator.cc @@ -349,10 +349,13 @@ PersistentMemoryAllocator::PersistentMemoryAllocator(Memory memory, // These atomics operate inter-process and so must be lock-free. The local // casts are to make sure it can be evaluated at compile time to a constant. +#ifndef TOOLKIT_QT + // These can not be inlined by clang-libstdc++ and some embedded GCC versions CHECK(((SharedMetadata*)0)->freeptr.is_lock_free()); CHECK(((SharedMetadata*)0)->flags.is_lock_free()); CHECK(((BlockHeader*)0)->next.is_lock_free()); CHECK(corrupt_.is_lock_free()); +#endif if (shared_meta()->cookie != kGlobalCookie) { if (readonly) { diff --git a/chromium/base/run_loop.h b/chromium/base/run_loop.h index 7cf72dbf01d..ac277ba67bb 100644 --- a/chromium/base/run_loop.h +++ b/chromium/base/run_loop.h @@ -18,6 +18,10 @@ #include "base/threading/thread_checker.h" #include "build/build_config.h" +namespace QtWebEngineCore { +class WebEngineContext; +} + namespace base { #if defined(OS_ANDROID) class MessagePumpForUI; @@ -275,6 +279,7 @@ class BASE_EXPORT RunLoop { }; private: + friend class QtWebEngineCore::WebEngineContext; #if defined(OS_ANDROID) // Android doesn't support the blocking RunLoop::Run, so it calls // BeforeRun and AfterRun directly. diff --git a/chromium/base/synchronization/lock_impl_posix.cc b/chromium/base/synchronization/lock_impl_posix.cc index 5ad337d9f71..7e2cce7f7ef 100644 --- a/chromium/base/synchronization/lock_impl_posix.cc +++ b/chromium/base/synchronization/lock_impl_posix.cc @@ -35,8 +35,9 @@ LockImpl::LockImpl() { DCHECK_EQ(rv, 0) << ". " << strerror(rv); } #endif -#ifndef NDEBUG +#if !defined(NDEBUG) && 0 // In debug, setup attributes for lock error checking. + // -- Disabled due to erroneous EDEADLK errors when sandboxed. rv = pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_ERRORCHECK); DCHECK_EQ(rv, 0) << ". " << strerror(rv); #endif diff --git a/chromium/base/third_party/libevent/BUILD.gn b/chromium/base/third_party/libevent/BUILD.gn index e934454a10f..62e212870e6 100644 --- a/chromium/base/third_party/libevent/BUILD.gn +++ b/chromium/base/third_party/libevent/BUILD.gn @@ -3,8 +3,13 @@ # found in the LICENSE file. import("//build/config/nacl/config.gni") +import("//build/shim_headers.gni") -static_library("libevent") { +declare_args() { + use_system_libevent = false +} + +static_library("bundled_libevent") { sources = [ "buffer.c", "evbuffer.c", @@ -78,3 +83,29 @@ static_library("libevent") { configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] } + +shim_headers("libevent_shim") { + root_path = "." + headers = [ "event.h" ] +} + +source_set("system_libevent") { + deps = [ + ":libevent_shim", + ] + libs = [ "event" ] +} + +group("libevent") { + if (host_toolchain != current_toolchain) { + if (use_system_libevent) { + public_deps = [ ":system_libevent" ] + } else { + public_deps = [ ":bundled_libevent" ] + } + } else { + # Fix me: unbundle for host build + # this requires host pkg-config besides sysroot one. + public_deps = [ ":bundled_libevent" ] + } +} diff --git a/chromium/build/config/BUILD.gn b/chromium/build/config/BUILD.gn index 28d8f76855c..8b58542cd2b 100644 --- a/chromium/build/config/BUILD.gn +++ b/chromium/build/config/BUILD.gn @@ -133,6 +133,10 @@ config("feature_flags") { defines += [ "FIELDTRIAL_TESTING_ENABLED" ] } + if (use_qt) { + defines += [ "TOOLKIT_QT" ] + } + # ============================================== # PLEASE DO NOT ADD MORE THINGS TO THIS LIST # ============================================== diff --git a/chromium/build/config/BUILDCONFIG.gn b/chromium/build/config/BUILDCONFIG.gn index 6d705aa0f09..cb59b3b9f45 100644 --- a/chromium/build/config/BUILDCONFIG.gn +++ b/chromium/build/config/BUILDCONFIG.gn @@ -169,6 +169,11 @@ declare_args() { is_debug && current_os != "ios" && current_os != "fuchsia" } +declare_args() { + # Shared library build + is_shared = is_component_build +} + assert(!(is_debug && is_official_build), "Can't do official debug builds") # ============================================================================== diff --git a/chromium/build/config/allocator.gni b/chromium/build/config/allocator.gni index 5ac3ed67049..174df9195e6 100644 --- a/chromium/build/config/allocator.gni +++ b/chromium/build/config/allocator.gni @@ -17,7 +17,7 @@ if (is_android || current_cpu == "mipsel" || is_mac || is_ios || is_asan || # the shim. NaCl in particular does seem to link some binaries statically # against the debug CRT with "is_nacl=false". if ((is_linux || is_android || is_mac || - (is_win && !is_component_build && !is_debug)) && !is_asan && !is_lsan && + (is_win && !is_shared && !is_debug)) && !is_asan && !is_lsan && !is_tsan && !is_msan) { _default_use_allocator_shim = true } else { diff --git a/chromium/build/config/compiler/BUILD.gn b/chromium/build/config/compiler/BUILD.gn index 7888e2f8589..a1b2e74fc53 100644 --- a/chromium/build/config/compiler/BUILD.gn +++ b/chromium/build/config/compiler/BUILD.gn @@ -11,6 +11,9 @@ import("//build/toolchain/cc_wrapper.gni") import("//build/toolchain/toolchain.gni") import("//build_overrides/build.gni") +# Import features.gni for the "use_qt" argument to be available. +import("//build/config/features.gni") + if (current_cpu == "arm" || current_cpu == "arm64") { import("//build/config/arm.gni") } @@ -95,6 +98,12 @@ declare_args() { # it harder to debug binaries. strip_absolute_paths_from_debug_symbols = false + # Enable this to turn off the delete-null-pointer-checks optimization in GCC 6+ + no_delete_null_pointer_checks = false + + # Use stdlib=libc++ + use_libcxx = is_mac + # Allow projects that wish to stay on C++11 to override Chromium's default. use_cxx11 = false @@ -138,8 +147,8 @@ if (use_debug_fission == "default") { # this and specify their own include paths. config("default_include_dirs") { include_dirs = [ - "//", root_gen_dir, + "//", ] } @@ -250,7 +259,16 @@ config("compiler") { } } - if (is_clang && is_debug) { + if (use_qt && is_clang) { + cflags_cc += [ + "-Wno-parentheses-equality", + "-Wno-tautological-compare", + "-Wno-unknown-attributes", + "-Wno-unknown-warning-option" + ] + } + + if (is_clang && (is_debug || use_qt)) { # Allow comparing the address of references and 'this' against 0 # in debug builds. Technically, these can never be null in # well-defined C/C++ and Clang can optimize such checks away in @@ -499,11 +517,15 @@ config("compiler") { } } - if (is_mac) { + if (use_libcxx) { cflags_cc += [ "-stdlib=libc++" ] ldflags += [ "-stdlib=libc++" ] } + if (no_delete_null_pointer_checks) { + cflags_cc += [ "-fno-delete-null-pointer-checks" ] + } + # Add flags for link-time optimization. These flags enable # optimizations/transformations that require whole-program visibility at link # time, so they need to be applied to all translation units, and we may end up @@ -610,7 +632,6 @@ config("compiler_cpu_abi") { if (current_cpu == "x64") { cflags += [ "-m64", - "-march=x86-64", ] ldflags += [ "-m64" ] } else if (current_cpu == "x86") { @@ -1336,7 +1357,7 @@ config("chromium_code") { # Non-chromium code is not guaranteed to compile cleanly with # _FORTIFY_SOURCE. Also, fortified build may fail when optimizations are # disabled, so only do that for Release build. - defines += [ "_FORTIFY_SOURCE=2" ] + cflags += [ "-U_FORTIFY_SOURCE", "-D_FORTIFY_SOURCE=2" ] } if (is_mac || is_ios) { @@ -1669,6 +1690,14 @@ config("no_optimize") { } } +config("optimize_size_only") { + if (is_win) { + cflags = [ "/O1" ] + } else { + cflags = [ "-Os" ] + } +} + # Turns up the optimization level. On Windows, this implies whole program # optimization and link-time code generation which is very expensive and should # be used sparingly. diff --git a/chromium/build/config/features.gni b/chromium/build/config/features.gni index d014d0e12f1..4e432bac3f7 100644 --- a/chromium/build/config/features.gni +++ b/chromium/build/config/features.gni @@ -56,6 +56,8 @@ declare_args() { current_toolchain == default_toolchain use_gio = is_linux && !is_chromeos && !is_chromecast + + use_qt = false } # # ============================================= diff --git a/chromium/build/config/linux/pangocairo/pangocairo.gni b/chromium/build/config/linux/pangocairo/pangocairo.gni index ca99445b967..92d32e0f449 100644 --- a/chromium/build/config/linux/pangocairo/pangocairo.gni +++ b/chromium/build/config/linux/pangocairo/pangocairo.gni @@ -4,4 +4,4 @@ import("//build/config/ui.gni") -use_pangocairo = is_linux && !use_ozone +use_pangocairo = use_gtk diff --git a/chromium/build/config/mac/mac_sdk.gni b/chromium/build/config/mac/mac_sdk.gni index 5aa4ef173ce..4cfeab9b842 100644 --- a/chromium/build/config/mac/mac_sdk.gni +++ b/chromium/build/config/mac/mac_sdk.gni @@ -79,7 +79,7 @@ if (mac_sdk_version != mac_sdk_min && "test", xcode_version, "-ge", - "0730", + "0721", ], "value") != 1) { print( diff --git a/chromium/build/config/sysroot.gni b/chromium/build/config/sysroot.gni index fa361e6d389..2610660a110 100644 --- a/chromium/build/config/sysroot.gni +++ b/chromium/build/config/sysroot.gni @@ -21,7 +21,7 @@ declare_args() { } if (current_os == target_os && current_cpu == target_cpu && - target_sysroot != "") { + current_toolchain == default_toolchain && target_sysroot != "") { sysroot = target_sysroot } else if (is_android) { import("//build/config/android/config.gni") diff --git a/chromium/build/config/ui.gni b/chromium/build/config/ui.gni index 949e09f7b26..b6af25fbca5 100644 --- a/chromium/build/config/ui.gni +++ b/chromium/build/config/ui.gni @@ -18,6 +18,7 @@ # of //build/config/BUILDCONFIG.gn. import("//build/config/chromecast_build.gni") +import("//build/config/features.gni") declare_args() { # Indicates if Ash is enabled. Ash is the Aura Shell which provides a @@ -42,6 +43,8 @@ declare_args() { # True means the UI is built using the "views" framework. toolkit_views = (is_mac || is_win || is_chromeos || use_aura) && !is_chromecast && !is_fuchsia + + use_xscrnsaver = !is_chromeos } # Additional dependent variables ----------------------------------------------- @@ -51,13 +54,21 @@ declare_args() { # Indicates if the UI toolkit depends on X11. use_x11 = is_linux && !use_ozone +# Indicates if the UI toolkit depends on GTK. +use_gtk = use_x11 && !use_qt + # Turn off glib if Ozone is enabled. if (use_ozone) { use_glib = false } +if (!use_x11) { + use_xscrnsaver = false +} + # Whether to use atk, the Accessibility ToolKit library -use_atk = is_desktop_linux && use_x11 +use_atk = is_desktop_linux && use_gtk + # ============================================= # PLEASE DO NOT ADD MORE FLAGS TO THIS FILE # ============================================= diff --git a/chromium/build/config/win/BUILD.gn b/chromium/build/config/win/BUILD.gn index c121d2cf1b6..fca2058f470 100644 --- a/chromium/build/config/win/BUILD.gn +++ b/chromium/build/config/win/BUILD.gn @@ -19,6 +19,8 @@ declare_args() { # Turn this on to have the linker output extra timing information. win_linker_timing = false + + use_incremental_linking = (is_debug || is_component_build) && !is_syzyasan } # This is included by reference in the //build/config/compiler config that @@ -280,7 +282,7 @@ config("cfi_linker") { # See https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx for a reference of # what each value does. config("default_crt") { - if (is_component_build) { + if (is_shared) { # Component mode: dynamic CRT. Since the library is shared, it requires # exceptions or will give errors about things not matching, so keep # exceptions on. @@ -352,7 +354,7 @@ incremental_linking_off_switch = [ "/INCREMENTAL:NO" ] # Disable incremental linking for syzyasan, enable for debug builds and all # component builds - any builds where performance is not job one. -if ((is_debug || is_component_build) && !is_syzyasan) { +if (use_incremental_linking) { default_incremental_linking_switch = incremental_linking_on_switch } else { default_incremental_linking_switch = incremental_linking_off_switch diff --git a/chromium/build/config/win/visual_studio_version.gni b/chromium/build/config/win/visual_studio_version.gni index 982fbe8d3f0..3bc58fe4d7a 100644 --- a/chromium/build/config/win/visual_studio_version.gni +++ b/chromium/build/config/win/visual_studio_version.gni @@ -20,9 +20,11 @@ declare_args() { # This value is the default location, override if you have a different # installation location. windows_sdk_path = "C:\Program Files (x86)\Windows Kits\10" + + ninja_use_custom_environment_files = true } -if (visual_studio_path == "") { +if (visual_studio_path == "" && ninja_use_custom_environment_files) { toolchain_data = exec_script("../../vs_toolchain.py", [ "get_toolchain_dir" ], "scope") visual_studio_path = toolchain_data.vs_path @@ -33,7 +35,9 @@ if (visual_studio_path == "") { } else { assert(visual_studio_version != "", "You must set the visual_studio_version if you set the path") - assert(wdk_path != "", - "You must set the wdk_path if you set the visual studio path") - visual_studio_runtime_dirs = [] + if (ninja_use_custom_environment_files) { + assert(wdk_path != "", + "You must set the wdk_path if you set the visual studio path") + } + visual_studio_runtime_dirs = "\"\"" } diff --git a/chromium/build/shim_headers.gni b/chromium/build/shim_headers.gni index 56591484d1c..a71ea6ec406 100644 --- a/chromium/build/shim_headers.gni +++ b/chromium/build/shim_headers.gni @@ -5,7 +5,7 @@ template("shim_headers") { action_name = "gen_${target_name}" config_name = "${target_name}_config" - shim_headers_path = "${root_gen_dir}/shim_headers/${target_name}" + shim_headers_path = "${root_gen_dir}" config(config_name) { include_dirs = [ shim_headers_path ] @@ -28,8 +28,11 @@ template("shim_headers") { } args += invoker.headers - outputs = process_file_template(invoker.headers, - "${shim_headers_path}/{{source_file_part}}") + output_pattern = "$target_gen_dir/" + invoker.root_path + "/{{source_file_part}}" + outputs = process_file_template(invoker.headers,output_pattern) + + input_pattern = "{{source_dir}}/" + invoker.root_path + "/{{source_file_part}}" + inputs = process_file_template(invoker.headers, input_pattern) } group(target_name) { diff --git a/chromium/build/toolchain/gcc_toolchain.gni b/chromium/build/toolchain/gcc_toolchain.gni index 74b2529709a..d5e448c82de 100644 --- a/chromium/build/toolchain/gcc_toolchain.gni +++ b/chromium/build/toolchain/gcc_toolchain.gni @@ -11,6 +11,9 @@ import("//build/toolchain/clang_static_analyzer.gni") import("//build/toolchain/goma.gni") import("//build/toolchain/toolchain.gni") +# Import features.gni for the "use_qt" argument to be available. +import("//build/config/features.gni") + if (is_nacl) { # To keep NaCl variables out of builds that don't include NaCl, all # variables defined in nacl/config.gni referenced here should be protected by @@ -198,6 +201,12 @@ template("gcc_toolchain") { nm = "nm" } + if (defined(toolchain_args.gnu_thin_archive) && toolchain_args.gnu_thin_archive) { + arcommand = "rcsDT" + } else { + arcommand = "rcsD" + } + if (defined(invoker.shlib_extension)) { default_shlib_extension = invoker.shlib_extension } else { @@ -334,7 +343,9 @@ template("gcc_toolchain") { # POSIX-like toolchains such as NaCl on Windows). ar_wrapper = rebase_path("//build/toolchain/gcc_ar_wrapper.py", root_build_dir) - if (current_os == "aix") { + if (use_qt) { + extra_arflags = arcommand + } else if (current_os == "aix") { # We use slightly different arflags for AIX. extra_arflags = "rcsT" } else { diff --git a/chromium/build/toolchain/toolchain.gni b/chromium/build/toolchain/toolchain.gni index ebb98fe416a..96e46017266 100644 --- a/chromium/build/toolchain/toolchain.gni +++ b/chromium/build/toolchain/toolchain.gni @@ -9,6 +9,10 @@ import("//build_overrides/build.gni") import("//build/config/chrome_build.gni") declare_args() { + # Use GNU ar's thin archive mode to avoid duplicating binary code more + # than necessary. + gnu_thin_archive = is_linux + # If this is set to true, or if LLVM_FORCE_HEAD_REVISION is set to 1 # in the environment, we use the revision in the llvm repo to determine # the CLANG_REVISION to use, instead of the version hard-coded into diff --git a/chromium/build/toolchain/win/BUILD.gn b/chromium/build/toolchain/win/BUILD.gn index 137b2c3a3e4..73fd2825346 100644 --- a/chromium/build/toolchain/win/BUILD.gn +++ b/chromium/build/toolchain/win/BUILD.gn @@ -34,7 +34,7 @@ if (use_goma) { # Copy the VS runtime DLL for the default toolchain to the root build directory # so things will run. -if (current_toolchain == default_toolchain) { +if (current_toolchain == default_toolchain && ninja_use_custom_environment_files) { if (is_debug) { configuration_name = "Debug" } else { @@ -346,14 +346,22 @@ if (host_os == "win") { # since we don't do any 32-bit cross compiles when targeting 64-bit (the # build does generate some 64-bit stuff from 32-bit target builds). if (target_cpu == "x86") { - x86_toolchain_data = exec_script("setup_toolchain.py", - [ - visual_studio_path, - windows_sdk_path, - visual_studio_runtime_dirs, - "x86", - ], - "scope") + if (ninja_use_custom_environment_files) { + x86_toolchain_data = exec_script("setup_toolchain.py", + [ + visual_studio_path, + windows_sdk_path, + visual_studio_runtime_dirs, + "x86", + ], + "scope") + } else { + x86_toolchain_data = exec_script("setup_toolchain.py", + [ + "x86", + ], + "scope") + } msvc_toolchain("x86") { environment = "environment.x86" @@ -378,14 +386,22 @@ if (target_cpu == "x86") { } # 64-bit toolchains. -x64_toolchain_data = exec_script("setup_toolchain.py", - [ - visual_studio_path, - windows_sdk_path, - visual_studio_runtime_dirs, - "x64", - ], - "scope") +if (ninja_use_custom_environment_files) { + x64_toolchain_data = exec_script("setup_toolchain.py", + [ + visual_studio_path, + windows_sdk_path, + visual_studio_runtime_dirs, + "x64", + ], + "scope") +} else { + x64_toolchain_data = exec_script("setup_toolchain.py", + [ + "x64", + ], + "scope") +} template("win_x64_toolchains") { msvc_toolchain(target_name) { diff --git a/chromium/build/toolchain/win/setup_toolchain.py b/chromium/build/toolchain/win/setup_toolchain.py index bb599d62968..6872561c48e 100644 --- a/chromium/build/toolchain/win/setup_toolchain.py +++ b/chromium/build/toolchain/win/setup_toolchain.py @@ -161,27 +161,33 @@ def _FormatAsEnvironmentBlock(envvar_dict): def main(): - if len(sys.argv) != 5: + if len(sys.argv) != 5 and len(sys.argv) != 2: print('Usage setup_toolchain.py ' '<visual studio path> <win sdk path> ' '<runtime dirs> <target_cpu> <include prefix>') + print('or setup_toolchain.py <target_cpu>') sys.exit(2) - win_sdk_path = sys.argv[2] - runtime_dirs = sys.argv[3] - target_cpu = sys.argv[4] + if len(sys.argv) == 5: + win_sdk_path = sys.argv[2] + runtime_dirs = sys.argv[3] + target_cpu = sys.argv[4] + else: + target_cpu = sys.argv[1] cpus = ('x86', 'x64') assert target_cpu in cpus vc_bin_dir = '' include = '' - # TODO(scottmg|goma): Do we need an equivalent of - # ninja_use_custom_environment_files? + ninja_use_custom_environment_files = (len(sys.argv) == 6) for cpu in cpus: # Extract environment variables for subprocesses. - env = _LoadToolchainEnv(cpu, win_sdk_path) - env['PATH'] = runtime_dirs + os.pathsep + env['PATH'] + if not ninja_use_custom_environment_files: + env = os.environ + else: + env = _LoadToolchainEnv(cpu, win_sdk_path) + env['PATH'] = runtime_dirs + os.pathsep + env['PATH'] if cpu == target_cpu: for path in env['PATH'].split(os.pathsep): @@ -199,11 +205,14 @@ def main(): f.write(env_block) # Create a store app version of the environment. - if 'LIB' in env: - env['LIB'] = env['LIB'] .replace(r'\VC\LIB', r'\VC\LIB\STORE') - if 'LIBPATH' in env: - env['LIBPATH'] = env['LIBPATH'].replace(r'\VC\LIB', r'\VC\LIB\STORE') - env_block = _FormatAsEnvironmentBlock(env) + # If using environment it should already be correct, and changing it + # would break the normal build + if ninja_use_custom_environment_files: + if 'LIB' in env: + env['LIB'] = env['LIB'] .replace(r'\VC\LIB', r'\VC\LIB\STORE') + if 'LIBPATH' in env: + env['LIBPATH'] = env['LIBPATH'].replace(r'\VC\LIB', r'\VC\LIB\STORE') + env_block = _FormatAsEnvironmentBlock(env) with open('environment.winrt_' + cpu, 'wb') as f: f.write(env_block) diff --git a/chromium/cc/layers/texture_layer.cc b/chromium/cc/layers/texture_layer.cc index 403b781e49a..5e24d2c78e7 100644 --- a/chromium/cc/layers/texture_layer.cc +++ b/chromium/cc/layers/texture_layer.cc @@ -15,6 +15,8 @@ #include "cc/layers/texture_layer_impl.h" #include "cc/trees/layer_tree_host.h" #include "components/viz/common/resources/single_release_callback.h" +#include "third_party/khronos/GLES2/gl2.h" +#include "third_party/khronos/GLES2/gl2ext.h" namespace cc { diff --git a/chromium/cc/raster/staging_buffer_pool.cc b/chromium/cc/raster/staging_buffer_pool.cc index 81b0e7e5be6..40f70ecf779 100644 --- a/chromium/cc/raster/staging_buffer_pool.cc +++ b/chromium/cc/raster/staging_buffer_pool.cc @@ -14,6 +14,8 @@ #include "cc/base/container_util.h" #include "cc/resources/scoped_resource.h" #include "gpu/command_buffer/client/gles2_interface.h" +#include "third_party/khronos/GLES2/gl2.h" +#include "third_party/khronos/GLES2/gl2ext.h" using base::trace_event::MemoryAllocatorDump; using base::trace_event::MemoryAllocatorDumpGuid; diff --git a/chromium/cc/resources/resource_provider.h b/chromium/cc/resources/resource_provider.h index 7a0927b8f0a..a6de34d549d 100644 --- a/chromium/cc/resources/resource_provider.h +++ b/chromium/cc/resources/resource_provider.h @@ -35,8 +35,6 @@ #include "components/viz/common/resources/resource_settings.h" #include "components/viz/common/resources/single_release_callback.h" #include "components/viz/common/resources/transferable_resource.h" -#include "third_party/khronos/GLES2/gl2.h" -#include "third_party/khronos/GLES2/gl2ext.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkSurface.h" #include "ui/gfx/buffer_types.h" @@ -50,6 +48,9 @@ namespace gles { class GLES2Interface; } } +// A correct fix would be not to use GL types in this interal API file. +typedef unsigned int GLenum; +typedef int GLint; namespace viz { class SharedBitmap; diff --git a/chromium/cc/resources/scoped_resource.cc b/chromium/cc/resources/scoped_resource.cc index e63e9c26dc4..319304d6579 100644 --- a/chromium/cc/resources/scoped_resource.cc +++ b/chromium/cc/resources/scoped_resource.cc @@ -4,6 +4,8 @@ #include "cc/resources/scoped_resource.h" +#include "third_party/khronos/GLES2/gl2.h" + namespace cc { ScopedResource::ScopedResource(ResourceProvider* resource_provider) diff --git a/chromium/chrome/browser/BUILD.gn b/chromium/chrome/browser/BUILD.gn index 3bb9e572d56..a01504827f9 100644 --- a/chromium/chrome/browser/BUILD.gn +++ b/chromium/chrome/browser/BUILD.gn @@ -3071,7 +3071,7 @@ split_static_library("browser") { ] } - if (use_aura && !use_ozone && is_desktop_linux) { + if (use_aura && use_gtk) { deps += [ "//chrome/browser/ui/libgtkui" ] } @@ -4348,7 +4348,6 @@ grit("resources") { "//chrome/app:chrome_content_manifest_overlays", "//chrome/browser/engagement:mojo_bindings_js", "//chrome/browser/media:mojo_bindings_js", - "//chrome/browser/resources/ssl/ssl_error_assistant:make_ssl_error_assistant_protobuf", "//chrome/browser/ui/webui/interventions_internals:mojo_bindings_js", "//chrome/browser/ui/webui/omnibox:mojo_bindings_js", "//chrome/browser/ui/webui/usb_internals:mojo_bindings_js", @@ -4370,6 +4369,7 @@ grit("resources") { deps += [ "//chrome/browser/resources/safe_browsing:make_file_types_protobuf" ] } + deps += [ "//chrome/browser/resources/ssl/ssl_error_assistant:make_ssl_error_assistant_protobuf" ] } if (is_chrome_branded) { diff --git a/chromium/chrome/browser/media/router/BUILD.gn b/chromium/chrome/browser/media/router/BUILD.gn index 9ffad961491..4bbc63ea0e2 100644 --- a/chromium/chrome/browser/media/router/BUILD.gn +++ b/chromium/chrome/browser/media/router/BUILD.gn @@ -3,6 +3,7 @@ # found in the LICENSE file. # +import("//build/config/features.gni") import("//extensions/features/features.gni") import("//testing/test.gni") @@ -98,6 +99,11 @@ static_library("test_support") { "//chrome/test:test_support", "//testing/gmock", ] + if (use_qt) { + deps -= [ + "//chrome/test:test_support", + ] + } public_deps = [ ":router", ] diff --git a/chromium/chrome/browser/printing/print_job.cc b/chromium/chrome/browser/printing/print_job.cc index 964eec8c10e..c5f66fc9be2 100644 --- a/chromium/chrome/browser/printing/print_job.cc +++ b/chromium/chrome/browser/printing/print_job.cc @@ -25,7 +25,7 @@ #include "printing/printed_document.h" #include "printing/printed_page.h" -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) #include "chrome/browser/printing/pdf_to_emf_converter.h" #include "printing/pdf_render_settings.h" #endif @@ -208,7 +208,7 @@ PrintedDocument* PrintJob::document() const { return document_.get(); } -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) class PrintJob::PdfConversionState { public: PdfConversionState(const gfx::Size& page_size, const gfx::Rect& content_area) @@ -338,7 +338,7 @@ void PrintJob::StartPdfToPostScriptConversion( pdf_conversion_state_->Start( bytes, settings, base::Bind(&PrintJob::OnPdfConversionStarted, this)); } -#endif // defined(OS_WIN) +#endif // OS_WIN && !defined(TOOLKIT_QT) void PrintJob::UpdatePrintedDocument(PrintedDocument* new_document) { if (document_.get() == new_document) @@ -388,7 +388,7 @@ void PrintJob::OnNotifyPrintJobEvent(const JobEventDetails& event_details) { break; } case JobEventDetails::PAGE_DONE: -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) if (pdf_conversion_state_) { pdf_conversion_state_->OnPageProcessed( base::Bind(&PrintJob::OnPdfPageConverted, this)); diff --git a/chromium/chrome/browser/printing/print_job.h b/chromium/chrome/browser/printing/print_job.h index 239456ba2ba..cf3fea147ac 100644 --- a/chromium/chrome/browser/printing/print_job.h +++ b/chromium/chrome/browser/printing/print_job.h @@ -86,7 +86,7 @@ class PrintJob : public PrintJobWorkerOwner, // Access the current printed document. Warning: may be NULL. PrintedDocument* document() const; -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) // Let the PrintJob know the 0-based |page_number| of a given printed page. void AppendPrintedPage(int page_number); @@ -105,7 +105,7 @@ class PrintJob : public PrintJobWorkerOwner, void StartPdfToTextConversion( const scoped_refptr<base::RefCountedMemory>& bytes, const gfx::Size& page_size); -#endif // defined(OS_WIN) +#endif // defined(OS_WIN) && !defined(TOOLKIT_QT) protected: ~PrintJob() override; @@ -130,7 +130,7 @@ class PrintJob : public PrintJobWorkerOwner, void HoldUntilStopIsCalled(); -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) void OnPdfConversionStarted(int page_count); void OnPdfPageConverted(int page_number, float scale_factor, @@ -157,11 +157,11 @@ class PrintJob : public PrintJobWorkerOwner, // the notified calls Cancel() again. bool is_canceling_; -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) class PdfConversionState; std::unique_ptr<PdfConversionState> pdf_conversion_state_; std::vector<int> pdf_page_mapping_; -#endif // defined(OS_WIN) +#endif // defined(OS_WIN) && !defined(TOOLKIT_QT) // Used at shutdown so that we can quit a nested run loop. base::WeakPtrFactory<PrintJob> quit_factory_; diff --git a/chromium/chrome/browser/printing/print_job_worker.cc b/chromium/chrome/browser/printing/print_job_worker.cc index 13434ba2f6c..b731295808e 100644 --- a/chromium/chrome/browser/printing/print_job_worker.cc +++ b/chromium/chrome/browser/printing/print_job_worker.cc @@ -18,7 +18,6 @@ #include "base/threading/thread_task_runner_handle.h" #include "base/values.h" #include "build/build_config.h" -#include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/printing/print_job.h" #include "chrome/grit/generated_resources.h" @@ -32,10 +31,20 @@ #include "printing/printing_utils.h" #include "ui/base/l10n/l10n_util.h" +#if !defined(TOOLKIT_QT) +#include "chrome/browser/browser_process.h" +#include "chrome/common/features.h" + #if defined(OS_ANDROID) #include "chrome/browser/android/tab_android.h" #endif +#else // !defined(TOOLKIT_QT) +namespace printing { +std::string getApplicationLocale(); +} +#endif + using content::BrowserThread; namespace printing { @@ -85,7 +94,11 @@ content::WebContents* PrintingContextDelegate::GetWebContents() { } std::string PrintingContextDelegate::GetAppLocale() { +#if defined(TOOLKIT_QT) + return getApplicationLocale(); +#else return g_browser_process->GetApplicationLocale(); +#endif // if defined(TOOLKIT_QT) } void NotificationCallback(PrintJobWorkerOwner* print_job, diff --git a/chromium/chrome/browser/profiles/profile.cc b/chromium/chrome/browser/profiles/profile.cc new file mode 100644 index 00000000000..0dbf66caaed --- /dev/null +++ b/chromium/chrome/browser/profiles/profile.cc @@ -0,0 +1,18 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/profiles/profile.h" + +#include "content/public/browser/web_contents.h" +#include "content/public/browser/web_ui.h" + +Profile* Profile::FromBrowserContext(content::BrowserContext* browser_context) { + // This is safe; this is the only implementation of the browser context. + return static_cast<Profile*>(browser_context); +} + +// static +Profile* Profile::FromWebUI(content::WebUI* web_ui) { + return FromBrowserContext(web_ui->GetWebContents()->GetBrowserContext()); +} diff --git a/chromium/chrome/browser/profiles/profile.h b/chromium/chrome/browser/profiles/profile.h new file mode 100644 index 00000000000..cc5c4005d9e --- /dev/null +++ b/chromium/chrome/browser/profiles/profile.h @@ -0,0 +1,37 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This a QtWebEngine specific stripped down replacement of Chromiums's Profile +// class, because it is used many places just for preference access. + +#ifndef CHROME_BROWSER_PROFILES_PROFILE_H_ +#define CHROME_BROWSER_PROFILES_PROFILE_H_ + +#include "content/public/browser/browser_context.h" + +class PrefService; + +namespace content { +class WebUI; +} + +class Profile : public content::BrowserContext { + public: + // Returns the profile corresponding to the given browser context. + static Profile* FromBrowserContext(content::BrowserContext* browser_context); + + // Returns the profile corresponding to the given WebUI. + static Profile* FromWebUI(content::WebUI* web_ui); + + // Retrieves a pointer to the PrefService that manages the + // preferences for this user profile. + virtual PrefService* GetPrefs() = 0; + virtual const PrefService* GetPrefs() const = 0; + + // Returns the main request context. + virtual net::URLRequestContextGetter* GetRequestContext() = 0; + +}; + +#endif // CHROME_BROWSER_PROFILES_PROFILE_H_ diff --git a/chromium/chrome/browser/resources/BUILD.gn b/chromium/chrome/browser/resources/BUILD.gn index b2d10f2a0ba..6d36bddb65e 100644 --- a/chromium/chrome/browser/resources/BUILD.gn +++ b/chromium/chrome/browser/resources/BUILD.gn @@ -7,6 +7,16 @@ import("//tools/grit/grit_rule.gni") assert(!is_ios, "Chromium/iOS shouldn't use anything in //chrome") +grit("qt_webengine_resources") { + source = "qt_webengine_resources.grd" + defines = chrome_grit_defines + outputs = [ + "grit/qt_webengine_resources.h", + "qt_webengine_resources.pak", + ] + output_dir = "$root_gen_dir/chrome" +} + grit("invalidations_resources") { source = "invalidations_resources.grd" defines = chrome_grit_defines diff --git a/chromium/chrome/browser/resources/qt_webengine_resources.grd b/chromium/chrome/browser/resources/qt_webengine_resources.grd new file mode 100644 index 00000000000..91c72b65d16 --- /dev/null +++ b/chromium/chrome/browser/resources/qt_webengine_resources.grd @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<grit latest_public_release="0" current_release="1" output_all_resource_defines="false"> + <outputs> + <output filename="grit/qt_webengine_resources.h" type="rc_header"> + <emit emit_type='prepend'></emit> + </output> + <output filename="qt_webengine_resources.pak" type="data_package" /> + </outputs> + <release seq="1"> + <includes> + <if expr="not is_ios"> + <include name="IDR_DEVTOOLS_DISCOVERY_PAGE_HTML" file="..\devtools\frontend\devtools_discovery_page.html" type="BINDATA"/> + </if> + <include name="IDR_USER_ACTIONS_HTML" file="user_actions\user_actions.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" /> + <include name="IDR_USER_ACTIONS_CSS" file="user_actions\user_actions.css" type="BINDATA" /> + <include name="IDR_USER_ACTIONS_JS" file="user_actions\user_actions.js" type="BINDATA" /> + <if expr="is_android or is_linux"> + <include name="IDR_SANDBOX_INTERNALS_HTML" file="sandbox_internals\sandbox_internals.html" flattenhtml="true" allowexternalscript="true" type="BINDATA" compress="gzip" /> + <include name="IDR_SANDBOX_INTERNALS_JS" file="sandbox_internals\sandbox_internals.js" type="BINDATA" compress="gzip" /> + </if> + </includes> + </release> +</grit> diff --git a/chromium/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc b/chromium/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc index e13aca7c190..b7ec88c0c17 100644 --- a/chromium/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc +++ b/chromium/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc @@ -19,12 +19,21 @@ #include "base/task_runner_util.h" #include "base/task_scheduler/post_task.h" #include "base/threading/thread_restrictions.h" +#ifndef TOOLKIT_QT #include "chrome/common/chrome_constants.h" +#endif #include "components/spellcheck/browser/spellcheck_host_metrics.h" #include "components/spellcheck/common/spellcheck_common.h" +#ifndef TOOLKIT_QT #include "components/sync/model/sync_change.h" #include "components/sync/model/sync_error_factory.h" #include "components/sync/protocol/sync.pb.h" +#else +#include "base/stl_util.h" +namespace chrome { + const base::FilePath::CharType kCustomDictionaryFileName[] = FILE_PATH_LITERAL("Custom Dictionary.txt"); +} +#endif #include "content/public/browser/browser_thread.h" using content::BrowserThread; @@ -235,7 +244,9 @@ bool SpellcheckCustomDictionary::AddWord(const std::string& word) { int result = dictionary_change->Sanitize(GetWords()); Apply(*dictionary_change); Notify(*dictionary_change); +#ifndef TOOLKIT_QT Sync(*dictionary_change); +#endif Save(std::move(dictionary_change)); return result == VALID_CHANGE; } @@ -247,7 +258,9 @@ bool SpellcheckCustomDictionary::RemoveWord(const std::string& word) { int result = dictionary_change->Sanitize(GetWords()); Apply(*dictionary_change); Notify(*dictionary_change); +#ifndef TOOLKIT_QT Sync(*dictionary_change); +#endif Save(std::move(dictionary_change)); return result == VALID_CHANGE; } @@ -273,10 +286,12 @@ bool SpellcheckCustomDictionary::IsLoaded() { return is_loaded_; } +#ifndef TOOLKIT_QT bool SpellcheckCustomDictionary::IsSyncing() { DCHECK_CURRENTLY_ON(BrowserThread::UI); return !!sync_processor_.get(); } +#endif void SpellcheckCustomDictionary::Load() { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -288,6 +303,7 @@ void SpellcheckCustomDictionary::Load() { weak_ptr_factory_.GetWeakPtr())); } +#ifndef TOOLKIT_QT syncer::SyncMergeResult SpellcheckCustomDictionary::MergeDataAndStartSyncing( syncer::ModelType type, const syncer::SyncDataList& initial_sync_data, @@ -382,6 +398,7 @@ syncer::SyncError SpellcheckCustomDictionary::ProcessSyncChanges( return syncer::SyncError(); } +#endif SpellcheckCustomDictionary::LoadFileResult::LoadFileResult() : is_valid_file(false) {} @@ -427,7 +444,9 @@ void SpellcheckCustomDictionary::OnLoaded( dictionary_change.AddWords(result->words); dictionary_change.Sanitize(GetWords()); Apply(dictionary_change); +#ifndef TOOLKIT_QT Sync(dictionary_change); +#endif is_loaded_ = true; for (Observer& observer : observers_) observer.OnCustomDictionaryLoaded(); @@ -472,6 +491,7 @@ void SpellcheckCustomDictionary::Save( custom_dictionary_path_)); } +#ifndef TOOLKIT_QT syncer::SyncError SpellcheckCustomDictionary::Sync( const Change& dictionary_change) { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -523,6 +543,7 @@ syncer::SyncError SpellcheckCustomDictionary::Sync( return error; } +#endif void SpellcheckCustomDictionary::Notify(const Change& dictionary_change) { DCHECK_CURRENTLY_ON(BrowserThread::UI); diff --git a/chromium/chrome/browser/spellchecker/spellcheck_custom_dictionary.h b/chromium/chrome/browser/spellchecker/spellcheck_custom_dictionary.h index 8cfac20eeda..12edd4aa021 100644 --- a/chromium/chrome/browser/spellchecker/spellcheck_custom_dictionary.h +++ b/chromium/chrome/browser/spellchecker/spellcheck_custom_dictionary.h @@ -17,10 +17,12 @@ #include "base/observer_list.h" #include "base/sequenced_task_runner.h" #include "components/spellcheck/browser/spellcheck_dictionary.h" +#ifndef TOOLKIT_QT #include "components/sync/model/sync_data.h" #include "components/sync/model/sync_error.h" #include "components/sync/model/sync_merge_result.h" #include "components/sync/model/syncable_service.h" +#endif namespace base { class Location; @@ -40,8 +42,13 @@ class SyncChangeProcessor; // foo // checksum_v1 = ec3df4034567e59e119fcf87f2d9bad4 // +#ifndef TOOLKIT_QT class SpellcheckCustomDictionary : public SpellcheckDictionary, public syncer::SyncableService { +#else +class SpellcheckCustomDictionary : public SpellcheckDictionary { +#endif + public: // A change to the dictionary. class Change { @@ -140,12 +147,15 @@ class SpellcheckCustomDictionary : public SpellcheckDictionary, // Returns true if the dictionary has been loaded. Otherwise returns false. bool IsLoaded(); +#ifndef TOOLKIT_QT // Returns true if the dictionary is being synced. Otherwise returns false. bool IsSyncing(); +#endif // Overridden from SpellcheckDictionary: void Load() override; +#ifndef TOOLKIT_QT // Overridden from syncer::SyncableService: syncer::SyncMergeResult MergeDataAndStartSyncing( syncer::ModelType type, @@ -157,6 +167,7 @@ class SpellcheckCustomDictionary : public SpellcheckDictionary, syncer::SyncError ProcessSyncChanges( const base::Location& from_here, const syncer::SyncChangeList& change_list) override; +#endif private: friend class DictionarySyncIntegrationTestHelper; @@ -189,10 +200,12 @@ class SpellcheckCustomDictionary : public SpellcheckDictionary, // |dictionary_change| to pass it to the FILE thread. void Save(std::unique_ptr<Change> dictionary_change); +#ifndef TOOLKIT_QT // Notifies the sync service of the |dictionary_change|. Syncs up to the // maximum syncable words on the server. Disables syncing of this dictionary // if the server contains the maximum number of syncable words. syncer::SyncError Sync(const Change& dictionary_change); +#endif // Notifies observers of the dictionary change if the dictionary has been // changed. @@ -210,11 +223,13 @@ class SpellcheckCustomDictionary : public SpellcheckDictionary, // Observers for dictionary load and content changes. base::ObserverList<Observer> observers_; +#ifndef TOOLKIT_QT // Used to send local changes to the sync infrastructure. std::unique_ptr<syncer::SyncChangeProcessor> sync_processor_; // Used to send sync-related errors to the sync infrastructure. std::unique_ptr<syncer::SyncErrorFactory> sync_error_handler_; +#endif // True if the dictionary has been loaded. Otherwise false. bool is_loaded_; diff --git a/chromium/chrome/browser/spellchecker/spellcheck_factory.cc b/chromium/chrome/browser/spellchecker/spellcheck_factory.cc index 9f9eb3bdd04..af2ab46bfc3 100644 --- a/chromium/chrome/browser/spellchecker/spellcheck_factory.cc +++ b/chromium/chrome/browser/spellchecker/spellcheck_factory.cc @@ -5,9 +5,13 @@ #include "chrome/browser/spellchecker/spellcheck_factory.h" #include "base/memory/ptr_util.h" +#ifndef TOOLKIT_QT #include "chrome/browser/profiles/incognito_helpers.h" +#endif #include "chrome/browser/spellchecker/spellcheck_service.h" +#ifndef TOOLKIT_QT #include "chrome/grit/locale_settings.h" +#endif #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/pref_service.h" @@ -73,9 +77,11 @@ void SpellcheckServiceFactory::RegisterProfilePrefs( base::MakeUnique<base::ListValue>()); // Continue registering kSpellCheckDictionary for preference migration. // TODO(estade): remove: crbug.com/751275 +#ifndef TOOLKIT_QT user_prefs->RegisterStringPref( spellcheck::prefs::kSpellCheckDictionary, l10n_util::GetStringUTF8(IDS_SPELLCHECK_DICTIONARY)); +#endif user_prefs->RegisterBooleanPref( spellcheck::prefs::kSpellCheckUseSpellingService, false); #if defined(OS_ANDROID) @@ -89,7 +95,11 @@ void SpellcheckServiceFactory::RegisterProfilePrefs( content::BrowserContext* SpellcheckServiceFactory::GetBrowserContextToUse( content::BrowserContext* context) const { +#ifndef TOOLKIT_QT return chrome::GetBrowserContextRedirectedInIncognito(context); +#else + return context; +#endif } bool SpellcheckServiceFactory::ServiceIsNULLWhileTesting() const { diff --git a/chromium/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc b/chromium/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc index b6ebae0b7aa..a115023dc3a 100644 --- a/chromium/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc +++ b/chromium/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc @@ -19,8 +19,10 @@ #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" #include "chrome/browser/spellchecker/spellcheck_service.h" +#ifndef TOOLKIT_QT #include "chrome/common/chrome_paths.h" #include "components/data_use_measurement/core/data_use_user_data.h" +#endif #include "components/spellcheck/browser/spellcheck_platform.h" #include "components/spellcheck/common/spellcheck_common.h" #include "components/spellcheck/spellcheck_build_features.h" @@ -59,7 +61,7 @@ bool SaveDictionaryData(std::unique_ptr<std::string> data, bool success = false; #if defined(OS_WIN) base::FilePath dict_dir; - PathService::Get(chrome::DIR_USER_DATA, &dict_dir); + PathService::Get(base::DIR_USER_DATA, &dict_dir); base::FilePath fallback_file_path = dict_dir.Append(path.BaseName()); bytes_written = @@ -277,8 +279,10 @@ void SpellcheckHunspellDictionary::DownloadDictionary(GURL url) { fetcher_ = net::URLFetcher::Create(url, net::URLFetcher::GET, this, traffic_annotation); +#ifndef TOOLKIT_QT data_use_measurement::DataUseUserData::AttachToFetcher( fetcher_.get(), data_use_measurement::DataUseUserData::SPELL_CHECKER); +#endif fetcher_->SetRequestContext(request_context_getter_); fetcher_->SetLoadFlags( net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES); @@ -305,7 +309,7 @@ SpellcheckHunspellDictionary::OpenDictionaryFile(const base::FilePath& path) { // Check if the dictionary exists in the fallback location. If so, use it // rather than downloading anew. base::FilePath user_dir; - PathService::Get(chrome::DIR_USER_DATA, &user_dir); + PathService::Get(base::DIR_USER_DATA, &user_dir); base::FilePath fallback = user_dir.Append(path.BaseName()); if (!base::PathExists(path) && base::PathExists(fallback)) dictionary.path = fallback; @@ -334,14 +338,16 @@ SpellcheckHunspellDictionary::OpenDictionaryFile(const base::FilePath& path) { dictionary.file.Initialize(dictionary.path, base::File::FLAG_READ | base::File::FLAG_OPEN); } else { +#ifndef TOOLKIT_QT base::DeleteFile(dictionary.path, false); +#endif } return dictionary; } // The default place where the spellcheck dictionary resides is -// chrome::DIR_APP_DICTIONARIES. +// base::DIR_APP_DICTIONARIES. // // static SpellcheckHunspellDictionary::DictionaryFile @@ -353,7 +359,7 @@ SpellcheckHunspellDictionary::InitializeDictionaryLocation( // sequence because it checks if there is a "Dictionaries" directory and // create it. base::FilePath dict_dir; - PathService::Get(chrome::DIR_APP_DICTIONARIES, &dict_dir); + PathService::Get(base::DIR_APP_DICTIONARIES, &dict_dir); base::FilePath dict_path = spellcheck::GetVersionedFileName(language, dict_dir); @@ -364,7 +370,7 @@ void SpellcheckHunspellDictionary::InitializeDictionaryLocationComplete( DictionaryFile file) { DCHECK_CURRENTLY_ON(BrowserThread::UI); dictionary_file_ = std::move(file); - +#ifndef TOOLKIT_QT if (!dictionary_file_.file.IsValid()) { // Notify browser tests that this dictionary is corrupted. Skip downloading // the dictionary in browser tests. @@ -383,6 +389,13 @@ void SpellcheckHunspellDictionary::InitializeDictionaryLocationComplete( } InformListenersOfInitialization(); +#else + if (!dictionary_file_.file.IsValid()) + // We never download, so safe to reuse this handler + InformListenersOfDownloadFailure(); + else + InformListenersOfInitialization(); +#endif } void SpellcheckHunspellDictionary::SaveDictionaryDataComplete( diff --git a/chromium/chrome/browser/spellchecker/spellcheck_service.cc b/chromium/chrome/browser/spellchecker/spellcheck_service.cc index ff8cbf3c4ec..ce412e5230d 100644 --- a/chromium/chrome/browser/spellchecker/spellcheck_service.cc +++ b/chromium/chrome/browser/spellchecker/spellcheck_service.cc @@ -288,6 +288,10 @@ void SpellcheckService::OnHunspellDictionaryDownloadSuccess( void SpellcheckService::OnHunspellDictionaryDownloadFailure( const std::string& language) { +#ifdef TOOLKIT_QT + DCHECK_CURRENTLY_ON(BrowserThread::UI); + context_->FailedToLoadDictionary(language); +#endif } // static diff --git a/chromium/chrome/browser/ui/BUILD.gn b/chromium/chrome/browser/ui/BUILD.gn index 82f43b9591a..1a792efbc47 100644 --- a/chromium/chrome/browser/ui/BUILD.gn +++ b/chromium/chrome/browser/ui/BUILD.gn @@ -2561,7 +2561,7 @@ split_static_library("ui") { "views/frame/native_browser_frame_factory_ozone.cc", ] } else { - if (use_aura) { + if (use_aura && use_gtk) { # This is the only component that can interact with gtk. deps += [ "//chrome/browser/ui/libgtkui" ] } @@ -3111,7 +3111,7 @@ split_static_library("ui") { # # TODO(tonikitoo): It seems sensible to make it possible to opt-in # the use of these files in case Gtk is available with its Wayland. - if (!use_ozone && is_desktop_linux) { + if (use_gtk) { sources += [ "views/chrome_browser_main_extra_parts_views_linux.cc", "views/chrome_browser_main_extra_parts_views_linux.h", @@ -3649,10 +3649,14 @@ static_library("test_support") { "test/test_confirm_bubble_model.cc", "test/test_confirm_bubble_model.h", ] + deps += [ - "//chrome/test:test_support_ui", "//components/zoom", ] + + if (toolkit_views) { + deps += [ "//chrome/test:test_support_ui" ] + } } if (is_chromeos) { diff --git a/chromium/chrome/browser/ui/webui/devtools_ui.cc b/chromium/chrome/browser/ui/webui/devtools_ui.cc index 54c2a5d5ba9..8d2e6afa3f3 100644 --- a/chromium/chrome/browser/ui/webui/devtools_ui.cc +++ b/chromium/chrome/browser/ui/webui/devtools_ui.cc @@ -227,6 +227,7 @@ void DevToolsDataSource::StartBundledDataRequest( void DevToolsDataSource::StartRemoteDataRequest( const std::string& path, const content::URLDataSource::GotDataCallback& callback) { +#ifndef TOOLKIT_QT GURL url = GURL(kRemoteFrontendBase + path); CHECK_EQ(url.host(), kRemoteFrontendDomain); if (!url.is_valid()) { @@ -263,6 +264,10 @@ void DevToolsDataSource::StartRemoteDataRequest( pending_[fetcher] = callback; fetcher->SetRequestContext(request_context_.get()); fetcher->Start(); +#else + callback.Run( + new base::RefCountedStaticMemory(kHttpNotFound, strlen(kHttpNotFound))); +#endif } void DevToolsDataSource::StartCustomDataRequest( @@ -327,6 +332,7 @@ void DevToolsDataSource::OnURLFetchComplete(const net::URLFetcher* source) { // static GURL DevToolsUI::GetProxyURL(const std::string& frontend_url) { +#ifndef TOOLKIT_QT GURL url(frontend_url); if (url.scheme() == content::kChromeDevToolsScheme && url.host() == chrome::kChromeUIDevToolsHost) @@ -338,19 +344,30 @@ GURL DevToolsUI::GetProxyURL(const std::string& frontend_url) { chrome::kChromeUIDevToolsHost, chrome::kChromeUIDevToolsRemotePath, url.path().substr(1).c_str())); +#else + return GURL(); +#endif } // static GURL DevToolsUI::GetRemoteBaseURL() { +#ifndef TOOLKIT_QT return GURL(base::StringPrintf( "%s%s/%s/", kRemoteFrontendBase, kRemoteFrontendPath, content::GetWebKitRevision().c_str())); +#else + return GURL(); +#endif } DevToolsUI::DevToolsUI(content::WebUI* web_ui) - : WebUIController(web_ui), bindings_(web_ui->GetWebContents()) { + : WebUIController(web_ui) +#ifndef TOOLKIT_QT + , bindings_(web_ui->GetWebContents()) +#endif +{ web_ui->SetBindings(0); Profile* profile = Profile::FromWebUI(web_ui); content::URLDataSource::Add( diff --git a/chromium/chrome/browser/ui/webui/devtools_ui.h b/chromium/chrome/browser/ui/webui/devtools_ui.h index 809e4e4f1a2..39f0356fde1 100644 --- a/chromium/chrome/browser/ui/webui/devtools_ui.h +++ b/chromium/chrome/browser/ui/webui/devtools_ui.h @@ -6,7 +6,10 @@ #define CHROME_BROWSER_UI_WEBUI_DEVTOOLS_UI_H_ #include "base/macros.h" +#include "base/values.h" +#ifndef TOOLKIT_QT #include "chrome/browser/devtools/devtools_ui_bindings.h" +#endif #include "content/public/browser/web_ui_controller.h" class DevToolsUI : public content::WebUIController { @@ -18,7 +21,9 @@ class DevToolsUI : public content::WebUIController { ~DevToolsUI() override; private: +#ifndef TOOLKIT_QT DevToolsUIBindings bindings_; +#endif DISALLOW_COPY_AND_ASSIGN(DevToolsUI); }; diff --git a/chromium/chrome/browser/ui/webui/sandbox_internals_ui.cc b/chromium/chrome/browser/ui/webui/sandbox_internals_ui.cc index 5c1991dcab3..159b30d24d4 100644 --- a/chromium/chrome/browser/ui/webui/sandbox_internals_ui.cc +++ b/chromium/chrome/browser/ui/webui/sandbox_internals_ui.cc @@ -7,14 +7,22 @@ #include <string> #include "chrome/browser/profiles/profile.h" -#include "chrome/common/render_messages.h" #include "chrome/common/url_constants.h" -#include "chrome/grit/browser_resources.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_data_source.h" +#if defined(TOOLKIT_QT) +#include "chrome/grit/qt_webengine_resources.h" +#else +#include "chrome/grit/browser_resources.h" +#endif + +#if defined(OS_ANDROID) +#include "chrome/common/render_messages.h" +#endif + #if defined(OS_LINUX) #include "content/public/browser/zygote_host_linux.h" #include "content/public/common/sandbox_linux.h" diff --git a/chromium/chrome/browser/ui/webui/user_actions/user_actions_ui.cc b/chromium/chrome/browser/ui/webui/user_actions/user_actions_ui.cc index d12ecffc156..85ad8eb42fb 100644 --- a/chromium/chrome/browser/ui/webui/user_actions/user_actions_ui.cc +++ b/chromium/chrome/browser/ui/webui/user_actions/user_actions_ui.cc @@ -8,11 +8,17 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/user_actions/user_actions_ui_handler.h" #include "chrome/common/url_constants.h" -#include "chrome/grit/browser_resources.h" #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_controller.h" #include "content/public/browser/web_ui_data_source.h" +#if defined(TOOLKIT_QT) +#include "chrome/grit/qt_webengine_resources.h" +#else +#include "chrome/grit/browser_resources.h" +#endif + + UserActionsUI::UserActionsUI(content::WebUI* web_ui) : content::WebUIController(web_ui) { // Set up the chrome://user-actions/ source. diff --git a/chromium/chrome/chrome_paks.gni b/chromium/chrome/chrome_paks.gni index 91dc01d5ca6..1cae0e03157 100644 --- a/chromium/chrome/chrome_paks.gni +++ b/chromium/chrome/chrome_paks.gni @@ -146,6 +146,15 @@ template("chrome_extra_paks") { "//headless:resources", ] } + if (use_qt) { + sources -= [ + "$root_gen_dir/content/browser/tracing/tracing_resources.pak", + ] + deps -= [ + "//content/browser/tracing:resources", + ] + } + if (is_chromeos) { sources += [ "$root_gen_dir/components/chrome_apps/chrome_apps_resources.pak", diff --git a/chromium/chrome/common/pref_names.cc b/chromium/chrome/common/pref_names.cc new file mode 100644 index 00000000000..9ec3446d6eb --- /dev/null +++ b/chromium/chrome/common/pref_names.cc @@ -0,0 +1,9 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/common/pref_names.h" + +namespace prefs { +const char kAcceptLanguages[] = "intl.accept_languages"; +} // namespace prefs diff --git a/chromium/chrome/common/pref_names.h b/chromium/chrome/common/pref_names.h new file mode 100644 index 00000000000..2d9e40d61f6 --- /dev/null +++ b/chromium/chrome/common/pref_names.h @@ -0,0 +1,14 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Constants for the names of various preferences, for easier changing. + +#ifndef CHROME_COMMON_PREF_NAMES_H_ +#define CHROME_COMMON_PREF_NAMES_H_ + +namespace prefs { +extern const char kAcceptLanguages[]; +} // namespace prefs + +#endif // CHROME_COMMON_PREF_NAMES_H_ diff --git a/chromium/chrome/common/url_constants.cc b/chromium/chrome/common/url_constants.cc index 3a27bec4783..f55502853fe 100644 --- a/chromium/chrome/common/url_constants.cc +++ b/chromium/chrome/common/url_constants.cc @@ -10,7 +10,9 @@ #include "build/build_config.h" #include "chrome/common/features.h" #include "components/nacl/common/features.h" +#if !defined(TOOLKIT_QT) #include "components/safe_browsing/web_ui/constants.h" +#endif #include "content/public/common/url_constants.h" #include "extensions/features/features.h" #include "media/media_features.h" @@ -681,7 +683,9 @@ const char* const kChromeHostURLs[] = { kChromeUISignInInternalsHost, kChromeUISiteEngagementHost, kChromeUINTPTilesInternalsHost, +#if !defined(TOOLKIT_QT) safe_browsing::kChromeUISafeBrowsingHost, +#endif kChromeUISuggestionsHost, kChromeUISupervisedUserInternalsHost, kChromeUISyncInternalsHost, diff --git a/chromium/chrome/test/BUILD.gn b/chromium/chrome/test/BUILD.gn index d349a6e3378..1c77c910a5d 100644 --- a/chromium/chrome/test/BUILD.gn +++ b/chromium/chrome/test/BUILD.gn @@ -261,44 +261,6 @@ static_library("test_support") { } } -group("telemetry_gpu_integration_test") { - testonly = true - deps = [ - "//tools/perf/chrome_telemetry_build:telemetry_chrome_test", - ] - - data = [ - # For isolate contract. - "//testing/scripts/common.py", - "//testing/xvfb.py", - "//testing/scripts/run_gpu_integration_test_as_googletest.py", - - "//content/test/gpu/", - "//content/test/data/gpu/", - - # For the Maps WPR archive SHA. Include the entire directory to - # avoid having to update this BUILD.gn file if the WPR is - # re-recorded. - "//tools/perf/page_sets/data/", - - # For depth_capture - "//content/test/data/media/depth_stream_test_utilities.js", - "//content/test/data/media/getusermedia-depth-capture.html", - "//content/test/data/media/webrtc_test_utilities.js", - - # For GpuProcess.video - "//content/test/data/media/bear.ogv", - - # For webgl_conformance - "//third_party/webgl/", - "//content/test/gpu/run_gpu_integration_test.py", - - # For pixel_test - "//media/test/data/bear.mp4", - "//media/test/data/bear-vp9.webm", - ] -} - if (!is_android) { static_library("test_support_ui") { defines = [] @@ -658,7 +620,7 @@ if (!is_android) { # suites, it seems like one or another starts timing out too. "../browser/ui/views/keyboard_access_browsertest.cc", ] - if (!use_ozone) { + if (use_gtk) { sources += [ "../browser/ui/libgtkui/select_file_dialog_interactive_uitest.cc" ] deps += [ "//build/config/linux/gtk" ] } @@ -999,64 +961,6 @@ if (!is_android && !is_fuchsia) { ] } } - - group("telemetry_unittests") { - testonly = true - deps = [ - "//tools/perf/chrome_telemetry_build:telemetry_chrome_test", - ] - - data = [ - "//tools/perf/run_telemetry_tests", - - # For isolate contract. - "//testing/scripts/common.py", - "//testing/xvfb.py", - "//testing/scripts/run_telemetry_as_googletest.py", - ] - - if (enable_package_mash_services) { - deps += [ "//chrome:chrome_test" ] - data_deps = [ - "//chrome:chrome_test", - ] - } - } - - group("telemetry_gpu_unittests_run") { - testonly = true - deps = [ - ":telemetry_gpu_unittests", - ] - } - - group("telemetry_gpu_unittests") { - deps = [ - "//third_party/catapult/telemetry:telemetry_test_support", - ] - data = [ - # TODO(kbr): refactor the telemetry dependencies more cleanly. - "//content/test/gpu/", - "//content/test/data/gpu/", - - # For GpuProcess.video - "//content/test/data/media/bear.ogv", - - # For webgl_conformance_expectations_unittest - "//third_party/webgl/src/sdk/tests/", - - # For resolve the imports in content/test/gpu/run_gpu_test.py - "//tools/perf/core/", - "//tools/perf/chrome_telemetry_build/", - - # From telemetry_gpu_unittests.isolate - "//third_party/pylint/", - "//third_party/logilab/", - "//testing/scripts/common.py", - "//testing/xvfb.py", - "//testing/scripts/run_telemetry_as_googletest.py", - ] - } } static_library("browser_tests_runner") { @@ -1678,12 +1582,16 @@ test("browser_tests") { data_deps += [ "//ppapi:ppapi_tests", "//ppapi:power_saver_test_plugin", - "//remoting/webapp:browser_test_resources", - "//remoting/webapp:unit_tests", "//third_party/mesa:osmesa", "//third_party/widevine/cdm:widevine_test_license_server", ] + if (enable_remoting) { + data_deps += [ + "//remoting/webapp:browser_test_resources", + "//remoting/webapp:unit_tests", + ] + } data += [ "data/", "//chrome/browser/policy/test/asn1der.py", @@ -4366,7 +4274,7 @@ test("unit_tests") { if (use_gio) { deps += [ "//build/linux/libgio" ] } - if (!is_chromeos && !use_ozone && is_linux) { + if (!is_chromeos && !use_ozone && is_linux && use_gtk) { deps += [ "//chrome/browser/ui/libgtkui" ] } diff --git a/chromium/chrome/tools/convert_dict/BUILD.gn b/chromium/chrome/tools/convert_dict/BUILD.gn index 573baaec561..d210e2b7607 100644 --- a/chromium/chrome/tools/convert_dict/BUILD.gn +++ b/chromium/chrome/tools/convert_dict/BUILD.gn @@ -2,9 +2,14 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/features.gni") + source_set("lib") { - # Production code shouldn't be depending on this. - testonly = true + + if (!use_qt) { + # Production code shouldn't be depending on this. + testonly = true + } sources = [ "aff_reader.cc", @@ -21,20 +26,38 @@ source_set("lib") { ] } -executable("convert_dict") { - # Production code shouldn't be depending on this. - testonly = true +if (use_qt) { + shared_library("convert_dict") { + create_pri_file = true + configs += [ "//build/config/compiler:wexit_time_destructors" ] + deps = [ + ":lib", + "//base", + "//base:i18n", + "//build/config:exe_and_shlib_deps", + "//third_party/hunspell", + ] + } +} else { - sources = [ - "convert_dict.cc", - ] - configs += [ "//build/config/compiler:wexit_time_destructors" ] - deps = [ - ":lib", - "//base", - "//base:i18n", - "//build/config:exe_and_shlib_deps", - "//build/win:default_exe_manifest", - "//third_party/hunspell", - ] + executable("convert_dict") { + # Production code shouldn't be depending on this. + testonly = true + + + + sources = [ + "convert_dict.cc", + ] + + configs += [ "//build/config/compiler:wexit_time_destructors" ] + deps = [ + ":lib", + "//base", + "//base:i18n", + "//build/config:exe_and_shlib_deps", + "//build/win:default_exe_manifest", + "//third_party/hunspell", + ] + } } diff --git a/chromium/components/error_page/common/localized_error.cc b/chromium/components/error_page/common/localized_error.cc index 771de2800c8..7a27e2abab5 100644 --- a/chromium/components/error_page/common/localized_error.cc +++ b/chromium/components/error_page/common/localized_error.cc @@ -41,6 +41,10 @@ #include "components/offline_pages/core/offline_page_feature.h" #endif +#if !defined(TOOLKIT_QT) +#include "components/strings/grit/components_google_chrome_strings.h" +#endif + namespace error_page { namespace { diff --git a/chromium/components/printing/renderer/print_render_frame_helper.cc b/chromium/components/printing/renderer/print_render_frame_helper.cc index c6b03ed6ad9..3b270ad7402 100644 --- a/chromium/components/printing/renderer/print_render_frame_helper.cc +++ b/chromium/components/printing/renderer/print_render_frame_helper.cc @@ -88,7 +88,7 @@ const double kMinDpi = 1.0; // Also set in third_party/WebKit/Source/core/page/PrintContext.h const float kPrintingMinimumShrinkFactor = 1.33333333f; -#if BUILDFLAG(ENABLE_PRINT_PREVIEW) +#if BUILDFLAG(ENABLE_PRINT_PREVIEW) && !defined(TOOLKIT_QT) bool g_is_preview_enabled = true; #else bool g_is_preview_enabled = false; @@ -574,6 +574,7 @@ void PrintRenderFrameHelper::PrintHeaderAndFooter( float webkit_scale_factor, const PageSizeMargins& page_layout, const PrintMsg_Print_Params& params) { +#if !defined(TOOLKIT_QT) cc::PaintCanvasAutoRestore auto_restore(canvas, true); canvas->scale(1 / webkit_scale_factor, 1 / webkit_scale_factor); @@ -634,6 +635,7 @@ void PrintRenderFrameHelper::PrintHeaderAndFooter( frame->PrintEnd(); web_view->Close(); +#endif // !defined(TOOLKIT_QT) } // static - Not anonymous so that platform implementations can use it. diff --git a/chromium/components/resources/BUILD.gn b/chromium/components/resources/BUILD.gn index af21090adf5..b5d2234d41a 100644 --- a/chromium/components/resources/BUILD.gn +++ b/chromium/components/resources/BUILD.gn @@ -36,9 +36,9 @@ grit("components_resources") { "enable_print_preview=$enable_print_preview", ] - deps = [ - ":compressed_about_credits", - ] +# deps = [ +# ":compressed_about_credits", +# ] } grit("components_scaled_resources") { diff --git a/chromium/components/resources/components_resources.grd b/chromium/components/resources/components_resources.grd index 1dea8d0d02e..ad56e2b6335 100644 --- a/chromium/components/resources/components_resources.grd +++ b/chromium/components/resources/components_resources.grd @@ -8,24 +8,24 @@ </outputs> <release seq="1"> <includes> - <part file="about_ui_resources.grdp" /> - <part file="crash_resources.grdp" /> - <part file="dom_distiller_resources.grdp" /> +<!-- <part file="about_ui_resources.grdp" /> --> +<!-- <part file="crash_resources.grdp" /> --> +<!-- <part file="dom_distiller_resources.grdp" /> --> <part file="flags_ui_resources.grdp" /> - <part file="gcm_driver_resources.grdp" /> +<!-- <part file="gcm_driver_resources.grdp" /> --> <part file="net_log_resources.grdp" /> <part file="neterror_resources.grdp" /> <part file="ntp_tiles_resources.grdp" /> <part file="offline_pages_resources.grdp" /> <part file="physical_web_ui_resources.grdp" /> <part file="printing_resources.grdp" /> - <part file="proximity_auth_resources.grdp" /> - <part file="safe_browsing_resources.grdp" /> +<!-- <part file="proximity_auth_resources.grdp" /> --> +<!-- <part file="safe_browsing_resources.grdp" /> --> <part file="security_interstitials_resources.grdp" /> - <part file="signin_resources.grdp" /> +<!-- <part file="signin_resources.grdp" /> --> <part file="supervised_user_error_page_resources.grdp" /> - <part file="sync_driver_resources.grdp" /> - <part file="translate_resources.grdp" /> +<!-- <part file="sync_driver_resources.grdp" /> --> +<!-- <part file="translate_resources.grdp" /> --> <part file="version_ui_resources.grdp" /> </includes> </release> diff --git a/chromium/components/spellcheck/browser/BUILD.gn b/chromium/components/spellcheck/browser/BUILD.gn index b8069c146ce..0c6727beaa0 100644 --- a/chromium/components/spellcheck/browser/BUILD.gn +++ b/chromium/components/spellcheck/browser/BUILD.gn @@ -5,6 +5,7 @@ if (is_android) { import("//build/config/android/rules.gni") } +import("//build/config/features.gni") source_set("browser") { sources = [ @@ -38,6 +39,11 @@ source_set("browser") { "//google_apis", "//net", ] + if (use_qt) { + deps -= [ + "//components/data_use_measurement/core", + ] + } if (is_android) { deps += [ "android:jni_headers" ] diff --git a/chromium/components/spellcheck/browser/spelling_service_client.cc b/chromium/components/spellcheck/browser/spelling_service_client.cc index 3fed159e673..d8371cc1478 100644 --- a/chromium/components/spellcheck/browser/spelling_service_client.cc +++ b/chromium/components/spellcheck/browser/spelling_service_client.cc @@ -17,7 +17,9 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" +#ifndef TOOLKIT_QT #include "components/data_use_measurement/core/data_use_user_data.h" +#endif #include "components/prefs/pref_service.h" #include "components/spellcheck/browser/pref_names.h" #include "components/spellcheck/common/spellcheck_common.h" @@ -101,6 +103,7 @@ bool SpellingServiceClient::RequestTextCheck( kSpellingRequest, type, encoded_text.c_str(), language_code.c_str(), country_code.c_str(), api_key.c_str()); +#ifndef TOOLKIT_QT GURL url = GURL(kSpellingServiceURL); // Create traffic annotation tag. @@ -150,6 +153,7 @@ bool SpellingServiceClient::RequestTextCheck( spellcheck_fetchers_[fetcher] = base::MakeUnique<TextCheckCallbackData>( base::WrapUnique(fetcher), callback, text); fetcher->Start(); +#endif return true; } diff --git a/chromium/components/spellcheck/common/spellcheck_common.cc b/chromium/components/spellcheck/common/spellcheck_common.cc index c3b817e4086..9fd81c407d6 100644 --- a/chromium/components/spellcheck/common/spellcheck_common.cc +++ b/chromium/components/spellcheck/common/spellcheck_common.cc @@ -101,6 +101,7 @@ std::string GetSpellCheckLanguageRegion(const std::string& input_language) { base::FilePath GetVersionedFileName(const std::string& input_language, const base::FilePath& dict_dir) { +#if !defined(TOOLKIT_QT) // The default dictionary version is 3-0. This version indicates that the bdic // file contains a checksum. static const char kDefaultVersionString[] = "-3-0"; @@ -135,7 +136,9 @@ base::FilePath GetVersionedFileName(const std::string& input_language, break; } } - +#else + std::string versioned_bdict_file_name(input_language + ".bdic"); +#endif return dict_dir.AppendASCII(versioned_bdict_file_name); } diff --git a/chromium/components/spellcheck/spellcheck_build_features.gni b/chromium/components/spellcheck/spellcheck_build_features.gni index 34a27d7449c..7ecbb70a134 100644 --- a/chromium/components/spellcheck/spellcheck_build_features.gni +++ b/chromium/components/spellcheck/spellcheck_build_features.gni @@ -2,13 +2,15 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# Enable the spell checker. -enable_spellcheck = !is_ios +declare_args() { + # Enable the spell checker. + enable_spellcheck = !is_ios -# Use the operating system's spellchecker rather than hunspell. This does -# not affect the "red underline" spellchecker which can consult Google's -# server-based spellcheck service. -use_browser_spellchecker = is_android || is_mac + # Use the operating system's spellchecker rather than hunspell. This does + # not affect the "red underline" spellchecker which can consult Google's + # server-based spellcheck service. + use_browser_spellchecker = is_android || is_mac +} # Only Mac has a spellcheck panel. has_spellcheck_panel = is_mac diff --git a/chromium/components/viz/common/quads/draw_quad.h b/chromium/components/viz/common/quads/draw_quad.h index 4cbe49f365d..5d62a5b4629 100644 --- a/chromium/components/viz/common/quads/draw_quad.h +++ b/chromium/components/viz/common/quads/draw_quad.h @@ -73,7 +73,12 @@ class VIZ_COMMON_EXPORT DrawQuad { bool IsDebugQuad() const { return material == DEBUG_BORDER; } bool ShouldDrawWithBlending() const { - return needs_blending || shared_quad_state->opacity < 1.0f; + return (needs_blending +#if !defined(TOOLKIT_QT) +// Qt handles this case through QSGOpacityNodes + || shared_quad_state->opacity < 1.0f +#endif + ); } // Is the left edge of this tile aligned with the originating layer's diff --git a/chromium/components/viz/service/display/software_renderer.cc b/chromium/components/viz/service/display/software_renderer.cc index 93100612146..60418792871 100644 --- a/chromium/components/viz/service/display/software_renderer.cc +++ b/chromium/components/viz/service/display/software_renderer.cc @@ -23,6 +23,7 @@ #include "components/viz/service/display/software_output_device.h" #include "skia/ext/image_operations.h" #include "skia/ext/opacity_filter_canvas.h" +#include "third_party/khronos/GLES2/gl2.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColorSpaceXformCanvas.h" diff --git a/chromium/content/app/content_main_runner.cc b/chromium/content/app/content_main_runner.cc index d2275a49982..e43b5375dda 100644 --- a/chromium/content/app/content_main_runner.cc +++ b/chromium/content/app/content_main_runner.cc @@ -478,7 +478,7 @@ class ContentMainRunnerImpl : public ContentMainRunner { sandbox_info_ = *params.sandbox_info; #else // !OS_WIN -#if defined(OS_MACOSX) +#if defined(OS_MACOSX) && !defined(TOOLKIT_QT) autorelease_pool_ = params.autorelease_pool; #endif // defined(OS_MACOSX) @@ -699,7 +699,7 @@ class ContentMainRunnerImpl : public ContentMainRunner { main_params.ui_task = ui_task_; #if defined(OS_WIN) main_params.sandbox_info = &sandbox_info_; -#elif defined(OS_MACOSX) +#elif defined(OS_MACOSX) && !defined(TOOLKIT_QT) main_params.autorelease_pool = autorelease_pool_; #endif #if defined(USE_AURA) @@ -754,7 +754,7 @@ class ContentMainRunnerImpl : public ContentMainRunner { std::unique_ptr<base::AtExitManager> exit_manager_; #if defined(OS_WIN) sandbox::SandboxInterfaceInfo sandbox_info_; -#elif defined(OS_MACOSX) +#elif defined(OS_MACOSX) && !defined(TOOLKIT_QT) base::mac::ScopedNSAutoreleasePool* autorelease_pool_ = nullptr; #endif diff --git a/chromium/content/browser/BUILD.gn b/chromium/content/browser/BUILD.gn index 0b4fc175768..ce5d712da7f 100644 --- a/chromium/content/browser/BUILD.gn +++ b/chromium/content/browser/BUILD.gn @@ -12,6 +12,7 @@ import("//ppapi/features/features.gni") import("//printing/features/features.gni") import("//third_party/WebKit/public/public_features.gni") import("//tools/ipc_fuzzer/ipc_fuzzer.gni") +import("//ui/gl/ui_gl.gni") source_set("browser") { # Only the public target should depend on this. All other targets (even @@ -1585,8 +1586,6 @@ source_set("browser") { "utility_process_host_impl.h", "wake_lock/wake_lock_context_host.cc", "wake_lock/wake_lock_context_host.h", - "web_contents/aura/gesture_nav_simple.cc", - "web_contents/aura/gesture_nav_simple.h", "web_contents/aura/overscroll_navigation_overlay.cc", "web_contents/aura/overscroll_navigation_overlay.h", "web_contents/aura/overscroll_window_animation.cc", @@ -1700,7 +1699,7 @@ source_set("browser") { if (!is_mac) { deps += [ "//sandbox" ] } - if (!is_android) { + if (!is_android && !use_qt) { deps += [ "//components/vector_icons", "//content/browser/tracing:resources", @@ -2082,26 +2081,7 @@ source_set("browser") { "host_zoom_map_impl.h", "host_zoom_map_observer.cc", "host_zoom_map_observer.h", - - # Most speech code is non-Android. - "speech/audio_buffer.cc", - "speech/audio_buffer.h", - "speech/audio_encoder.cc", - "speech/audio_encoder.h", - "speech/chunked_byte_buffer.cc", - "speech/chunked_byte_buffer.h", - "speech/endpointer/endpointer.cc", - "speech/endpointer/endpointer.h", - "speech/endpointer/energy_endpointer.cc", - "speech/endpointer/energy_endpointer.h", - "speech/endpointer/energy_endpointer_params.cc", - "speech/endpointer/energy_endpointer_params.h", - "speech/speech_recognition_engine.cc", - "speech/speech_recognition_engine.h", - "speech/speech_recognizer_impl.cc", - "speech/speech_recognizer_impl.h", ] - deps += [ "//third_party/flac" ] } if (is_mac) { @@ -2124,7 +2104,7 @@ source_set("browser") { ] } - if (use_aura) { + if (use_aura && !use_qt) { deps += [ "//services/ui/public/cpp", "//services/ui/public/interfaces", @@ -2139,8 +2119,10 @@ source_set("browser") { "renderer_host/delegated_frame_host_client_aura.h", "renderer_host/render_widget_host_view_event_handler.cc", "renderer_host/render_widget_host_view_event_handler.h", + "web_contents/aura/gesture_nav_simple.cc", + "web_contents/aura/gesture_nav_simple.h", ] - } else { # Not aura. + } else if (!use_aura) { # Not aura. sources -= [ "renderer_host/input/synthetic_gesture_target_aura.cc", "renderer_host/input/synthetic_gesture_target_aura.h", @@ -2149,8 +2131,6 @@ source_set("browser") { "renderer_host/native_web_keyboard_event_aura.cc", "renderer_host/render_widget_host_view_aura.cc", "renderer_host/render_widget_host_view_aura.h", - "web_contents/aura/gesture_nav_simple.cc", - "web_contents/aura/gesture_nav_simple.h", "web_contents/aura/overscroll_navigation_overlay.cc", "web_contents/aura/overscroll_navigation_overlay.h", "web_contents/aura/overscroll_window_animation.cc", @@ -2231,6 +2211,40 @@ source_set("browser") { ] } + if (enable_web_speech) { + sources += [ + # Most speech code is non-Android. + "speech/audio_buffer.cc", + "speech/audio_buffer.h", + "speech/audio_encoder.cc", + "speech/audio_encoder.h", + "speech/chunked_byte_buffer.cc", + "speech/chunked_byte_buffer.h", + "speech/endpointer/endpointer.cc", + "speech/endpointer/endpointer.h", + "speech/endpointer/energy_endpointer.cc", + "speech/endpointer/energy_endpointer.h", + "speech/endpointer/energy_endpointer_params.cc", + "speech/endpointer/energy_endpointer_params.h", + "speech/speech_recognition_engine.cc", + "speech/speech_recognition_engine.h", + "speech/speech_recognizer_impl.cc", + "speech/speech_recognizer_impl.h", + ] + deps += [ "//third_party/flac" ] + } else { + sources -= [ + "speech/speech_recognition_manager_impl.cc", + "speech/speech_recognition_manager_impl.h", + "speech/speech_recognition_dispatcher_host.cc", + "speech/speech_recognition_dispatcher_host.h", + ] + } + + if (enable_swiftshader) { + deps += [ "//third_party/swiftshader" ] + } + if (is_linux && use_dbus) { deps += [ "//dbus" ] } @@ -2253,6 +2267,54 @@ source_set("browser") { "hyphenation/hyphenation_impl.h", ] } + + if (use_qt) { + sources -= [ + "tracing/tracing_ui.cc", + "tracing/tracing_ui.h", + "accessibility/accessibility_ui.cc", + "accessibility/accessibility_ui.h" + ] + if (is_win) { + sources -= [ + "accessibility/browser_accessibility_com_win.cc", + "accessibility/browser_accessibility_com_win.h", + "accessibility/browser_accessibility_event_win.cc", + "accessibility/browser_accessibility_event_win.h", + "accessibility/browser_accessibility_manager_win.cc", + "accessibility/browser_accessibility_manager_win.h", + "accessibility/browser_accessibility_win.cc", + "accessibility/browser_accessibility_win.h", + "accessibility/accessibility_tree_formatter_win.cc", + "renderer_host/legacy_render_widget_host_win.cc", + "renderer_host/legacy_render_widget_host_win.h" + ] + } + if (use_aura) { + sources -= [ + "renderer_host/native_web_keyboard_event_aura.cc", + "renderer_host/render_widget_host_view_aura.cc", + "renderer_host/render_widget_host_view_aura.h", + "web_contents/web_contents_view_aura.h", + "web_contents/web_contents_view_aura.cc", + ] + } else if (is_mac) { + sources -= [ + "accessibility/accessibility_tree_formatter_mac.mm", + "accessibility/browser_accessibility_cocoa.mm", + "accessibility/browser_accessibility_cocoa.h", + "accessibility/browser_accessibility_mac.mm", + "accessibility/browser_accessibility_mac.h", + "accessibility/browser_accessibility_manager_mac.mm", + "accessibility/browser_accessibility_manager_mac.h", + "renderer_host/native_web_keyboard_event_mac.mm", + "renderer_host/render_widget_host_view_mac.mm", + "renderer_host/render_widget_host_view_mac.h", + "web_contents/web_contents_view_mac.mm", + "web_contents/web_contents_view_mac.h", + ] + } + } } buildflag_header("accessibility_flags") { diff --git a/chromium/content/browser/accessibility/browser_accessibility.h b/chromium/content/browser/accessibility/browser_accessibility.h index f94f3f9f036..97b001db18e 100644 --- a/chromium/content/browser/accessibility/browser_accessibility.h +++ b/chromium/content/browser/accessibility/browser_accessibility.h @@ -31,19 +31,19 @@ // BrowserAccessibilityManager. #undef PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL -#if defined(OS_WIN) +#if defined(TOOLKIT_QT) #define PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL 1 -#endif -#if defined(OS_MACOSX) +#elif defined(OS_WIN) #define PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL 1 -#endif -#if defined(OS_ANDROID) && !defined(USE_AURA) +#elif defined(OS_MACOSX) +#define PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL 1 + +#elif defined(OS_ANDROID) && !defined(USE_AURA) #define PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL 1 -#endif -#if BUILDFLAG(USE_ATK) +#elif BUILDFLAG(USE_ATK) #define PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL 1 #endif diff --git a/chromium/content/browser/accessibility/browser_accessibility_event.cc b/chromium/content/browser/accessibility/browser_accessibility_event.cc index 555688d7ff2..a16a3e18e56 100644 --- a/chromium/content/browser/accessibility/browser_accessibility_event.cc +++ b/chromium/content/browser/accessibility/browser_accessibility_event.cc @@ -38,7 +38,7 @@ bool BrowserAccessibilityEvent::FailedToSend(Result result) { return true; } -#if !defined(OS_WIN) +#if !defined(OS_WIN) || defined(TOOLKIT_QT) // static BrowserAccessibilityEvent* BrowserAccessibilityEvent::Create( Source source, diff --git a/chromium/content/browser/accessibility/browser_accessibility_manager.cc b/chromium/content/browser/accessibility/browser_accessibility_manager.cc index 38269319de3..5659137c17e 100644 --- a/chromium/content/browser/accessibility/browser_accessibility_manager.cc +++ b/chromium/content/browser/accessibility/browser_accessibility_manager.cc @@ -100,7 +100,11 @@ ui::AXTreeUpdate MakeAXTreeUpdate( } BrowserAccessibility* BrowserAccessibilityFactory::Create() { +#if defined(TOOLKIT_QT) + return nullptr; +#else return BrowserAccessibility::Create(); +#endif } BrowserAccessibilityFindInPageInfo::BrowserAccessibilityFindInPageInfo() diff --git a/chromium/content/browser/appcache/appcache_response.cc b/chromium/content/browser/appcache/appcache_response.cc index 4c7b0744514..5f6d7308997 100644 --- a/chromium/content/browser/appcache/appcache_response.cc +++ b/chromium/content/browser/appcache/appcache_response.cc @@ -335,7 +335,6 @@ void AppCacheResponseWriter::WriteInfo(HttpResponseInfoIOBuffer* info_buf, DCHECK(info_buf->http_info.get()); DCHECK(!buffer_.get()); DCHECK(!info_buffer_.get()); - DCHECK(info_buf->http_info->headers.get()); info_buffer_ = info_buf; callback_ = std::move(callback); // cleared on completion diff --git a/chromium/content/browser/browser_main_loop.cc b/chromium/content/browser/browser_main_loop.cc index 096a17447e4..b0c9546fdc8 100644 --- a/chromium/content/browser/browser_main_loop.cc +++ b/chromium/content/browser/browser_main_loop.cc @@ -256,6 +256,9 @@ void SetupSandbox(const base::CommandLine& parsed_command_line) { // zygote are both disabled. It initializes the sandboxed process socket. SandboxHostLinux::GetInstance()->Init(); + if (parsed_command_line.HasSwitch(switches::kSingleProcess)) + return; + if (parsed_command_line.HasSwitch(switches::kNoZygote) && !parsed_command_line.HasSwitch(switches::kNoSandbox)) { LOG(ERROR) << "--no-sandbox should be used together with --no--zygote"; @@ -498,7 +501,7 @@ class GpuDataManagerVisualProxy : public GpuDataManagerObserver { } void OnGpuInfoUpdate() override { - if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless)) + if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless) || !gfx::GetXDisplay()) return; gpu::GPUInfo gpu_info = gpu_data_manager_->GetGPUInfo(); if (!ui::XVisualManager::GetInstance()->OnGPUInfoChanged( @@ -580,7 +583,7 @@ void BrowserMainLoop::EarlyInitialization() { SetupSandbox(parsed_command_line_); #endif -#if defined(USE_X11) +#if defined(USE_X11) && !defined(TOOLKIT_QT) if (UsingInProcessGpu()) { if (!gfx::InitializeThreadedX11()) { LOG(ERROR) << "Failed to put Xlib into threaded mode."; @@ -1096,7 +1099,7 @@ int BrowserMainLoop::CreateThreads() { LOG(FATAL) << "Failed to start the browser thread: id == " << id; } else { scoped_refptr<base::SingleThreadTaskRunner> redirection_task_runner; -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) // On Windows, the FILE thread needs to have a UI message loop which // pumps messages in such a way that Google Update can communicate back // to us. The COM STA task runner provides this service. @@ -1526,7 +1529,7 @@ int BrowserMainLoop::BrowserThreadsStarted() { media_stream_manager_.reset(new MediaStreamManager( audio_system_.get(), audio_manager_->GetTaskRunner())); } - +#if defined(ENABLE_WEB_SPEECH) || defined(OS_ANDROID) { TRACE_EVENT0("startup", "BrowserMainLoop::BrowserThreadsStarted:InitSpeechRecognition"); @@ -1534,6 +1537,7 @@ int BrowserMainLoop::BrowserThreadsStarted() { audio_system_.get(), audio_manager_.get(), media_stream_manager_.get())); } +#endif { TRACE_EVENT0( @@ -1644,7 +1648,7 @@ bool BrowserMainLoop::InitializeToolkit() { #if defined(USE_AURA) -#if defined(USE_X11) +#if defined(USE_X11) && !defined(TOOLKIT_QT) if (!parsed_command_line_.HasSwitch(switches::kHeadless) && !gfx::GetXDisplay()) { LOG(ERROR) << "Unable to open X display."; diff --git a/chromium/content/browser/browser_main_runner.cc b/chromium/content/browser/browser_main_runner.cc index 6d510b3fcd9..2974724c930 100644 --- a/chromium/content/browser/browser_main_runner.cc +++ b/chromium/content/browser/browser_main_runner.cc @@ -85,10 +85,12 @@ class BrowserMainRunnerImpl : public BrowserMainRunner { notification_service_.reset(new NotificationServiceImpl); #if defined(OS_WIN) +#if !defined(TOOLKIT_QT) // Ole must be initialized before starting message pump, so that TSF // (Text Services Framework) module can interact with the message pump // on Windows 8 Metro mode. ole_initializer_.reset(new ui::ScopedOleInitializer); +#endif // Enable DirectWrite font rendering if needed. gfx::win::MaybeInitializeDirectWrite(); #endif // OS_WIN @@ -200,7 +202,7 @@ class BrowserMainRunnerImpl : public BrowserMainRunner { main_loop_->ShutdownThreadsAndCleanUp(); ui::ShutdownInputMethod(); - #if defined(OS_WIN) + #if defined(OS_WIN) && !defined(TOOLKIT_QT) ole_initializer_.reset(NULL); #endif #if defined(OS_ANDROID) @@ -227,7 +229,7 @@ class BrowserMainRunnerImpl : public BrowserMainRunner { std::unique_ptr<NotificationServiceImpl> notification_service_; std::unique_ptr<BrowserMainLoop> main_loop_; -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) std::unique_ptr<ui::ScopedOleInitializer> ole_initializer_; #endif diff --git a/chromium/content/browser/browser_plugin/browser_plugin_guest.cc b/chromium/content/browser/browser_plugin/browser_plugin_guest.cc index c73f9f0c640..7b576b8abc6 100644 --- a/chromium/content/browser/browser_plugin/browser_plugin_guest.cc +++ b/chromium/content/browser/browser_plugin/browser_plugin_guest.cc @@ -56,7 +56,7 @@ #include "ui/events/blink/web_input_event_traits.h" #include "ui/gfx/geometry/size_conversions.h" -#if defined(OS_MACOSX) +#if defined(OS_MACOSX) && BUILDFLAG(USE_EXTERNAL_POPUP_MENU) #include "content/browser/browser_plugin/browser_plugin_popup_menu_helper_mac.h" #include "content/common/frame_messages.h" #endif @@ -786,7 +786,7 @@ bool BrowserPluginGuest::OnMessageReceived(const IPC::Message& message, // around the whole thing (unfortunate but temporary), and #if guards where // they belong, only around the one IPC handler. TODO(avi): Move more of the // frame-based handlers to this function and remove the outer #if layer. -#if defined(OS_MACOSX) +#if defined(OS_MACOSX) && BUILDFLAG(USE_EXTERNAL_POPUP_MENU) bool handled = true; IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(BrowserPluginGuest, message, render_frame_host) @@ -1088,7 +1088,7 @@ void BrowserPluginGuest::OnHasTouchEventHandlers(bool accept) { browser_plugin_instance_id(), accept)); } -#if defined(OS_MACOSX) +#if defined(OS_MACOSX) && BUILDFLAG(USE_EXTERNAL_POPUP_MENU) void BrowserPluginGuest::OnShowPopup( RenderFrameHost* render_frame_host, const FrameHostMsg_ShowPopup_Params& params) { diff --git a/chromium/content/browser/browser_plugin/browser_plugin_guest.h b/chromium/content/browser/browser_plugin/browser_plugin_guest.h index ba024158dfa..7300fc3e1b8 100644 --- a/chromium/content/browser/browser_plugin/browser_plugin_guest.h +++ b/chromium/content/browser/browser_plugin/browser_plugin_guest.h @@ -31,6 +31,7 @@ #include "build/build_config.h" #include "components/viz/common/surfaces/local_surface_id.h" #include "content/common/edit_command.h" +#include "content/common/features.h" #include "content/common/input/input_event_ack_state.h" #include "content/public/browser/browser_plugin_guest_delegate.h" #include "content/public/browser/guest_host.h" @@ -48,7 +49,7 @@ struct BrowserPluginHostMsg_Attach_Params; struct BrowserPluginHostMsg_SetComposition_Params; -#if defined(OS_MACOSX) +#if defined(OS_MACOSX) && BUILDFLAG(USE_EXTERNAL_POPUP_MENU) struct FrameHostMsg_ShowPopup_Params; #endif @@ -366,7 +367,7 @@ class CONTENT_EXPORT BrowserPluginGuest : public GuestHost, blink::WebInputEvent::Type event_type, InputEventAckState ack_result); void OnHasTouchEventHandlers(bool accept); -#if defined(OS_MACOSX) +#if defined(OS_MACOSX) && BUILDFLAG(USE_EXTERNAL_POPUP_MENU) // On MacOS X popups are painted by the browser process. We handle them here // so that they are positioned correctly. void OnShowPopup(RenderFrameHost* render_frame_host, diff --git a/chromium/content/browser/child_process_launcher_helper_posix.cc b/chromium/content/browser/child_process_launcher_helper_posix.cc index 42e1c9e4cf1..68c8acd437c 100644 --- a/chromium/content/browser/child_process_launcher_helper_posix.cc +++ b/chromium/content/browser/child_process_launcher_helper_posix.cc @@ -12,6 +12,7 @@ #include "content/browser/posix_file_descriptor_info_impl.h" #include "content/public/browser/content_browser_client.h" #include "content/public/common/content_client.h" +#include "content/public/common/content_descriptor_keys.h" #include "content/public/common/content_descriptors.h" #include "content/public/common/content_switches.h" #include "mojo/edk/embedder/platform_handle.h" @@ -111,6 +112,15 @@ std::unique_ptr<PosixFileDescriptorInfo> CreateDefaultPosixFilesToMap( base::GlobalDescriptors::Key key = kContentDynamicDescriptorStart; service_manager::SharedFileSwitchValueBuilder file_switch_value_builder; for (const auto& key_path_iter : required_files_map) { + +#if !defined(V8_USE_EXTERNAL_STARTUP_DATA) + if (key_path_iter.first == content::kV8NativesDataDescriptor || + key_path_iter.first == content::kV8SnapshotDataDescriptor || + key_path_iter.first == content::kV8ContextSnapshotDataDescriptor) { + continue; + } +#endif // !V8_USE_EXTERNAL_STARTUP_DATA + base::MemoryMappedFile::Region region; base::PlatformFile file = OpenFileIfNecessary(key_path_iter.second, ®ion); diff --git a/chromium/content/browser/devtools/devtools_agent_host_impl.cc b/chromium/content/browser/devtools/devtools_agent_host_impl.cc index 87e2259d1c4..d7fbb8f76c2 100644 --- a/chromium/content/browser/devtools/devtools_agent_host_impl.cc +++ b/chromium/content/browser/devtools/devtools_agent_host_impl.cc @@ -224,9 +224,15 @@ void DevToolsAgentHostImpl::InspectElement( DevToolsAgentHostClient* client, int x, int y) { - DevToolsSession* session = SessionByClient(client); + DevToolsSession* session = nullptr; + if (client) + session = SessionByClient(client); + else if (sessions_.size() == 1) + session = *sessions_.begin(); if (session) InspectElement(session, x, y); + else + LOG(WARNING) << "InspectElement called with unknown or ambigious client"; } std::string DevToolsAgentHostImpl::GetId() { diff --git a/chromium/content/browser/devtools/devtools_http_handler.cc b/chromium/content/browser/devtools/devtools_http_handler.cc index 4468bc4be35..6309806f85d 100644 --- a/chromium/content/browser/devtools/devtools_http_handler.cc +++ b/chromium/content/browser/devtools/devtools_http_handler.cc @@ -757,6 +757,7 @@ void DevToolsHttpHandler::ServerStarted( server_wrapper_ = std::move(server_wrapper); socket_factory_ = std::move(socket_factory); server_ip_address_ = std::move(ip_address); + delegate_->Initialized(server_ip_address_.get()); } void DevToolsHttpHandler::SendJson(int connection_id, diff --git a/chromium/content/browser/frame_host/popup_menu_helper_mac.mm b/chromium/content/browser/frame_host/popup_menu_helper_mac.mm index c33a667e552..d033650664e 100644 --- a/chromium/content/browser/frame_host/popup_menu_helper_mac.mm +++ b/chromium/content/browser/frame_host/popup_menu_helper_mac.mm @@ -13,6 +13,7 @@ #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/renderer_host/render_widget_host_view_mac.h" #include "content/browser/renderer_host/webmenurunner_mac.h" +#include "content/common/features.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" @@ -104,6 +105,7 @@ void PopupMenuHelper::ShowPopupMenu( menu_runner_ = nil; +#if BUILDFLAG(USE_EXTERNAL_POPUP_MENU) // The RenderFrameHost may be deleted while running the menu, or it may have // requested the close. Don't notify in these cases. if (render_frame_host_ && !popup_was_hidden_) { @@ -113,6 +115,7 @@ void PopupMenuHelper::ShowPopupMenu( render_frame_host_->DidCancelPopupMenu(); } +#endif delegate_->OnMenuClosed(); // May delete |this|. } diff --git a/chromium/content/browser/frame_host/render_frame_host_impl.cc b/chromium/content/browser/frame_host/render_frame_host_impl.cc index a89eefd4403..f9a8ff26e87 100644 --- a/chromium/content/browser/frame_host/render_frame_host_impl.cc +++ b/chromium/content/browser/frame_host/render_frame_host_impl.cc @@ -181,11 +181,13 @@ int g_next_accessibility_reset_token = 1; // The next value to use for the javascript callback id. int g_next_javascript_callback_id = 1; -#if defined(OS_ANDROID) +#if defined(OS_ANDROID) || defined(TOOLKIT_QT) // Whether to allow injecting javascript into any kind of frame (for Android // WebView). bool g_allow_injecting_javascript = false; +#endif +#if defined(OS_ANDROID) // Whether to allow data URL navigations for Android WebView. // TODO(meacer): Remove after PlzNavigate ships. bool g_allow_data_url_navigation = false; @@ -391,12 +393,14 @@ RenderFrameHost* RenderFrameHost::FromID(int render_process_id, return RenderFrameHostImpl::FromID(render_process_id, render_frame_id); } -#if defined(OS_ANDROID) +#if defined(OS_ANDROID) || defined(TOOLKIT_QT) // static void RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView() { g_allow_injecting_javascript = true; } +#endif // defined(OS_ANDROID) || defined(TOOLKIT_QT) +#if defined(OS_ANDROID) // static void RenderFrameHost::AllowDataUrlNavigationForAndroidWebView() { g_allow_data_url_navigation = true; @@ -2583,17 +2587,7 @@ void RenderFrameHostImpl::OnToggleFullscreen(bool enter_fullscreen) { if (enter_fullscreen) delegate_->EnterFullscreenMode(last_committed_url().GetOrigin()); else - delegate_->ExitFullscreenMode(/* will_cause_resize */ true); - - // The previous call might change the fullscreen state. We need to make sure - // the renderer is aware of that, which is done via the resize message. - // Typically, this will be sent as part of the call on the |delegate_| above - // when resizing the native windows, but sometimes fullscreen can be entered - // without causing a resize, so we need to ensure that the resize message is - // sent in that case. We always send this to the main frame's widget, and if - // there are any OOPIF widgets, this will also trigger them to resize via - // frameRectsChanged. - render_view_host_->GetWidget()->WasResized(); + delegate_->ExitFullscreenMode(/* will_cause_resize */ false); } void RenderFrameHostImpl::OnDidStartLoading(bool to_different_document) { @@ -2672,9 +2666,10 @@ void RenderFrameHostImpl::OnSerializeAsMHTMLResponse( void RenderFrameHostImpl::OnSelectionChanged(const base::string16& text, uint32_t offset, - const gfx::Range& range) { + const gfx::Range& range, + bool user_initiated) { has_selection_ = !text.empty(); - GetRenderWidgetHost()->SelectionChanged(text, offset, range); + GetRenderWidgetHost()->SelectionChanged(text, offset, range, user_initiated); } void RenderFrameHostImpl::OnFocusedNodeChanged( @@ -3941,7 +3936,7 @@ void RenderFrameHostImpl::UpdatePermissionsForNavigation( } bool RenderFrameHostImpl::CanExecuteJavaScript() { -#if defined(OS_ANDROID) +#if defined(OS_ANDROID) || defined(TOOLKIT_QT) if (g_allow_injecting_javascript) return true; #endif diff --git a/chromium/content/browser/frame_host/render_frame_host_impl.h b/chromium/content/browser/frame_host/render_frame_host_impl.h index ec9ec442469..1a2372495dc 100644 --- a/chromium/content/browser/frame_host/render_frame_host_impl.h +++ b/chromium/content/browser/frame_host/render_frame_host_impl.h @@ -813,7 +813,8 @@ class CONTENT_EXPORT RenderFrameHostImpl base::TimeDelta renderer_main_thread_time); void OnSelectionChanged(const base::string16& text, uint32_t offset, - const gfx::Range& range); + const gfx::Range& range, + bool user_initiated); void OnFocusedNodeChanged(bool is_editable_element, const gfx::Rect& bounds_in_frame_widget); void OnSetHasReceivedUserGesture(); diff --git a/chromium/content/browser/frame_host/render_widget_host_view_guest.cc b/chromium/content/browser/frame_host/render_widget_host_view_guest.cc index e885721017f..182e6771d92 100644 --- a/chromium/content/browser/frame_host/render_widget_host_view_guest.cc +++ b/chromium/content/browser/frame_host/render_widget_host_view_guest.cc @@ -419,12 +419,13 @@ void RenderWidgetHostViewGuest::ImeCompositionRangeChanged( void RenderWidgetHostViewGuest::SelectionChanged(const base::string16& text, size_t offset, - const gfx::Range& range) { + const gfx::Range& range, + bool user_initiated) { RenderWidgetHostViewBase* view = should_forward_text_selection_ ? GetOwnerRenderWidgetHostView() : platform_view_.get(); if (view) - view->SelectionChanged(text, offset, range); + view->SelectionChanged(text, offset, range, user_initiated); } void RenderWidgetHostViewGuest::SelectionBoundsChanged( diff --git a/chromium/content/browser/frame_host/render_widget_host_view_guest.h b/chromium/content/browser/frame_host/render_widget_host_view_guest.h index 6ba40d26039..f36d833f26b 100644 --- a/chromium/content/browser/frame_host/render_widget_host_view_guest.h +++ b/chromium/content/browser/frame_host/render_widget_host_view_guest.h @@ -91,7 +91,8 @@ class CONTENT_EXPORT RenderWidgetHostViewGuest void SetTooltipText(const base::string16& tooltip_text) override; void SelectionChanged(const base::string16& text, size_t offset, - const gfx::Range& range) override; + const gfx::Range& range, + bool user_initiated) override; void SelectionBoundsChanged( const ViewHostMsg_SelectionBounds_Params& params) override; void SubmitCompositorFrame(const viz::LocalSurfaceId& local_surface_id, diff --git a/chromium/content/browser/gpu/gpu_internals_ui.cc b/chromium/content/browser/gpu/gpu_internals_ui.cc index 73a2bf310c9..155513dfb9e 100644 --- a/chromium/content/browser/gpu/gpu_internals_ui.cc +++ b/chromium/content/browser/gpu/gpu_internals_ui.cc @@ -210,9 +210,9 @@ std::unique_ptr<base::DictionaryValue> GpuInfoAsDictionaryValue() { basic_info->Append(NewDescriptionValuePair("Window system binding extensions", gpu_info.gl_ws_extensions)); #if defined(OS_LINUX) && defined(USE_X11) - basic_info->Append(NewDescriptionValuePair("Window manager", - ui::GuessWindowManagerName())); - { + if (gfx::GetXDisplay()) { + basic_info->Append(NewDescriptionValuePair("Window manager", + ui::GuessWindowManagerName())); std::unique_ptr<base::Environment> env(base::Environment::Create()); std::string value; const char kXDGCurrentDesktop[] = "XDG_CURRENT_DESKTOP"; @@ -249,10 +249,12 @@ std::unique_ptr<base::DictionaryValue> GpuInfoAsDictionaryValue() { #endif #if defined(USE_X11) - basic_info->Append(NewDescriptionValuePair( - "System visual ID", base::Uint64ToString(gpu_info.system_visual))); - basic_info->Append(NewDescriptionValuePair( - "RGBA visual ID", base::Uint64ToString(gpu_info.rgba_visual))); + if (gfx::GetXDisplay()) { + basic_info->Append(NewDescriptionValuePair( + "System visual ID", base::Uint64ToString(gpu_info.system_visual))); + basic_info->Append(NewDescriptionValuePair( + "RGBA visual ID", base::Uint64ToString(gpu_info.rgba_visual))); + } #endif info->Set("basic_info", std::move(basic_info)); diff --git a/chromium/content/browser/gpu/gpu_process_host.cc b/chromium/content/browser/gpu/gpu_process_host.cc index eb380f6b29a..7bb099377d9 100644 --- a/chromium/content/browser/gpu/gpu_process_host.cc +++ b/chromium/content/browser/gpu/gpu_process_host.cc @@ -607,7 +607,7 @@ bool GpuProcessHost::Init() { process_->GetInProcessBrokerClientInvitation(), process_->child_connection()->service_token()))); base::Thread::Options options; -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) // WGL needs to create its own window and pump messages on it. options.message_loop_type = base::MessageLoop::TYPE_UI; #endif diff --git a/chromium/content/browser/renderer_host/media/media_stream_manager.cc b/chromium/content/browser/renderer_host/media/media_stream_manager.cc index 0eff1c52bf2..ee273d3c876 100644 --- a/chromium/content/browser/renderer_host/media/media_stream_manager.cc +++ b/chromium/content/browser/renderer_host/media/media_stream_manager.cc @@ -1045,6 +1045,15 @@ void MediaStreamManager::SetupRequest(const std::string& label) { return; } + const bool is_audio_only_desktop_capture = + (!is_screen_capture && audio_type == MEDIA_DESKTOP_AUDIO_CAPTURE); + if (is_audio_only_desktop_capture) { + FinalizeRequestFailed(label, + request, + MEDIA_DEVICE_NOT_SUPPORTED); + return; + } + if (!is_web_contents_capture && !is_screen_capture) { if (audio_type == MEDIA_DEVICE_AUDIO_CAPTURE || video_type == MEDIA_DEVICE_VIDEO_CAPTURE) { diff --git a/chromium/content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc b/chromium/content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc index 4822d0d57e4..f0ba26c52c7 100644 --- a/chromium/content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc +++ b/chromium/content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc @@ -55,7 +55,7 @@ PepperFlashFileMessageFilter::PepperFlashFileMessageFilter( // will construct a bad path and could provide access to the wrong files. // In this case, |plugin_data_directory_| will remain unset and // |ValidateAndConvertPepperFilePath| will fail. - NOTREACHED(); + DLOG(ERROR) << "Pepper Flash file access attemped with no data path"; } else { plugin_data_directory_ = GetDataDirName(profile_data_directory).Append( base::FilePath::FromUTF8Unsafe(plugin_name)); diff --git a/chromium/content/browser/renderer_host/pepper/pepper_truetype_font_list_win.cc b/chromium/content/browser/renderer_host/pepper/pepper_truetype_font_list_win.cc index 231c8ca14f2..02dd8e041cb 100644 --- a/chromium/content/browser/renderer_host/pepper/pepper_truetype_font_list_win.cc +++ b/chromium/content/browser/renderer_host/pepper/pepper_truetype_font_list_win.cc @@ -58,7 +58,7 @@ static int CALLBACK EnumFontsInFamilyProc(ENUMLOGFONTEXW* logical_font, } } // namespace - +#if !defined(TOOLKIT_QT) void GetFontFamilies_SlowBlocking(FontFamilyList* font_families) { LOGFONTW logfont; memset(&logfont, 0, sizeof(logfont)); @@ -87,5 +87,5 @@ void GetFontsInFamily_SlowBlocking(const std::string& family, (LPARAM)fonts_in_family, 0); } - +#endif } // namespace content diff --git a/chromium/content/browser/renderer_host/render_process_host_impl.cc b/chromium/content/browser/renderer_host/render_process_host_impl.cc index a8dfd6c0c83..26a4e003b1d 100644 --- a/chromium/content/browser/renderer_host/render_process_host_impl.cc +++ b/chromium/content/browser/renderer_host/render_process_host_impl.cc @@ -1486,7 +1486,7 @@ bool RenderProcessHostImpl::Init() { child_connection_->service_token()))); base::Thread::Options options; -#if defined(OS_WIN) && !defined(OS_MACOSX) +#if defined(OS_WIN) && !defined(OS_MACOSX) && !defined(TOOLKIT_QT) // In-process plugins require this to be a UI message loop. options.message_loop_type = base::MessageLoop::TYPE_UI; #else @@ -1725,8 +1725,10 @@ void RenderProcessHostImpl::CreateMessageFilters() { #if BUILDFLAG(ENABLE_PLUGINS) AddFilter(new PepperRendererConnection(GetID())); #endif +#if defined(ENABLE_WEB_SPEECH) || defined(OS_ANDROID) AddFilter(new SpeechRecognitionDispatcherHost( GetID(), storage_partition_impl_->GetURLRequestContext())); +#endif AddFilter(new FileAPIMessageFilter( GetID(), storage_partition_impl_->GetURLRequestContext(), storage_partition_impl_->GetFileSystemContext(), diff --git a/chromium/content/browser/renderer_host/render_widget_host_impl.cc b/chromium/content/browser/renderer_host/render_widget_host_impl.cc index 24b9880966d..315fe28ebb1 100644 --- a/chromium/content/browser/renderer_host/render_widget_host_impl.cc +++ b/chromium/content/browser/renderer_host/render_widget_host_impl.cc @@ -1594,9 +1594,12 @@ void RenderWidgetHostImpl::GetSnapshotFromBrowser( void RenderWidgetHostImpl::SelectionChanged(const base::string16& text, uint32_t offset, - const gfx::Range& range) { - if (view_) - view_->SelectionChanged(text, static_cast<size_t>(offset), range); + const gfx::Range& range, + bool user_initiated) { + if (view_) { + view_->SelectionChanged(text, static_cast<size_t>(offset), range, + user_initiated); + } } void RenderWidgetHostImpl::OnSelectionBoundsChanged( diff --git a/chromium/content/browser/renderer_host/render_widget_host_impl.h b/chromium/content/browser/renderer_host/render_widget_host_impl.h index 14abab21c65..964a14e1d9f 100644 --- a/chromium/content/browser/renderer_host/render_widget_host_impl.h +++ b/chromium/content/browser/renderer_host/render_widget_host_impl.h @@ -550,7 +550,8 @@ class CONTENT_EXPORT RenderWidgetHostImpl // Called from a RenderFrameHost when the text selection has changed. void SelectionChanged(const base::string16& text, uint32_t offset, - const gfx::Range& range); + const gfx::Range& range, + bool user_initiated); size_t in_flight_event_count() const { return in_flight_event_count_; } blink::WebInputEvent::Type hang_monitor_event_type() const { diff --git a/chromium/content/browser/renderer_host/render_widget_host_view_aura.cc b/chromium/content/browser/renderer_host/render_widget_host_view_aura.cc index 9bcef0992e7..76ee3436aad 100644 --- a/chromium/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/chromium/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -2369,7 +2369,8 @@ void RenderWidgetHostViewAura::OnTextSelectionChanged( #if defined(USE_X11) const TextInputManager::TextSelection* selection = GetTextInputManager()->GetTextSelection(focused_view); - if (selection->selected_text().length()) { + if (selection->selected_text().length() + && selection->user_initiated()) { // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); clipboard_writer.WriteText(selection->selected_text()); diff --git a/chromium/content/browser/renderer_host/render_widget_host_view_base.cc b/chromium/content/browser/renderer_host/render_widget_host_view_base.cc index 964578b4d17..b1d0f235b3d 100644 --- a/chromium/content/browser/renderer_host/render_widget_host_view_base.cc +++ b/chromium/content/browser/renderer_host/render_widget_host_view_base.cc @@ -123,9 +123,11 @@ float RenderWidgetHostViewBase::GetBottomControlsHeight() const { void RenderWidgetHostViewBase::SelectionChanged(const base::string16& text, size_t offset, - const gfx::Range& range) { + const gfx::Range& range, + bool user_initiated) { if (GetTextInputManager()) - GetTextInputManager()->SelectionChanged(this, text, offset, range); + GetTextInputManager()->SelectionChanged(this, text, offset, range, + user_initiated); } gfx::Size RenderWidgetHostViewBase::GetRequestedRendererSize() const { diff --git a/chromium/content/browser/renderer_host/render_widget_host_view_base.h b/chromium/content/browser/renderer_host/render_widget_host_view_base.h index 1764ea8c31c..70d93af50c0 100644 --- a/chromium/content/browser/renderer_host/render_widget_host_view_base.h +++ b/chromium/content/browser/renderer_host/render_widget_host_view_base.h @@ -173,7 +173,8 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, // Notifies the View that the renderer text selection has changed. virtual void SelectionChanged(const base::string16& text, size_t offset, - const gfx::Range& range); + const gfx::Range& range, + bool user_initiated); // The requested size of the renderer. May differ from GetViewBounds().size() // when the view requires additional throttling. diff --git a/chromium/content/browser/renderer_host/text_input_manager.cc b/chromium/content/browser/renderer_host/text_input_manager.cc index 8ab29925959..5a600ac16b6 100644 --- a/chromium/content/browser/renderer_host/text_input_manager.cc +++ b/chromium/content/browser/renderer_host/text_input_manager.cc @@ -239,9 +239,10 @@ void TextInputManager::ImeCompositionRangeChanged( void TextInputManager::SelectionChanged(RenderWidgetHostViewBase* view, const base::string16& text, size_t offset, - const gfx::Range& range) { + const gfx::Range& range, + bool user_initiated) { DCHECK(IsRegistered(view)); - text_selection_map_[view].SetSelection(text, offset, range); + text_selection_map_[view].SetSelection(text, offset, range, user_initiated); for (auto& observer : observer_list_) observer.OnTextSelectionChanged(this, view); } @@ -331,11 +332,13 @@ TextInputManager::TextSelection::~TextSelection() {} void TextInputManager::TextSelection::SetSelection(const base::string16& text, size_t offset, - const gfx::Range& range) { + const gfx::Range& range, + bool user_initiated) { text_ = text; range_.set_start(range.start()); range_.set_end(range.end()); offset_ = offset; + user_initiated_ = user_initiated; // Update the selected text. selected_text_.clear(); diff --git a/chromium/content/browser/renderer_host/text_input_manager.h b/chromium/content/browser/renderer_host/text_input_manager.h index b4cbcaec304..a03124de42b 100644 --- a/chromium/content/browser/renderer_host/text_input_manager.h +++ b/chromium/content/browser/renderer_host/text_input_manager.h @@ -105,12 +105,14 @@ class CONTENT_EXPORT TextInputManager { void SetSelection(const base::string16& text, size_t offset, - const gfx::Range& range); + const gfx::Range& range, + bool user_initiated); const base::string16& selected_text() const { return selected_text_; } size_t offset() const { return offset_; } const gfx::Range& range() const { return range_; } const base::string16& text() const { return text_; } + bool user_initiated() const { return user_initiated_; } private: // The offset of the text stored in |text| relative to the start of the web @@ -129,6 +131,9 @@ class CONTENT_EXPORT TextInputManager { // Part of the text on the page which includes the highlighted text plus // possibly several characters before and after it. base::string16 text_; + + // True if text selection is triggered by user input. + bool user_initiated_ = false; }; TextInputManager(); @@ -194,7 +199,8 @@ class CONTENT_EXPORT TextInputManager { void SelectionChanged(RenderWidgetHostViewBase* view, const base::string16& text, size_t offset, - const gfx::Range& range); + const gfx::Range& range, + bool user_initiated); // Registers the given |view| for tracking its TextInputState. This is called // by any view which has updates in its TextInputState (whether tab's RWHV or diff --git a/chromium/content/browser/sandbox_ipc_linux.cc b/chromium/content/browser/sandbox_ipc_linux.cc index 0851477f24c..5774de967ff 100644 --- a/chromium/content/browser/sandbox_ipc_linux.cc +++ b/chromium/content/browser/sandbox_ipc_linux.cc @@ -312,7 +312,8 @@ void SandboxIPCHandler::HandleGetStyleForStrike( } gfx::FontRenderParamsQuery query; - query.families.push_back(family); + if (!family.empty()) + query.families.push_back(family); query.pixel_size = pixel_size; query.style = italic ? gfx::Font::ITALIC : 0; query.weight = bold ? gfx::Font::Weight::BOLD : gfx::Font::Weight::NORMAL; diff --git a/chromium/content/browser/service_worker/service_worker_write_to_cache_job.cc b/chromium/content/browser/service_worker/service_worker_write_to_cache_job.cc index 277a0f7284f..d303dfe12fc 100644 --- a/chromium/content/browser/service_worker/service_worker_write_to_cache_job.cc +++ b/chromium/content/browser/service_worker/service_worker_write_to_cache_job.cc @@ -153,13 +153,13 @@ net::LoadState ServiceWorkerWriteToCacheJob::GetLoadState() const { } bool ServiceWorkerWriteToCacheJob::GetCharset(std::string* charset) { - if (!http_info()) + if (!http_info() || !http_info()->headers) return false; return http_info()->headers->GetCharset(charset); } bool ServiceWorkerWriteToCacheJob::GetMimeType(std::string* mime_type) const { - if (!http_info()) + if (!http_info() || !http_info()->headers) return false; return http_info()->headers->GetMimeType(mime_type); } @@ -319,7 +319,8 @@ void ServiceWorkerWriteToCacheJob::OnResponseStarted(net::URLRequest* request, NotifyStartErrorHelper(error, kFetchScriptError); return; } - if (request->GetResponseCode() / 100 != 2) { + if (request->url().SchemeIsHTTPOrHTTPS() + && (request->GetResponseCode() / 100 != 2)) { std::string error_message = base::StringPrintf(kBadHTTPResponseError, request->GetResponseCode()); NotifyStartErrorHelper(net::ERR_INVALID_RESPONSE, error_message); @@ -421,7 +422,8 @@ bool ServiceWorkerWriteToCacheJob::CheckPathRestriction( net::URLRequest* request) { std::string service_worker_allowed; const net::HttpResponseHeaders* headers = request->response_headers(); - bool has_header = headers->EnumerateHeader(nullptr, kServiceWorkerAllowed, + bool has_header = headers + && headers->EnumerateHeader(nullptr, kServiceWorkerAllowed, &service_worker_allowed); std::string error_message; diff --git a/chromium/content/browser/web_contents/web_contents_impl.cc b/chromium/content/browser/web_contents/web_contents_impl.cc index f985ea2bcea..3ae6216917a 100644 --- a/chromium/content/browser/web_contents/web_contents_impl.cc +++ b/chromium/content/browser/web_contents/web_contents_impl.cc @@ -2036,6 +2036,26 @@ RenderWidgetHostInputEventRouter* WebContentsImpl::GetInputEventRouter() { return rwh_input_event_router_.get(); } +void WebContentsImpl::NotifyFullscreenChanged(bool will_cause_resize) { + // The fullscreen state is communicated to the renderer through a resize + // message. If the change in fullscreen state doesn't cause a view resize + // then we must ensure web contents exit the fullscreen state by explicitly + // sending a resize message. This is required for the situation of the browser + // moving the view into a "browser fullscreen" state and then the contents + // entering "tab fullscreen". Exiting the contents "tab fullscreen" then won't + // have the side effect of the view resizing, hence the explicit call here is + // required. + if (!will_cause_resize) { + if (RenderWidgetHostView* rwh_view = GetRenderWidgetHostView()) { + if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) + render_widget_host->WasResized(); + } + } + + for (auto& observer : observers_) + observer.DidToggleFullscreenModeForTab(IsFullscreenForCurrentTab(), will_cause_resize); +} + void WebContentsImpl::ReplicatePageFocus(bool is_focused) { // Focus loss may occur while this WebContents is being destroyed. Don't // send the message in this case, as the main frame's RenderFrameHost and @@ -2118,8 +2138,8 @@ void WebContentsImpl::EnterFullscreenMode(const GURL& origin) { if (delegate_) delegate_->EnterFullscreenModeForTab(this, origin); - for (auto& observer : observers_) - observer.DidToggleFullscreenModeForTab(IsFullscreenForCurrentTab(), false); + if (IsFullscreenForCurrentTab()) + NotifyFullscreenChanged(false); } void WebContentsImpl::ExitFullscreenMode(bool will_cause_resize) { @@ -2140,25 +2160,8 @@ void WebContentsImpl::ExitFullscreenMode(bool will_cause_resize) { if (delegate_) delegate_->ExitFullscreenModeForTab(this); - // The fullscreen state is communicated to the renderer through a resize - // message. If the change in fullscreen state doesn't cause a view resize - // then we must ensure web contents exit the fullscreen state by explicitly - // sending a resize message. This is required for the situation of the browser - // moving the view into a "browser fullscreen" state and then the contents - // entering "tab fullscreen". Exiting the contents "tab fullscreen" then won't - // have the side effect of the view resizing, hence the explicit call here is - // required. - if (!will_cause_resize) { - if (RenderWidgetHostView* rwhv = GetRenderWidgetHostView()) { - if (RenderWidgetHost* render_widget_host = rwhv->GetRenderWidgetHost()) - render_widget_host->WasResized(); - } - } - - for (auto& observer : observers_) { - observer.DidToggleFullscreenModeForTab(IsFullscreenForCurrentTab(), - will_cause_resize); - } + if (!IsFullscreenForCurrentTab()) + NotifyFullscreenChanged(will_cause_resize); } bool WebContentsImpl::IsFullscreenForCurrentTab() const { @@ -2492,7 +2495,7 @@ void WebContentsImpl::CreateNewWidget(int32_t render_process_id, pending_widget_views_[std::make_pair(render_process_id, route_id)] = widget_view; -#if defined(OS_MACOSX) +#if defined(OS_MACOSX) && !defined(TOOLKIT_QT) // A RenderWidgetHostViewMac has lifetime scoped to the view. We'll retain it // to allow it to survive the trip without being hosted. base::mac::NSObjectRetain(widget_view->GetNativeView()); @@ -2582,7 +2585,7 @@ void WebContentsImpl::ShowCreatedWidget(int process_id, // used to implement Pepper Flash fullscreen. render_widget_host_impl->set_allow_privileged_mouse_lock(is_fullscreen); -#if defined(OS_MACOSX) +#if defined(OS_MACOSX) && !defined(TOOLKIT_QT) // A RenderWidgetHostViewMac has lifetime scoped to the view. Now that it's // properly embedded (or purposefully ignored) we can release the retain we // took in CreateNewWidget(). diff --git a/chromium/content/browser/web_contents/web_contents_impl.h b/chromium/content/browser/web_contents/web_contents_impl.h index afd40fc8389..be4efae1457 100644 --- a/chromium/content/browser/web_contents/web_contents_impl.h +++ b/chromium/content/browser/web_contents/web_contents_impl.h @@ -453,6 +453,7 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents, void GetManifest(const GetManifestCallback& callback) override; bool IsFullscreenForCurrentTab() const override; void ExitFullscreen(bool will_cause_resize) override; + void NotifyFullscreenChanged(bool will_cause_resize) override; void ResumeLoadingCreatedWebContents() override; void OnPasswordInputShownOnHttp() override; void OnAllPasswordInputsHiddenOnHttp() override; diff --git a/chromium/content/browser/webui/content_web_ui_controller_factory.cc b/chromium/content/browser/webui/content_web_ui_controller_factory.cc index 0ca8a83848b..02a02de97ff 100644 --- a/chromium/content/browser/webui/content_web_ui_controller_factory.cc +++ b/chromium/content/browser/webui/content_web_ui_controller_factory.cc @@ -31,14 +31,16 @@ WebUI::TypeID ContentWebUIControllerFactory::GetWebUIType( return WebUI::kNoWebUI; if (url.host_piece() == kChromeUIWebRTCInternalsHost || -#if !defined(OS_ANDROID) +#if !defined(OS_ANDROID) && !defined(TOOLKIT_QT) url.host_piece() == kChromeUITracingHost || #endif url.host_piece() == kChromeUIGpuHost || url.host_piece() == kChromeUIIndexedDBInternalsHost || url.host_piece() == kChromeUIMediaInternalsHost || url.host_piece() == kChromeUIServiceWorkerInternalsHost || +#if !defined(TOOLKIT_QT) url.host_piece() == kChromeUIAccessibilityHost || +#endif url.host_piece() == kChromeUIAppCacheInternalsHost || url.host_piece() == kChromeUINetworkErrorsListingHost) { return const_cast<ContentWebUIControllerFactory*>(this); @@ -69,13 +71,15 @@ WebUIController* ContentWebUIControllerFactory::CreateWebUIControllerForURL( return new IndexedDBInternalsUI(web_ui); if (url.host_piece() == kChromeUIMediaInternalsHost) return new MediaInternalsUI(web_ui); +#if !defined(TOOLKIT_QT) if (url.host_piece() == kChromeUIAccessibilityHost) return new AccessibilityUI(web_ui); +#endif if (url.host_piece() == kChromeUIServiceWorkerInternalsHost) return new ServiceWorkerInternalsUI(web_ui); if (url.host_piece() == kChromeUINetworkErrorsListingHost) return new NetworkErrorsListingUI(web_ui); -#if !defined(OS_ANDROID) +#if !defined(OS_ANDROID) && !defined(TOOLKIT_QT) if (url.host_piece() == kChromeUITracingHost) return new TracingUI(web_ui); #endif diff --git a/chromium/content/browser/zygote_host/zygote_host_impl_linux.cc b/chromium/content/browser/zygote_host/zygote_host_impl_linux.cc index cf264bfa84d..71b79f9aca1 100644 --- a/chromium/content/browser/zygote_host/zygote_host_impl_linux.cc +++ b/chromium/content/browser/zygote_host/zygote_host_impl_linux.cc @@ -120,7 +120,7 @@ void ZygoteHostImpl::Init(const base::CommandLine& command_line) { // root. use_suid_sandbox_for_adj_oom_score_ = use_suid_sandbox_; } else { - LOG(FATAL) + LOG(INFO) << "No usable sandbox! Update your kernel or see " "https://chromium.googlesource.com/chromium/src/+/master/" "docs/linux_suid_sandbox_development.md for more information on " diff --git a/chromium/content/child/font_warmup_win.cc b/chromium/content/child/font_warmup_win.cc index 99d013963c5..d20707d717a 100644 --- a/chromium/content/child/font_warmup_win.cc +++ b/chromium/content/child/font_warmup_win.cc @@ -22,7 +22,9 @@ #include "base/trace_event/trace_event.h" #include "base/win/iat_patch_function.h" #include "base/win/windows_version.h" +#if defined(ENABLE_PLUGINS) #include "ppapi/shared_impl/proxy_lock.h" +#endif #include "skia/ext/fontmgr_default_win.h" #include "third_party/skia/include/core/SkRefCnt.h" #include "third_party/skia/include/ports/SkFontMgr.h" @@ -205,7 +207,9 @@ sk_sp<SkTypeface> GetTypefaceFromLOGFONT(const LOGFONTW* log_font) { : SkFontStyle::kUpright_Slant); std::string family_name = base::WideToUTF8(log_font->lfFaceName); +#if defined(ENABLE_PLUGINS) ppapi::ProxyAutoLock lock; // Needed for DirectWrite font proxy. +#endif return sk_sp<SkTypeface>( g_warmup_fontmgr->matchFamilyStyle(family_name.c_str(), style)); } diff --git a/chromium/content/common/BUILD.gn b/chromium/content/common/BUILD.gn index d607aae096c..5a97f68b810 100644 --- a/chromium/content/common/BUILD.gn +++ b/chromium/content/common/BUILD.gn @@ -515,11 +515,9 @@ source_set("common") { sources -= [ "cursors/webcursor_aurax11.cc" ] } - if (is_linux) { + if (is_linux && !use_qt) { deps += [ "//third_party/fontconfig" ] - } - - if (is_mac || is_win || is_android || is_fuchsia) { + } else { sources -= [ "font_list_fontconfig.cc" ] } diff --git a/chromium/content/common/font_list_win.cc b/chromium/content/common/font_list_win.cc index cd1b8aaedc9..272d7919eb1 100644 --- a/chromium/content/common/font_list_win.cc +++ b/chromium/content/common/font_list_win.cc @@ -31,7 +31,7 @@ static int CALLBACK EnumFontFamExProc(ENUMLOGFONTEXW* logical_font, } return 1; } - +#if !defined(TOOLKIT_QT) std::unique_ptr<base::ListValue> GetFontList_SlowBlocking() { std::set<base::string16> font_names; @@ -54,5 +54,6 @@ std::unique_ptr<base::ListValue> GetFontList_SlowBlocking() { } return font_list; } +#endif } // namespace content diff --git a/chromium/content/common/frame_messages.h b/chromium/content/common/frame_messages.h index 18c4b420d78..7ce5a130571 100644 --- a/chromium/content/common/frame_messages.h +++ b/chromium/content/common/frame_messages.h @@ -1475,10 +1475,11 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_ContextMenu, content::ContextMenuParams) // Notification that the text selection has changed. // Note: The second parameter is the character based offset of the // base::string16 text in the document. -IPC_MESSAGE_ROUTED3(FrameHostMsg_SelectionChanged, +IPC_MESSAGE_ROUTED4(FrameHostMsg_SelectionChanged, base::string16 /* text covers the selection range */, uint32_t /* the offset of the text in the document */, - gfx::Range /* selection range in the document */) + gfx::Range /* selection range in the document */, + bool /* selection is triggered by user input */) // Response for FrameMsg_JavaScriptExecuteRequest, sent when a reply was // requested. The ID is the parameter supplied to diff --git a/chromium/content/common/input/event_with_latency_info.h b/chromium/content/common/input/event_with_latency_info.h index 3ac2bdd3a32..0f6b2293254 100644 --- a/chromium/content/common/input/event_with_latency_info.h +++ b/chromium/content/common/input/event_with_latency_info.h @@ -49,8 +49,9 @@ class EventWithLatencyInfo { void CoalesceWith(const EventWithLatencyInfo& other) { // |other| should be a newer event than |this|. - if (other.latency.trace_id() >= 0 && latency.trace_id() >= 0) + if (other.latency.trace_id() >= 0 && latency.trace_id() >= 0) { DCHECK_GT(other.latency.trace_id(), latency.trace_id()); + } // New events get coalesced into older events, and the newer timestamp // should always be preserved. diff --git a/chromium/content/common/quarantine/quarantine_mac.mm b/chromium/content/common/quarantine/quarantine_mac.mm index 8dff600688f..b8302baf779 100644 --- a/chromium/content/common/quarantine/quarantine_mac.mm +++ b/chromium/content/common/quarantine/quarantine_mac.mm @@ -239,7 +239,10 @@ bool AddQuarantineMetadataToFile(const base::FilePath& file, if (@available(macos 10.10, *)) { success = GetQuarantineProperties(file, &properties); } else { +#if !defined(MAC_OS_X_VERSION_10_10) || \ + MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10 success = GetQuarantinePropertiesDeprecated(file, &properties); +#endif } if (!success) @@ -283,7 +286,12 @@ bool AddQuarantineMetadataToFile(const base::FilePath& file, if (@available(macos 10.10, *)) { return SetQuarantineProperties(file, properties); } else { +#if !defined(MAC_OS_X_VERSION_10_10) || \ + MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10 return SetQuarantinePropertiesDeprecated(file, properties); +#else + return false; +#endif } } @@ -317,7 +325,10 @@ bool IsFileQuarantined(const base::FilePath& file, if (@available(macos 10.10, *)) { success = GetQuarantineProperties(file, &properties); } else { +#if !defined(MAC_OS_X_VERSION_10_10) || \ + MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10 success = GetQuarantinePropertiesDeprecated(file, &properties); +#endif } if (!success || !properties) diff --git a/chromium/content/gpu/BUILD.gn b/chromium/content/gpu/BUILD.gn index a5424bb7c11..3faafc288f1 100644 --- a/chromium/content/gpu/BUILD.gn +++ b/chromium/content/gpu/BUILD.gn @@ -101,6 +101,12 @@ target(link_target_type, "gpu_sources") { "//third_party/angle:libEGL", "//third_party/angle:libGLESv2", ] + if (use_qt) { + deps -= [ + "//third_party/angle:libEGL", + "//third_party/angle:libGLESv2", + ] + } } if (use_x11) { diff --git a/chromium/content/gpu/gpu_child_thread.cc b/chromium/content/gpu/gpu_child_thread.cc index 1048a37c9aa..fd662f00492 100644 --- a/chromium/content/gpu/gpu_child_thread.cc +++ b/chromium/content/gpu/gpu_child_thread.cc @@ -17,6 +17,7 @@ #include "build/build_config.h" #include "content/child/child_process.h" #include "content/gpu/gpu_service_factory.h" +#include "content/public/browser/content_browser_client.h" #include "content/public/common/connection_filter.h" #include "content/public/common/content_client.h" #include "content/public/common/content_switches.h" @@ -147,10 +148,13 @@ ui::GpuMain::ExternalDependencies CreateGpuMainDependencies() { } // namespace +GpuChildThread* GpuChildThread::instance_ = 0; + GpuChildThread::GpuChildThread(std::unique_ptr<gpu::GpuInit> gpu_init, ui::GpuMain::LogMessages log_messages) : GpuChildThread(GetOptions(), std::move(gpu_init)) { gpu_main_.SetLogMessagesForHost(std::move(log_messages)); + instance_ = this; } GpuChildThread::GpuChildThread(const InProcessChildThreadParams& params, @@ -173,6 +177,7 @@ GpuChildThread::GpuChildThread(const ChildThreadImpl::Options& options, base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kInProcessGPU)); } + instance_ = this; } GpuChildThread::~GpuChildThread() {} @@ -248,6 +253,10 @@ void GpuChildThread::OnGpuServiceConnection(viz::GpuServiceImpl* gpu_service) { overlay_factory_cb); #endif +#if defined(TOOLKIT_QT) + gpu_channel_manager()->set_share_group(GetContentClient()->browser()->GetInProcessGpuShareGroup()); +#endif + // Only set once per process instance. service_factory_.reset(new GpuServiceFactory( gpu_service->gpu_preferences(), diff --git a/chromium/content/gpu/gpu_child_thread.h b/chromium/content/gpu/gpu_child_thread.h index a1990df78a5..1f13ad042a5 100644 --- a/chromium/content/gpu/gpu_child_thread.h +++ b/chromium/content/gpu/gpu_child_thread.h @@ -57,6 +57,12 @@ class GpuChildThread : public ChildThreadImpl, public ui::GpuMain::Delegate { void Init(const base::Time& process_start_time); + static GpuChildThread* instance() { return instance_; } + + gpu::GpuChannelManager* gpu_channel_manager() { + return gpu_main_.gpu_service()->gpu_channel_manager(); + } + private: GpuChildThread(const ChildThreadImpl::Options& options, std::unique_ptr<gpu::GpuInit> gpu_init); @@ -104,6 +110,8 @@ class GpuChildThread : public ChildThreadImpl, public ui::GpuMain::Delegate { base::WeakPtrFactory<GpuChildThread> weak_factory_; + static GpuChildThread* instance_; + DISALLOW_COPY_AND_ASSIGN(GpuChildThread); }; diff --git a/chromium/content/gpu/gpu_main.cc b/chromium/content/gpu/gpu_main.cc index 556cf00e8ac..4015963ae1b 100644 --- a/chromium/content/gpu/gpu_main.cc +++ b/chromium/content/gpu/gpu_main.cc @@ -226,9 +226,11 @@ int GpuMain(const MainFunctionParams& parameters) { #elif defined(USE_X11) // We need a UI loop so that we can grab the Expose events. See GLSurfaceGLX // and https://crbug.com/326995. +#if !defined(TOOLKIT_QT) ui::SetDefaultX11ErrorHandlers(); if (!gfx::GetXDisplay()) return RESULT_CODE_GPU_DEAD_ON_ARRIVAL; +#endif main_message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); event_source = ui::PlatformEventSource::CreateDefault(); #elif defined(USE_OZONE) diff --git a/chromium/content/public/app/mojo/content_renderer_manifest.json b/chromium/content/public/app/mojo/content_renderer_manifest.json index 1e773f67149..32e2670ac41 100644 --- a/chromium/content/public/app/mojo/content_renderer_manifest.json +++ b/chromium/content/public/app/mojo/content_renderer_manifest.json @@ -15,6 +15,7 @@ "content::mojom::SharedWorkerFactory", "content::mojom::WebDatabase", "IPC::mojom::ChannelBootstrap", + "spellcheck::mojom::SpellChecker", "visitedlink::mojom::VisitedLinkNotificationSink", "web_cache::mojom::WebCache" ], diff --git a/chromium/content/public/browser/browser_context.h b/chromium/content/public/browser/browser_context.h index eff149812e0..3194ecdd5f0 100644 --- a/chromium/content/public/browser/browser_context.h +++ b/chromium/content/public/browser/browser_context.h @@ -17,6 +17,7 @@ #include "base/containers/hash_tables.h" #include "base/memory/linked_ptr.h" #include "base/supports_user_data.h" +#include "components/spellcheck/spellcheck_build_features.h" #include "content/common/content_export.h" #include "net/url_request/url_request_interceptor.h" #include "net/url_request/url_request_job_factory.h" @@ -298,6 +299,11 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { // 2) The embedder saves its salt across restarts. static std::string CreateRandomMediaDeviceIDSalt(); +#if defined(TOOLKIT_QT) && BUILDFLAG(ENABLE_SPELLCHECK) + // Inform about not working dictionary for given language + virtual void FailedToLoadDictionary(const std::string& language) = 0; +#endif + private: const std::string media_device_id_salt_; }; diff --git a/chromium/content/public/browser/content_browser_client.h b/chromium/content/public/browser/content_browser_client.h index 856fb806707..711fa80d0ea 100644 --- a/chromium/content/public/browser/content_browser_client.h +++ b/chromium/content/public/browser/content_browser_client.h @@ -59,6 +59,10 @@ namespace gfx { class ImageSkia; } +namespace gl { +class GLShareGroup; +} + namespace gpu { class GpuChannelEstablishFactory; } @@ -669,6 +673,10 @@ class CONTENT_EXPORT ContentBrowserClient { std::vector<std::unique_ptr<storage::FileSystemBackend>>* additional_backends) {} + // Allow an embedder to provide a share group reimplementation to connect renderer + // GL contexts with the root compositor. + virtual gl::GLShareGroup* GetInProcessGpuShareGroup() { return 0; } + // Creates a new DevToolsManagerDelegate. The caller owns the returned value. // It's valid to return nullptr. virtual DevToolsManagerDelegate* GetDevToolsManagerDelegate(); diff --git a/chromium/content/public/browser/devtools_manager_delegate.h b/chromium/content/public/browser/devtools_manager_delegate.h index 1136340bc13..4c963df1b67 100644 --- a/chromium/content/public/browser/devtools_manager_delegate.h +++ b/chromium/content/public/browser/devtools_manager_delegate.h @@ -17,6 +17,10 @@ namespace base { class DictionaryValue; } +namespace net { +class IPEndPoint; +} + namespace content { class WebContents; @@ -76,6 +80,8 @@ class CONTENT_EXPORT DevToolsManagerDelegate { // clearance from the devtools owners. virtual bool IsBrowserTargetDiscoverable(); + virtual void Initialized(const net::IPEndPoint* ) { } + virtual ~DevToolsManagerDelegate(); }; diff --git a/chromium/content/public/browser/render_frame_host.h b/chromium/content/public/browser/render_frame_host.h index 644b1dd388a..787b72a177e 100644 --- a/chromium/content/public/browser/render_frame_host.h +++ b/chromium/content/public/browser/render_frame_host.h @@ -62,7 +62,8 @@ class CONTENT_EXPORT RenderFrameHost : public IPC::Listener, // Returns nullptr if the IDs do not correspond to a live RenderFrameHost. static RenderFrameHost* FromID(int render_process_id, int render_frame_id); -#if defined(OS_ANDROID) + +#if defined(OS_ANDROID) || defined(TOOLKIT_QT) // Globally allows for injecting JavaScript into the main world. This feature // is present only to support Android WebView and must not be used in other // configurations. diff --git a/chromium/content/public/browser/web_contents.h b/chromium/content/public/browser/web_contents.h index 453942537f6..4a31e7bdbf0 100644 --- a/chromium/content/public/browser/web_contents.h +++ b/chromium/content/public/browser/web_contents.h @@ -758,6 +758,7 @@ class WebContents : public PageNavigator, // view resize. e.g. This will be false when going from tab fullscreen to // browser fullscreen. virtual void ExitFullscreen(bool will_cause_resize) = 0; + virtual void NotifyFullscreenChanged(bool will_cause_resize) = 0; // Unblocks requests from renderer for a newly created window. This is // used in showCreatedWindow() or sometimes later in cases where diff --git a/chromium/content/public/common/BUILD.gn b/chromium/content/public/common/BUILD.gn index 6fd09e08276..d39d1ef926b 100644 --- a/chromium/content/public/common/BUILD.gn +++ b/chromium/content/public/common/BUILD.gn @@ -369,6 +369,8 @@ mojom("interfaces") { "//url/mojo:url_mojom_gurl", "//url/mojo:url_mojom_origin", ] + overridden_deps = [ ] + component_deps = [ "//ui/accessibility:ax_gen" ] component_output_prefix = "content_public_common_mojo_bindings" export_class_attribute = "CONTENT_EXPORT" diff --git a/chromium/content/public/common/common_param_traits_macros.h b/chromium/content/public/common/common_param_traits_macros.h index 90951a5d5e5..3c7ac1f2c6e 100644 --- a/chromium/content/public/common/common_param_traits_macros.h +++ b/chromium/content/public/common/common_param_traits_macros.h @@ -186,6 +186,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences) IPC_STRUCT_TRAITS_MEMBER(strictly_block_blockable_mixed_content) IPC_STRUCT_TRAITS_MEMBER(block_mixed_plugin_content) IPC_STRUCT_TRAITS_MEMBER(enable_scroll_animator) + IPC_STRUCT_TRAITS_MEMBER(enable_error_page) IPC_STRUCT_TRAITS_MEMBER(password_echo_enabled) IPC_STRUCT_TRAITS_MEMBER(should_clear_document_background) IPC_STRUCT_TRAITS_MEMBER(touch_event_feature_detection_enabled) @@ -249,6 +250,8 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences) IPC_STRUCT_TRAITS_MEMBER(css_hex_alpha_color_enabled) IPC_STRUCT_TRAITS_MEMBER(enable_media_download_in_product_help) IPC_STRUCT_TRAITS_MEMBER(scroll_top_left_interop_enabled) +#else // defined(OS_ANDROID) + IPC_STRUCT_TRAITS_MEMBER(fullscreen_supported) #endif // defined(OS_ANDROID) IPC_STRUCT_TRAITS_MEMBER(default_minimum_page_scale_factor) IPC_STRUCT_TRAITS_MEMBER(default_maximum_page_scale_factor) diff --git a/chromium/content/public/common/web_preferences.cc b/chromium/content/public/common/web_preferences.cc index 722afb30f66..1ae6daaa2b5 100644 --- a/chromium/content/public/common/web_preferences.cc +++ b/chromium/content/public/common/web_preferences.cc @@ -136,6 +136,7 @@ WebPreferences::WebPreferences() should_clear_document_background(true), enable_scroll_animator(false), touch_event_feature_detection_enabled(false), + enable_error_page(true), touch_adjustment_enabled(true), pointer_events_max_touch_points(0), available_pointer_types(0), @@ -217,6 +218,8 @@ WebPreferences::WebPreferences() css_hex_alpha_color_enabled(true), enable_media_download_in_product_help(false), scroll_top_left_interop_enabled(true), +#else // defined(OS_ANDROID) + fullscreen_supported(false), #endif // defined(OS_ANDROID) #if defined(OS_ANDROID) default_minimum_page_scale_factor(0.25f), diff --git a/chromium/content/public/common/web_preferences.h b/chromium/content/public/common/web_preferences.h index c81979993ad..1eafcbf118c 100644 --- a/chromium/content/public/common/web_preferences.h +++ b/chromium/content/public/common/web_preferences.h @@ -175,6 +175,7 @@ struct CONTENT_EXPORT WebPreferences { bool should_clear_document_background; bool enable_scroll_animator; bool touch_event_feature_detection_enabled; + bool enable_error_page; bool touch_adjustment_enabled; int pointer_events_max_touch_points; int available_pointer_types; @@ -269,6 +270,7 @@ struct CONTENT_EXPORT WebPreferences { // (http://crbug.com/761016). bool scroll_top_left_interop_enabled; #else // defined(OS_ANDROID) + bool fullscreen_supported; #endif // defined(OS_ANDROID) // Default (used if the page or UA doesn't override these) values for page diff --git a/chromium/content/public/renderer/render_frame.h b/chromium/content/public/renderer/render_frame.h index 6ba116cc4cd..ce4893ad949 100644 --- a/chromium/content/public/renderer/render_frame.h +++ b/chromium/content/public/renderer/render_frame.h @@ -228,7 +228,8 @@ class CONTENT_EXPORT RenderFrame : public IPC::Listener, // Notifies the browser of text selection changes made. virtual void SetSelectedText(const base::string16& selection_text, size_t offset, - const gfx::Range& range) = 0; + const gfx::Range& range, + bool user_initiated) = 0; // Ensures that builtin mojo bindings modules are available in |context|. virtual void EnsureMojoBuiltinsAreAvailable( diff --git a/chromium/content/renderer/BUILD.gn b/chromium/content/renderer/BUILD.gn index 98599431899..d2f5c749adb 100644 --- a/chromium/content/renderer/BUILD.gn +++ b/chromium/content/renderer/BUILD.gn @@ -517,7 +517,7 @@ target(link_target_type, "renderer") { ] allow_circular_includes_from = [] - if (use_aura) { + if (use_aura && !use_qt) { public_deps += [ "//content/renderer/mus" ] allow_circular_includes_from += [ "//content/renderer/mus" ] deps += [ "//services/ui/public/cpp" ] diff --git a/chromium/content/renderer/accessibility/render_accessibility_impl.cc b/chromium/content/renderer/accessibility/render_accessibility_impl.cc index 903ae5172b3..39f16a66f0f 100644 --- a/chromium/content/renderer/accessibility/render_accessibility_impl.cc +++ b/chromium/content/renderer/accessibility/render_accessibility_impl.cc @@ -439,7 +439,7 @@ void RenderAccessibilityImpl::SendPendingAccessibilityEvents() { dst.transform.reset(new gfx::Transform(*src.transform)); } - VLOG(1) << "Accessibility event: " << ui::ToString(event.event_type) + DVLOG(1) << "Accessibility event: " << ui::ToString(event.event_type) << " on node id " << event_msg.id << "\n" << event_msg.update.ToString(); } diff --git a/chromium/content/renderer/input/frame_input_handler_impl.cc b/chromium/content/renderer/input/frame_input_handler_impl.cc index 95989263dd0..6e75e0f1062 100644 --- a/chromium/content/renderer/input/frame_input_handler_impl.cc +++ b/chromium/content/renderer/input/frame_input_handler_impl.cc @@ -225,7 +225,7 @@ void FrameInputHandlerImpl::Replace(const base::string16& word) { if (frame->HasSelection()) frame->SelectWordAroundCaret(); frame->ReplaceSelection(blink::WebString::FromUTF16(word)); - render_frame_->SyncSelectionIfRequired(); + render_frame_->SyncSelectionIfRequired(word.empty(), true); } void FrameInputHandlerImpl::ReplaceMisspelling(const base::string16& word) { diff --git a/chromium/content/renderer/input/render_widget_input_handler.cc b/chromium/content/renderer/input/render_widget_input_handler.cc index 49102e04948..6c74b4da1ed 100644 --- a/chromium/content/renderer/input/render_widget_input_handler.cc +++ b/chromium/content/renderer/input/render_widget_input_handler.cc @@ -145,7 +145,8 @@ RenderWidgetInputHandler::RenderWidgetInputHandler( handling_input_event_(false), handling_event_overscroll_(nullptr), handling_event_type_(WebInputEvent::kUndefined), - suppress_next_char_events_(false) { + suppress_next_char_events_(false), + ime_composition_replacement_(false) { DCHECK(delegate); DCHECK(widget); delegate->SetInputHandler(this); diff --git a/chromium/content/renderer/input/render_widget_input_handler.h b/chromium/content/renderer/input/render_widget_input_handler.h index 453ac9f0ae3..57b27913e73 100644 --- a/chromium/content/renderer/input/render_widget_input_handler.h +++ b/chromium/content/renderer/input/render_widget_input_handler.h @@ -61,6 +61,13 @@ class CONTENT_EXPORT RenderWidgetInputHandler { // to the browser. bool ProcessTouchAction(cc::TouchAction touch_action); + bool ime_composition_replacement() const { + return ime_composition_replacement_; + } + void set_ime_composition_replacement(bool ime_composition_replacement) { + ime_composition_replacement_ = ime_composition_replacement; + } + private: RenderWidgetInputHandlerDelegate* const delegate_; @@ -83,6 +90,10 @@ class CONTENT_EXPORT RenderWidgetInputHandler { // Indicates if the next sequence of Char events should be suppressed or not. bool suppress_next_char_events_; + // Used to suppress notification about text selection changes triggered by + // IME composition when it replaces text. + bool ime_composition_replacement_; + DISALLOW_COPY_AND_ASSIGN(RenderWidgetInputHandler); }; diff --git a/chromium/content/renderer/pepper/pepper_plugin_instance_impl.cc b/chromium/content/renderer/pepper/pepper_plugin_instance_impl.cc index 7486abc505a..b705a094def 100644 --- a/chromium/content/renderer/pepper/pepper_plugin_instance_impl.cc +++ b/chromium/content/renderer/pepper/pepper_plugin_instance_impl.cc @@ -1387,7 +1387,7 @@ void PepperPluginInstanceImpl::SetSelectedText( selected_text_ = selected_text; gfx::Range range(0, selected_text.length()); - render_frame_->SetSelectedText(selected_text, 0, range); + render_frame_->SetSelectedText(selected_text, 0, range, true); } void PepperPluginInstanceImpl::SetLinkUnderCursor(const std::string& url) { diff --git a/chromium/content/renderer/render_frame_impl.cc b/chromium/content/renderer/render_frame_impl.cc index f1f58918685..3c470475c52 100644 --- a/chromium/content/renderer/render_frame_impl.cc +++ b/chromium/content/renderer/render_frame_impl.cc @@ -1444,7 +1444,7 @@ void RenderFrameImpl::PepperSelectionChanged( PepperPluginInstanceImpl* instance) { if (instance != focused_pepper_plugin_) return; - SyncSelectionIfRequired(); + SyncSelectionIfRequired(false, true /* user_initiated */); } RenderWidgetFullscreenPepper* RenderFrameImpl::CreatePepperFullscreenContainer( @@ -2066,7 +2066,7 @@ void RenderFrameImpl::OnReplace(const base::string16& text) { frame_->SelectWordAroundCaret(); frame_->ReplaceSelection(WebString::FromUTF16(text)); - SyncSelectionIfRequired(); + SyncSelectionIfRequired(false, true /* user_initiated */); } void RenderFrameImpl::OnReplaceMisspelling(const base::string16& text) { @@ -2799,9 +2799,11 @@ void RenderFrameImpl::DetachGuest(int element_instance_id) { void RenderFrameImpl::SetSelectedText(const base::string16& selection_text, size_t offset, - const gfx::Range& range) { + const gfx::Range& range, + bool user_initiated) { Send(new FrameHostMsg_SelectionChanged(routing_id_, selection_text, - static_cast<uint32_t>(offset), range)); + static_cast<uint32_t>(offset), range, + user_initiated)); } void RenderFrameImpl::EnsureMojoBuiltinsAreAvailable( @@ -4189,12 +4191,20 @@ void RenderFrameImpl::AbortClientNavigation() { } void RenderFrameImpl::DidChangeSelection(bool is_empty_selection) { - if (!GetRenderWidget()->input_handler().handling_input_event() && - !handling_select_range_) - return; + bool user_initiated = + GetRenderWidget()->input_handler().handling_input_event() || + handling_select_range_; + + if (!user_initiated) { + // Do not update text input state unnecessarily when text selection remains + // empty. + if (is_empty_selection && selection_text_.empty()) + return; - if (is_empty_selection) - selection_text_.clear(); + // Ignore selection change of text replacement triggered by IME composition. + if (GetRenderWidget()->input_handler().ime_composition_replacement()) + return; + } // UpdateTextInputState should be called before SyncSelectionIfRequired. // UpdateTextInputState may send TextInputStateChanged to notify the focus @@ -4202,7 +4212,7 @@ void RenderFrameImpl::DidChangeSelection(bool is_empty_selection) { // to notify the selection was changed. Focus change should be notified // before selection change. GetRenderWidget()->UpdateTextInputState(); - SyncSelectionIfRequired(); + SyncSelectionIfRequired(is_empty_selection, user_initiated); } bool RenderFrameImpl::HandleCurrentKeyboardEvent() { @@ -6357,10 +6367,11 @@ void RenderFrameImpl::UpdateEncoding(WebFrame* frame, Send(new FrameHostMsg_UpdateEncoding(routing_id_, encoding_name)); } -void RenderFrameImpl::SyncSelectionIfRequired() { +void RenderFrameImpl::SyncSelectionIfRequired(bool is_empty_selection, + bool user_initiated) { base::string16 text; - size_t offset; - gfx::Range range; + size_t offset = 0; + gfx::Range range = gfx::Range::InvalidRange(); #if BUILDFLAG(ENABLE_PLUGINS) if (focused_pepper_plugin_) { focused_pepper_plugin_->GetSurroundingText(&text, &range); @@ -6368,34 +6379,40 @@ void RenderFrameImpl::SyncSelectionIfRequired() { // TODO(kinaba): cut as needed. } else #endif - { + if (!is_empty_selection) { WebRange selection = frame_->GetInputMethodController()->GetSelectionOffsets(); - if (selection.IsNull()) - return; - - range = gfx::Range(selection.StartOffset(), selection.EndOffset()); - if (frame_->GetInputMethodController()->TextInputType() != - blink::kWebTextInputTypeNone) { - // If current focused element is editable, we will send 100 more chars - // before and after selection. It is for input method surrounding text - // feature. - if (selection.StartOffset() > kExtraCharsBeforeAndAfterSelection) - offset = selection.StartOffset() - kExtraCharsBeforeAndAfterSelection; - else - offset = 0; - size_t length = - selection.EndOffset() - offset + kExtraCharsBeforeAndAfterSelection; - text = frame_->RangeAsText(WebRange(offset, length)).Utf16(); - } else { - offset = selection.StartOffset(); - text = frame_->SelectionAsText().Utf16(); - // http://crbug.com/101435 - // In some case, frame->selectionAsText() returned text's length is not - // equal to the length returned from frame_->GetSelectionOffsets(). So we - // have to set the range according to text.length(). - range.set_end(range.start() + text.length()); + // When clearing text selection from JavaScript the selection range + // might be null but the selected text still have to be updated. + // Do not cancel sync selection if the clear was not user initiated. + if (!selection.IsNull()) { + range = gfx::Range(selection.StartOffset(), selection.EndOffset()); + + if (frame_->GetInputMethodController()->TextInputType() != + blink::kWebTextInputTypeNone) { + // If current focused element is editable, we will send 100 more chars + // before and after selection. It is for input method surrounding text + // feature. + if (selection.StartOffset() > kExtraCharsBeforeAndAfterSelection) + offset = selection.StartOffset() - kExtraCharsBeforeAndAfterSelection; + else + offset = 0; + size_t length = + selection.EndOffset() - offset + kExtraCharsBeforeAndAfterSelection; + text = frame_->RangeAsText(WebRange(offset, length)).Utf16(); + } else { + offset = selection.StartOffset(); + text = frame_->SelectionAsText().Utf16(); + // http://crbug.com/101435 + // In some case, frame->selectionAsText() returned text's length is not + // equal to the length returned from + // GetWebWidget()->caretOrSelectionRange(). + // So we have to set the range according to text.length(). + range.set_end(range.start() + text.length()); + } + } else if (user_initiated) { + return; } } @@ -6411,7 +6428,7 @@ void RenderFrameImpl::SyncSelectionIfRequired() { selection_text_ = text; selection_text_offset_ = offset; selection_range_ = range; - SetSelectedText(text, offset, range); + SetSelectedText(text, offset, range, user_initiated); } GetRenderWidget()->UpdateSelectionBounds(); } diff --git a/chromium/content/renderer/render_frame_impl.h b/chromium/content/renderer/render_frame_impl.h index 981e06445a6..3f28118cd6b 100644 --- a/chromium/content/renderer/render_frame_impl.h +++ b/chromium/content/renderer/render_frame_impl.h @@ -476,7 +476,8 @@ class CONTENT_EXPORT RenderFrameImpl void DetachGuest(int element_instance_id) override; void SetSelectedText(const base::string16& selection_text, size_t offset, - const gfx::Range& range) override; + const gfx::Range& range, + bool user_initiated) override; void EnsureMojoBuiltinsAreAvailable(v8::Isolate* isolate, v8::Local<v8::Context> context) override; void AddMessageToConsole(ConsoleMessageLevel level, @@ -809,7 +810,7 @@ class CONTENT_EXPORT RenderFrameImpl // it has changed. // TODO(varunjain): delete this method once we figure out how to keep // selection handles in sync with the webpage. - void SyncSelectionIfRequired(); + void SyncSelectionIfRequired(bool is_empty_selection, bool user_initiated); // Sets the custom URLLoaderFactory instance to be used for network requests. void SetCustomURLLoadeFactory( diff --git a/chromium/content/renderer/render_frame_proxy.cc b/chromium/content/renderer/render_frame_proxy.cc index 1f4034bc3b7..fc954228f03 100644 --- a/chromium/content/renderer/render_frame_proxy.cc +++ b/chromium/content/renderer/render_frame_proxy.cc @@ -40,7 +40,7 @@ #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" #include "third_party/WebKit/public/web/WebView.h" -#if defined(USE_AURA) +#if defined(USE_AURA) && !defined(TOOLKIT_QT) #include "content/renderer/mus/renderer_window_tree_client.h" #endif @@ -226,7 +226,7 @@ void RenderFrameProxy::Init(blink::WebRemoteFrame* web_frame, compositing_helper_.reset( ChildFrameCompositingHelper::CreateForRenderFrameProxy(this)); -#if defined(USE_AURA) +#if defined(USE_AURA) && !defined(TOOLKIT_QT) if (IsRunningInMash()) { RendererWindowTreeClient* renderer_window_tree_client = RendererWindowTreeClient::Get(render_widget_->routing_id()); @@ -473,7 +473,7 @@ void RenderFrameProxy::OnSetHasReceivedUserGesture() { web_frame_->SetHasReceivedUserGesture(); } -#if defined(USE_AURA) +#if defined(USE_AURA) && !defined(TOOLKIT_QT) void RenderFrameProxy::OnMusFrameSinkIdAllocated( const viz::FrameSinkId& frame_sink_id) { frame_sink_id_ = frame_sink_id; @@ -490,7 +490,7 @@ void RenderFrameProxy::SetMusEmbeddedFrame( #endif void RenderFrameProxy::FrameDetached(DetachType type) { -#if defined(USE_AURA) +#if defined(USE_AURA) && !defined(TOOLKIT_QT) mus_embedded_frame_.reset(); #endif @@ -578,7 +578,7 @@ void RenderFrameProxy::Navigate(const blink::WebURLRequest& request, void RenderFrameProxy::FrameRectsChanged(const blink::WebRect& frame_rect) { gfx::Rect rect = frame_rect; const bool did_size_change = frame_rect_.size() != rect.size(); -#if defined(USE_AURA) +#if defined(USE_AURA) && !defined(TOOLKIT_QT) const bool did_rect_change = did_size_change || frame_rect_ != rect; #endif @@ -589,7 +589,7 @@ void RenderFrameProxy::FrameRectsChanged(const blink::WebRect& frame_rect) { MaybeUpdateCompositingHelper(); } -#if defined(USE_AURA) +#if defined(USE_AURA) && !defined(TOOLKIT_QT) if (did_rect_change && mus_embedded_frame_) mus_embedded_frame_->SetWindowBounds(local_surface_id_, rect); #endif diff --git a/chromium/content/renderer/render_frame_proxy.h b/chromium/content/renderer/render_frame_proxy.h index 96095b41321..c58a4a91ffd 100644 --- a/chromium/content/renderer/render_frame_proxy.h +++ b/chromium/content/renderer/render_frame_proxy.h @@ -37,7 +37,7 @@ struct ContentSecurityPolicyHeader; struct FrameOwnerProperties; struct FrameReplicationState; -#if defined(USE_AURA) +#if defined(USE_AURA) && !defined(TOOLKIT_QT) class MusEmbeddedFrame; #endif @@ -133,7 +133,7 @@ class CONTENT_EXPORT RenderFrameProxy : public IPC::Listener, // Returns the widget used for the local frame root. RenderWidget* render_widget() { return render_widget_; } -#if defined(USE_AURA) +#if defined(USE_AURA) && !defined(TOOLKIT_QT) // Called when mus determines the FrameSinkId. void OnMusFrameSinkIdAllocated(const viz::FrameSinkId& frame_sink_id); @@ -225,7 +225,7 @@ class CONTENT_EXPORT RenderFrameProxy : public IPC::Listener, bool enable_surface_synchronization_ = false; -#if defined(USE_AURA) +#if defined(USE_AURA) && !defined(TOOLKIT_QT) std::unique_ptr<MusEmbeddedFrame> mus_embedded_frame_; #endif diff --git a/chromium/content/renderer/render_thread_impl.cc b/chromium/content/renderer/render_thread_impl.cc index 13eeab3a946..1c526d196d1 100644 --- a/chromium/content/renderer/render_thread_impl.cc +++ b/chromium/content/renderer/render_thread_impl.cc @@ -748,7 +748,7 @@ void RenderThreadImpl::Init( // Register exported services: -#if defined(USE_AURA) +#if defined(USE_AURA) && !defined(TOOLKIT_QT) if (IsRunningInMash()) { CreateRenderWidgetWindowTreeClientFactory(GetServiceManagerConnection()); } @@ -905,7 +905,7 @@ void RenderThreadImpl::Init( discardable_memory::mojom::DiscardableSharedMemoryManagerPtr manager_ptr; if (IsRunningInMash()) { -#if defined(USE_AURA) +#if defined(USE_AURA) && !defined(TOOLKIT_QT) GetServiceManagerConnection()->GetConnector()->BindInterface( ui::mojom::kServiceName, &manager_ptr); #else @@ -1951,7 +1951,7 @@ void RenderThreadImpl::RequestNewLayerTreeFrameSink( params.synthetic_begin_frame_source = CreateSyntheticBeginFrameSource(); } -#if defined(USE_AURA) +#if defined(USE_AURA) && !defined(TOOLKIT_QT) if (!use_software && IsRunningInMash()) { if (!RendererWindowTreeClient::Get(routing_id)) { callback.Run(nullptr); diff --git a/chromium/content/renderer/render_view_impl.cc b/chromium/content/renderer/render_view_impl.cc index 22bd13a28fb..73528f7d8be 100644 --- a/chromium/content/renderer/render_view_impl.cc +++ b/chromium/content/renderer/render_view_impl.cc @@ -974,6 +974,8 @@ void RenderView::ApplyWebPreferences(const WebPreferences& prefs, WebRuntimeFeatures::EnableCSSHexAlphaColor(prefs.css_hex_alpha_color_enabled); WebRuntimeFeatures::EnableScrollTopLeftInterop( prefs.scroll_top_left_interop_enabled); +#else // defined(OS_ANDROID) + settings->SetFullscreenSupported(prefs.fullscreen_supported); #endif // defined(OS_ANDROID) switch (prefs.autoplay_policy) { @@ -1072,8 +1074,6 @@ blink::WebView* RenderViewImpl::webview() const { return webview_; } -#if BUILDFLAG(ENABLE_PLUGINS) - #if defined(OS_MACOSX) void RenderViewImpl::OnGetRenderedText() { if (!webview()) @@ -1099,8 +1099,6 @@ void RenderViewImpl::OnGetRenderedText() { } #endif // defined(OS_MACOSX) -#endif // ENABLE_PLUGINS - // RenderWidgetInputHandlerDelegate ----------------------------------------- bool RenderViewImpl::DoesRenderWidgetHaveTouchEventHandlersAt( diff --git a/chromium/content/renderer/render_widget.cc b/chromium/content/renderer/render_widget.cc index 2d5fe563da6..7efce0abf8e 100644 --- a/chromium/content/renderer/render_widget.cc +++ b/chromium/content/renderer/render_widget.cc @@ -401,7 +401,7 @@ RenderWidget::RenderWidget(int32_t widget_routing_id, ->NewRenderWidgetSchedulingState(); render_widget_scheduling_state_->SetHidden(is_hidden_); } -#if defined(USE_AURA) +#if defined(USE_AURA) && !defined(TOOLKIT_QT) RendererWindowTreeClient::CreateIfNecessary(routing_id_); if (IsRunningInMash()) RendererWindowTreeClient::Get(routing_id_)->SetVisible(!is_hidden_); @@ -417,7 +417,7 @@ RenderWidget::~RenderWidget() { // If we are swapped out, we have released already. if (!is_swapped_out_ && RenderProcess::current()) RenderProcess::current()->ReleaseProcess(); -#if defined(USE_AURA) +#if defined(USE_AURA) && !defined(TOOLKIT_QT) // It is possible for a RenderWidget to be destroyed before it was embedded // in a mus window. The RendererWindowTreeClient will leak in such cases. So // explicitly delete it here. @@ -1684,6 +1684,7 @@ void RenderWidget::OnImeSetComposition( } #endif ImeEventGuard guard(this); + input_handler_->set_ime_composition_replacement(replacement_range.IsValid()); blink::WebInputMethodController* controller = GetInputMethodController(); if (!controller || !controller->SetComposition( @@ -1703,6 +1704,7 @@ void RenderWidget::OnImeSetComposition( Send(new InputHostMsg_ImeCancelComposition(routing_id())); } } + input_handler_->set_ime_composition_replacement(false); UpdateCompositionInfo(false /* not an immediate request */); } @@ -2041,7 +2043,7 @@ void RenderWidget::SetHidden(bool hidden) { // throttled acks are released in case frame production ceases. is_hidden_ = hidden; -#if defined(USE_AURA) +#if defined(USE_AURA) && !defined(TOOLKIT_QT) if (IsRunningInMash()) RendererWindowTreeClient::Get(routing_id_)->SetVisible(!hidden); #endif diff --git a/chromium/content/shell/BUILD.gn b/chromium/content/shell/BUILD.gn index 825408259d7..bd04a40d3e8 100644 --- a/chromium/content/shell/BUILD.gn +++ b/chromium/content/shell/BUILD.gn @@ -461,6 +461,15 @@ repack("pak") { "//ui/strings", ] + if (use_qt) { + sources -= [ + "$root_gen_dir/content/browser/tracing/tracing_resources.pak", + ] + deps -= [ + "//content/browser/tracing:resources", + ] + } + if (toolkit_views) { deps += [ "//ui/views/resources" ] sources += diff --git a/chromium/content/zygote/zygote_main_linux.cc b/chromium/content/zygote/zygote_main_linux.cc index df207993b23..325df0f94af 100644 --- a/chromium/content/zygote/zygote_main_linux.cc +++ b/chromium/content/zygote/zygote_main_linux.cc @@ -258,8 +258,6 @@ static void InitLibcLocaltimeFunctions() { // references to localtime() will resolve to this function. Notice that we need // to set visibility attribute to "default" to export the symbol, as it is set // to "hidden" by default in chrome per build/common.gypi. -__attribute__ ((__visibility__("default"))) -struct tm* localtime_override(const time_t* timep) __asm__ ("localtime"); __attribute__ ((__visibility__("default"))) struct tm* localtime_override(const time_t* timep) { @@ -281,10 +279,6 @@ struct tm* localtime_override(const time_t* timep) { return res; } -// Use same trick to override localtime64(), localtime_r() and localtime64_r(). -__attribute__ ((__visibility__("default"))) -struct tm* localtime64_override(const time_t* timep) __asm__ ("localtime64"); - __attribute__ ((__visibility__("default"))) struct tm* localtime64_override(const time_t* timep) { if (g_am_zygote_or_renderer && g_use_localtime_override) { @@ -306,10 +300,6 @@ struct tm* localtime64_override(const time_t* timep) { } __attribute__ ((__visibility__("default"))) -struct tm* localtime_r_override(const time_t* timep, - struct tm* result) __asm__ ("localtime_r"); - -__attribute__ ((__visibility__("default"))) struct tm* localtime_r_override(const time_t* timep, struct tm* result) { if (g_am_zygote_or_renderer && g_use_localtime_override) { ProxyLocaltimeCallToBrowser(*timep, result, NULL, 0); @@ -327,10 +317,6 @@ struct tm* localtime_r_override(const time_t* timep, struct tm* result) { } __attribute__ ((__visibility__("default"))) -struct tm* localtime64_r_override(const time_t* timep, - struct tm* result) __asm__ ("localtime64_r"); - -__attribute__ ((__visibility__("default"))) struct tm* localtime64_r_override(const time_t* timep, struct tm* result) { if (g_am_zygote_or_renderer && g_use_localtime_override) { ProxyLocaltimeCallToBrowser(*timep, result, NULL, 0); diff --git a/chromium/crypto/nss_util.cc b/chromium/crypto/nss_util.cc index e5a6d6f68f5..ad58f137403 100644 --- a/chromium/crypto/nss_util.cc +++ b/chromium/crypto/nss_util.cc @@ -622,13 +622,16 @@ class NSSInitSingleton { EnsureNSPRInit(); - // We *must* have NSS >= 3.26 at compile time. - static_assert((NSS_VMAJOR == 3 && NSS_VMINOR >= 26) || (NSS_VMAJOR > 3), - "nss version check failed"); + // We *must* have NSS >= 3.14.3. + static_assert( + (NSS_VMAJOR == 3 && NSS_VMINOR == 14 && NSS_VPATCH >= 3) || + (NSS_VMAJOR == 3 && NSS_VMINOR > 14) || + (NSS_VMAJOR > 3), + "nss version check failed"); // Also check the run-time NSS version. // NSS_VersionCheck is a >= check, not strict equality. - if (!NSS_VersionCheck("3.26")) { - LOG(FATAL) << "NSS_VersionCheck(\"3.26\") failed. NSS >= 3.26 is " + if (!NSS_VersionCheck("3.14.3")) { + LOG(FATAL) << "NSS_VersionCheck(\"3.14.3\") failed. NSS >= 3.14.3 is " "required. Please upgrade to the latest NSS, and if you " "still get this error, contact your distribution " "maintainer."; diff --git a/chromium/crypto/scoped_test_nss_db.cc b/chromium/crypto/scoped_test_nss_db.cc index 03470c13037..b334109e034 100644 --- a/chromium/crypto/scoped_test_nss_db.cc +++ b/chromium/crypto/scoped_test_nss_db.cc @@ -44,6 +44,15 @@ ScopedTestNSSDB::~ScopedTestNSSDB() { CERT_DestroyCertList(cert_list); } + // Don't close when NSS is < 3.15.1, because it would require an additional + // sleep for 1 second after closing the database, due to + // http://bugzil.la/875601. + if (!NSS_VersionCheck("3.15.1")) { + LOG(ERROR) << "NSS version is < 3.15.1, test DB will not be closed."; + temp_dir_.Take(); + return; + } + // NSS is allowed to do IO on the current thread since dispatching // to a dedicated thread would still have the affect of blocking // the current thread, due to NSS's internal locking requirements diff --git a/chromium/device/bluetooth/BUILD.gn b/chromium/device/bluetooth/BUILD.gn index e0d141b2df2..fb324999140 100644 --- a/chromium/device/bluetooth/BUILD.gn +++ b/chromium/device/bluetooth/BUILD.gn @@ -228,7 +228,8 @@ component("bluetooth") { } if (is_chromeos || is_linux) { - if (use_dbus) { + if (use_dbus && is_chromeos) { + # This crap uses ChromeOS specific system API sources += [ "bluez/bluetooth_adapter_bluez.cc", "bluez/bluetooth_adapter_bluez.h", diff --git a/chromium/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm b/chromium/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm index 1131a84a144..4f54a4963b9 100644 --- a/chromium/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm +++ b/chromium/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm @@ -386,7 +386,7 @@ void BluetoothRemoteGattCharacteristicMac::DidDiscoverDescriptors() { new BluetoothRemoteGattDescriptorMac(this, cb_descriptor); const std::string& identifier = gatt_descriptor_mac->GetIdentifier(); auto result_iter = gatt_descriptor_macs_.insert( - {identifier, base::WrapUnique(gatt_descriptor_mac)}); + std::make_pair(identifier, base::WrapUnique(gatt_descriptor_mac))); DCHECK(result_iter.second); GetMacAdapter()->NotifyGattDescriptorAdded(gatt_descriptor_mac); VLOG(1) << *gatt_descriptor_mac << ": New descriptor."; diff --git a/chromium/device/bluetooth/bluetooth_remote_gatt_service_mac.mm b/chromium/device/bluetooth/bluetooth_remote_gatt_service_mac.mm index 613f4dce767..67585812a41 100644 --- a/chromium/device/bluetooth/bluetooth_remote_gatt_service_mac.mm +++ b/chromium/device/bluetooth/bluetooth_remote_gatt_service_mac.mm @@ -115,9 +115,11 @@ void BluetoothRemoteGattServiceMac::DidDiscoverCharacteristics() { } gatt_characteristic_mac = new BluetoothRemoteGattCharacteristicMac(this, cb_characteristic); - const std::string& identifier = gatt_characteristic_mac->GetIdentifier(); - auto result_iter = gatt_characteristic_macs_.insert( - {identifier, base::WrapUnique(gatt_characteristic_mac)}); + const std::string identifier = gatt_characteristic_mac->GetIdentifier(); + std::unordered_map<std::string, + std::unique_ptr<BluetoothRemoteGattCharacteristicMac>>::value_type value = +{identifier, base::WrapUnique(gatt_characteristic_mac)}; + auto result_iter = gatt_characteristic_macs_.insert(std::move(value)); DCHECK(result_iter.second); VLOG(1) << *gatt_characteristic_mac << ": New characteristic, properties " << gatt_characteristic_mac->GetProperties(); diff --git a/chromium/extensions/BUILD.gn b/chromium/extensions/BUILD.gn index 6b256eddffe..db7613cf7ee 100644 --- a/chromium/extensions/BUILD.gn +++ b/chromium/extensions/BUILD.gn @@ -356,4 +356,9 @@ source_set("chrome_extensions_interactive_uitests") { "//ui/resources:ui_test_pak", "//ui/web_dialogs:test_support", ] + if (use_qt) { + deps -= [ + "//chrome/test:test_support", + ] + } } diff --git a/chromium/gpu/command_buffer/client/share_group.h b/chromium/gpu/command_buffer/client/share_group.h index fe37ddaff32..7066bb5fd7c 100644 --- a/chromium/gpu/command_buffer/client/share_group.h +++ b/chromium/gpu/command_buffer/client/share_group.h @@ -5,7 +5,6 @@ #ifndef GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_ #define GPU_COMMAND_BUFFER_CLIENT_SHARE_GROUP_H_ -#include <GLES2/gl2.h> #include <stdint.h> #include <memory> diff --git a/chromium/gpu/command_buffer/service/texture_manager.h b/chromium/gpu/command_buffer/service/texture_manager.h index 77b7e7fef5c..232869b9c97 100644 --- a/chromium/gpu/command_buffer/service/texture_manager.h +++ b/chromium/gpu/command_buffer/service/texture_manager.h @@ -18,8 +18,8 @@ #include "base/containers/hash_tables.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "gpu/command_buffer/service/feature_info.h" #include "gpu/command_buffer/service/gl_utils.h" +#include "gpu/command_buffer/service/feature_info.h" #include "gpu/command_buffer/service/memory_tracking.h" #include "gpu/command_buffer/service/sampler_manager.h" #include "gpu/gpu_export.h" diff --git a/chromium/gpu/config/gpu_control_list.cc b/chromium/gpu/config/gpu_control_list.cc index 4174e141d35..b64dcb62dbe 100644 --- a/chromium/gpu/config/gpu_control_list.cc +++ b/chromium/gpu/config/gpu_control_list.cc @@ -98,7 +98,7 @@ int CompareLexicalNumberStrings( bool StringMismatch(const std::string& input, const std::string& pattern) { if (input.empty() || pattern.empty()) return false; - return !RE2::FullMatch(input, pattern); + return !RE2::FullMatch(input, re2::StringPiece(pattern)); } bool StringMismatch(const std::string& input, const char* pattern) { diff --git a/chromium/gpu/config/software_rendering_list.json b/chromium/gpu/config/software_rendering_list.json index a9b5790db96..8fa23ed0aa1 100644 --- a/chromium/gpu/config/software_rendering_list.json +++ b/chromium/gpu/config/software_rendering_list.json @@ -288,10 +288,6 @@ "vendor_id": "0x10de", "gl_vendor": "(?i)nouveau.*", "driver_vendor": "Mesa", - "driver_version": { - "op": "<", - "value": "10.1" - }, "features": [ "all" ] @@ -639,6 +635,15 @@ "value": "6.0" } }, + "exceptions": [ + { + "driver_vendor": "Mesa", + "gl_renderer": ".*Gallium.*" + }, + { + "driver_vendor": ".*llvmpipe.*" + } + ], "features": [ "all" ] diff --git a/chromium/gpu/ipc/service/BUILD.gn b/chromium/gpu/ipc/service/BUILD.gn index 983715b6773..9d3d98b884c 100644 --- a/chromium/gpu/ipc/service/BUILD.gn +++ b/chromium/gpu/ipc/service/BUILD.gn @@ -88,6 +88,12 @@ target(link_target_type, "ipc_service_sources") { "direct_composition_surface_win.h", "image_transport_surface_win.cc", ] + if (use_qt) { + sources -= [ + "direct_composition_surface_win.cc", + "direct_composition_surface_win.h", + ] + } libs += [ "dwmapi.lib" ] } if (is_mac) { diff --git a/chromium/gpu/ipc/service/gpu_channel_manager.cc b/chromium/gpu/ipc/service/gpu_channel_manager.cc index b14622c664f..c8b32efebf2 100644 --- a/chromium/gpu/ipc/service/gpu_channel_manager.cc +++ b/chromium/gpu/ipc/service/gpu_channel_manager.cc @@ -143,6 +143,10 @@ GpuChannel* GpuChannelManager::LookupChannel(int32_t client_id) const { return it != gpu_channels_.end() ? it->second.get() : nullptr; } +void GpuChannelManager::set_share_group(gl::GLShareGroup* share_group) { + share_group_ = share_group; +} + GpuChannel* GpuChannelManager::EstablishChannel(int client_id, uint64_t client_tracing_id, bool is_gpu_host) { diff --git a/chromium/gpu/ipc/service/gpu_channel_manager.h b/chromium/gpu/ipc/service/gpu_channel_manager.h index 4a4e133b8bf..5182f7e7726 100644 --- a/chromium/gpu/ipc/service/gpu_channel_manager.h +++ b/chromium/gpu/ipc/service/gpu_channel_manager.h @@ -140,6 +140,7 @@ class GPU_EXPORT GpuChannelManager { gles2::MailboxManager* mailbox_manager() { return mailbox_manager_.get(); } gl::GLShareGroup* share_group() const { return share_group_.get(); } + void set_share_group(gl::GLShareGroup* share_group); SyncPointManager* sync_point_manager() const { return sync_point_manager_; } diff --git a/chromium/gpu/ipc/service/gpu_init.cc b/chromium/gpu/ipc/service/gpu_init.cc index d799b62552f..575fa64a2f4 100644 --- a/chromium/gpu/ipc/service/gpu_init.cc +++ b/chromium/gpu/ipc/service/gpu_init.cc @@ -30,7 +30,7 @@ #include "ui/ozone/public/ozone_platform.h" #endif -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) #include "gpu/ipc/service/direct_composition_surface_win.h" #endif @@ -62,7 +62,7 @@ void CollectGraphicsInfo(GPUInfo* gpu_info) { break; } -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2 && gl::GLSurfaceEGL::IsDirectCompositionSupported() && DirectCompositionSurfaceWin::AreOverlaysSupported()) { diff --git a/chromium/headless/BUILD.gn b/chromium/headless/BUILD.gn index e93546c4b99..8514fb3d17e 100644 --- a/chromium/headless/BUILD.gn +++ b/chromium/headless/BUILD.gn @@ -68,6 +68,15 @@ repack("pak") { "//ui/strings", ] + if (use_qt) { + sources -= [ + "$root_gen_dir/content/browser/tracing/tracing_resources.pak", + ] + deps -= [ + "//content/browser/tracing:resources", + ] + } + output = "$root_out_dir/headless_lib.pak" } diff --git a/chromium/ipc/ipc_message_start.h b/chromium/ipc/ipc_message_start.h index a57e618f003..1303a057454 100644 --- a/chromium/ipc/ipc_message_start.h +++ b/chromium/ipc/ipc_message_start.h @@ -13,6 +13,7 @@ // for all new work. enum IPCMessageStart { AutomationMsgStart = 0, + QtMsgStart, FrameMsgStart, PageMsgStart, ViewMsgStart, diff --git a/chromium/ipc/ipc_mojo_param_traits.cc b/chromium/ipc/ipc_mojo_param_traits.cc index 5eeb9f0fbb7..a44f3a4f344 100644 --- a/chromium/ipc/ipc_mojo_param_traits.cc +++ b/chromium/ipc/ipc_mojo_param_traits.cc @@ -29,7 +29,13 @@ bool ParamTraits<mojo::MessagePipeHandle>::Read(const base::Pickle* m, mojo::ScopedMessagePipeHandle handle; if (!MojoMessageHelper::ReadMessagePipeFrom(m, iter, &handle)) return false; - DCHECK(handle.is_valid()); + + // Remove DCHECK as a workaround to fix CHROME_IPC_LOGGING. + if (!handle.is_valid()) { + DLOG(ERROR) << "Mojo handle is invalid"; + return false; + } + *r = handle.release(); return true; } diff --git a/chromium/media/BUILD.gn b/chromium/media/BUILD.gn index 7558e08e9e6..adc5e40e136 100644 --- a/chromium/media/BUILD.gn +++ b/chromium/media/BUILD.gn @@ -29,6 +29,7 @@ buildflag_header("media_features") { "ENABLE_MEDIA_REMOTING=$enable_media_remoting", "ENABLE_MEDIA_REMOTING_RPC=$enable_media_remoting_rpc", "ENABLE_WEBRTC=$enable_webrtc", + "ENABLE_WEB_SPEECH=$enable_web_speech", "USE_PROPRIETARY_CODECS=$proprietary_codecs", ] } diff --git a/chromium/media/capture/video/linux/v4l2_capture_delegate.cc b/chromium/media/capture/video/linux/v4l2_capture_delegate.cc index 4455fdb82a2..8edaceef95a 100644 --- a/chromium/media/capture/video/linux/v4l2_capture_delegate.cc +++ b/chromium/media/capture/video/linux/v4l2_capture_delegate.cc @@ -12,6 +12,10 @@ #include <sys/mman.h> #include <utility> +#if !defined(OS_OPENBSD) +#include <linux/version.h> +#endif + #include "base/bind.h" #include "base/files/file_enumerator.h" #include "base/posix/eintr_wrapper.h" @@ -468,9 +472,12 @@ void V4L2CaptureDelegate::AllocateAndStart( // Set anti-banding/anti-flicker to 50/60Hz. May fail due to not supported // operation (|errno| == EINVAL in this case) or plain failure. - if ((power_line_frequency_ == V4L2_CID_POWER_LINE_FREQUENCY_50HZ) || - (power_line_frequency_ == V4L2_CID_POWER_LINE_FREQUENCY_60HZ) || - (power_line_frequency_ == V4L2_CID_POWER_LINE_FREQUENCY_AUTO)) { + if ((power_line_frequency_ == V4L2_CID_POWER_LINE_FREQUENCY_50HZ) + || (power_line_frequency_ == V4L2_CID_POWER_LINE_FREQUENCY_60HZ) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) + || (power_line_frequency_ == V4L2_CID_POWER_LINE_FREQUENCY_AUTO) +#endif + ) { struct v4l2_control control = {}; control.id = V4L2_CID_POWER_LINE_FREQUENCY; control.value = power_line_frequency_; diff --git a/chromium/media/capture/video/linux/video_capture_device_linux.cc b/chromium/media/capture/video/linux/video_capture_device_linux.cc index e247368c3f2..34156932db7 100644 --- a/chromium/media/capture/video/linux/video_capture_device_linux.cc +++ b/chromium/media/capture/video/linux/video_capture_device_linux.cc @@ -17,6 +17,7 @@ #include <sys/videoio.h> #else #include <linux/videodev2.h> +#include <linux/version.h> #endif namespace media { @@ -144,8 +145,12 @@ int VideoCaptureDeviceLinux::TranslatePowerLineFrequencyToV4L2( case media::PowerLineFrequency::FREQUENCY_60HZ: return V4L2_CID_POWER_LINE_FREQUENCY_60HZ; default: +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0) // If we have no idea of the frequency, at least try and set it to AUTO. return V4L2_CID_POWER_LINE_FREQUENCY_AUTO; +#else + return V4L2_CID_POWER_LINE_FREQUENCY_60HZ; +#endif } } diff --git a/chromium/media/gpu/BUILD.gn b/chromium/media/gpu/BUILD.gn index 729c6faba43..7c05d7c9d42 100644 --- a/chromium/media/gpu/BUILD.gn +++ b/chromium/media/gpu/BUILD.gn @@ -433,10 +433,12 @@ if (is_win || is_android || use_v4l2_codec || use_vaapi) { if (is_win) { # TODO(crbug.com/167187): Fix size_t to int truncations. configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] - deps += [ - "//third_party/angle:libEGL", - "//third_party/angle:libGLESv2", - ] + if (!use_qt) { + deps += [ + "//third_party/angle:libEGL", + "//third_party/angle:libGLESv2", + ] + } } if (use_x11) { diff --git a/chromium/media/gpu/dxva_video_decode_accelerator_win.cc b/chromium/media/gpu/dxva_video_decode_accelerator_win.cc index 20b2bfc037a..029d753fee7 100644 --- a/chromium/media/gpu/dxva_video_decode_accelerator_win.cc +++ b/chromium/media/gpu/dxva_video_decode_accelerator_win.cc @@ -1292,7 +1292,9 @@ DXVAVideoDecodeAccelerator::GetSupportedProfiles( if (!::GetModuleHandle(mfdll)) { // Windows N is missing the media foundation DLLs unless the media // feature pack is installed. +#if !defined(TOOLKIT_QT) DVLOG(ERROR) << mfdll << " is required for hardware video decoding"; +#endif return profiles; } } diff --git a/chromium/media/gpu/media_foundation_video_encode_accelerator_win.cc b/chromium/media/gpu/media_foundation_video_encode_accelerator_win.cc index 9147bc38d56..7104150b943 100644 --- a/chromium/media/gpu/media_foundation_video_encode_accelerator_win.cc +++ b/chromium/media/gpu/media_foundation_video_encode_accelerator_win.cc @@ -343,7 +343,9 @@ bool MediaFoundationVideoEncodeAccelerator::CreateHardwareEncoderMFT() { for (const wchar_t* mfdll : kMediaFoundationVideoEncoderDLLs) { if (!::GetModuleHandle(mfdll)) { +#if !defined(TOOLKIT_QT) DVLOG(ERROR) << mfdll << " is required for encoding"; +#endif return false; } } diff --git a/chromium/media/media_options.gni b/chromium/media/media_options.gni index a35a38a21be..c5dd9eb34d5 100644 --- a/chromium/media/media_options.gni +++ b/chromium/media/media_options.gni @@ -79,6 +79,8 @@ declare_args() { enable_webrtc = !is_cast_audio_only && !is_fuchsia + enable_web_speech = true + # Enable HLS with SAMPLE-AES decryption. # Enabled by default on the cast desktop implementation to allow unit tests of # MP2TS parsing support. diff --git a/chromium/media/mojo/services/BUILD.gn b/chromium/media/mojo/services/BUILD.gn index 20e5fd4099d..1bf7a056700 100644 --- a/chromium/media/mojo/services/BUILD.gn +++ b/chromium/media/mojo/services/BUILD.gn @@ -110,6 +110,13 @@ component("services") { "//services/service_manager/public/interfaces", ] + if (use_qt) { + deps -= [ + "//services/metrics/public/cpp:metrics_cpp", + "//services/metrics/public/cpp:ukm_builders", + ] + } + if (is_android) { sources += [ "android_mojo_media_client.cc", diff --git a/chromium/media/mojo/services/watch_time_recorder.cc b/chromium/media/mojo/services/watch_time_recorder.cc index e857627ff70..ed60fc41c95 100644 --- a/chromium/media/mojo/services/watch_time_recorder.cc +++ b/chromium/media/mojo/services/watch_time_recorder.cc @@ -10,8 +10,11 @@ #include "base/strings/string_piece.h" #include "media/base/watch_time_keys.h" #include "mojo/public/cpp/bindings/strong_binding.h" + +#if !defined(TOOLKIT_QT) #include "services/metrics/public/cpp/ukm_builders.h" #include "services/metrics/public/cpp/ukm_recorder.h" +#endif namespace media { @@ -150,6 +153,7 @@ void WatchTimeRecorder::UpdateUnderflowCount(int32_t count) { } void WatchTimeRecorder::RecordUkmPlaybackData() { +#if !defined(TOOLKIT_QT) // UKM may be unavailable in content_shell or other non-chrome/ builds; it // may also be unavailable if browser shutdown has started; so this may be a // nullptr. If it's unavailable, UKM reporting will be skipped. @@ -230,6 +234,7 @@ void WatchTimeRecorder::RecordUkmPlaybackData() { builder.SetVideoNaturalHeight(properties_->natural_size.height()); builder.Record(ukm_recorder); aggregate_watch_time_info_.clear(); +#endif } WatchTimeRecorder::RebufferMapping::RebufferMapping(const RebufferMapping& copy) diff --git a/chromium/media/renderers/audio_renderer_impl.cc b/chromium/media/renderers/audio_renderer_impl.cc index be559c0fc14..3a67710ff3b 100644 --- a/chromium/media/renderers/audio_renderer_impl.cc +++ b/chromium/media/renderers/audio_renderer_impl.cc @@ -385,7 +385,7 @@ void AudioRendererImpl::Initialize(DemuxerStream* stream, init_cb_ = BindToCurrentLoop(init_cb); auto output_device_info = sink_->GetOutputDeviceInfo(); - const AudioParameters& hw_params = output_device_info.output_params(); + const AudioParameters hw_params = output_device_info.output_params(); AudioCodec codec = stream->audio_decoder_config().codec(); if (auto* mc = GetMediaClient()) is_passthrough_ = mc->IsSupportedBitstreamAudioCodec(codec); diff --git a/chromium/mojo/public/tools/bindings/BUILD.gn b/chromium/mojo/public/tools/bindings/BUILD.gn index 5be5586e734..4f0498812e4 100644 --- a/chromium/mojo/public/tools/bindings/BUILD.gn +++ b/chromium/mojo/public/tools/bindings/BUILD.gn @@ -65,7 +65,6 @@ action("precompile_templates") { script = mojom_generator_script outputs = [ "$target_gen_dir/cpp_templates.zip", - "$target_gen_dir/java_templates.zip", "$target_gen_dir/js_templates.zip", ] args = [ diff --git a/chromium/mojo/public/tools/bindings/mojom.gni b/chromium/mojo/public/tools/bindings/mojom.gni index 9b5ed6adc1e..fc1a4f51ad2 100644 --- a/chromium/mojo/public/tools/bindings/mojom.gni +++ b/chromium/mojo/public/tools/bindings/mojom.gni @@ -47,7 +47,6 @@ mojom_generator_script = "$mojom_generator_root/mojom_bindings_generator.py" mojom_generator_sources = [ "$mojom_generator_root/generators/mojom_cpp_generator.py", "$mojom_generator_root/generators/mojom_js_generator.py", - "$mojom_generator_root/generators/mojom_java_generator.py", "$mojom_generator_root/pylib/mojom/__init__.py", "$mojom_generator_root/pylib/mojom/error.py", "$mojom_generator_root/pylib/mojom/generate/__init__.py", @@ -685,7 +684,7 @@ template("mojom") { ":$type_mappings_target_name", "//mojo/public/tools/bindings:precompile_templates", ] - outputs = generator_cpp_outputs + generator_java_outputs + outputs = generator_cpp_outputs args = common_generator_args if (cpp_only) { @@ -696,7 +695,7 @@ template("mojom") { } else { args += [ "-g", - "c++,java", + "c++", ] } diff --git a/chromium/mojo/public/tools/bindings/mojom_bindings_generator.py b/chromium/mojo/public/tools/bindings/mojom_bindings_generator.py index a1d535c1824..ff282c36fad 100755 --- a/chromium/mojo/public/tools/bindings/mojom_bindings_generator.py +++ b/chromium/mojo/public/tools/bindings/mojom_bindings_generator.py @@ -48,7 +48,6 @@ from mojom.parse.parser import Parse _BUILTIN_GENERATORS = { "c++": "mojom_cpp_generator.py", "javascript": "mojom_js_generator.py", - "java": "mojom_java_generator.py", } @@ -320,7 +319,7 @@ def main(): generate_parser.add_argument("-g", "--generators", dest="generators_string", metavar="GENERATORS", - default="c++,javascript,java", + default="c++,javascript", help="comma-separated list of generators") generate_parser.add_argument( "-I", dest="import_directories", action="append", metavar="directory", diff --git a/chromium/net/base/directory_lister.cc b/chromium/net/base/directory_lister.cc index d8b2fea778a..d461486caac 100644 --- a/chromium/net/base/directory_lister.cc +++ b/chromium/net/base/directory_lister.cc @@ -33,10 +33,10 @@ bool IsDotDot(const base::FilePath& path) { bool CompareAlphaDirsFirst(const DirectoryLister::DirectoryListerData& a, const DirectoryLister::DirectoryListerData& b) { // Parent directory before all else. - if (IsDotDot(a.info.GetName())) - return true; - if (IsDotDot(b.info.GetName())) - return false; + bool a_is_dotdot = IsDotDot(a.info.GetName()); + bool b_is_dotdot = IsDotDot(b.info.GetName()); + if (a_is_dotdot != b_is_dotdot) + return a_is_dotdot; // Directories before regular files. bool a_is_directory = a.info.IsDirectory(); diff --git a/chromium/net/base/network_config_watcher_mac.cc b/chromium/net/base/network_config_watcher_mac.cc index bc46c120640..ef61ad3e986 100644 --- a/chromium/net/base/network_config_watcher_mac.cc +++ b/chromium/net/base/network_config_watcher_mac.cc @@ -121,7 +121,7 @@ NetworkConfigWatcherMac::NetworkConfigWatcherMac(Delegate* delegate) // We create this notifier thread because the notification implementation // needs a thread with a CFRunLoop, and there's no guarantee that // MessageLoop::current() meets that criterion. - base::Thread::Options thread_options(base::MessageLoop::TYPE_UI, 0); + base::Thread::Options thread_options(base::MessageLoop::TYPE_DEFAULT, 0); notifier_thread_->StartWithOptions(thread_options); } diff --git a/chromium/net/http/http_response_info.cc b/chromium/net/http/http_response_info.cc index e2fe9a5036f..cc15d4fa416 100644 --- a/chromium/net/http/http_response_info.cc +++ b/chromium/net/http/http_response_info.cc @@ -387,7 +387,8 @@ void HttpResponseInfo::Persist(base::Pickle* pickle, HttpResponseHeaders::PERSIST_SANS_SECURITY_STATE; } - headers->Persist(pickle, persist_options); + if (headers.get()) + headers->Persist(pickle, persist_options); if (ssl_info.is_valid()) { ssl_info.cert->Persist(pickle); diff --git a/chromium/ppapi/host/ppapi_host.cc b/chromium/ppapi/host/ppapi_host.cc index f3c68fab3de..ca0f1e5a276 100644 --- a/chromium/ppapi/host/ppapi_host.cc +++ b/chromium/ppapi/host/ppapi_host.cc @@ -240,7 +240,13 @@ void PpapiHost::OnHostMsgResourceCreated( CreateResourceHost(params.pp_resource(), instance, nested_msg); if (!resource_host.get()) { +#ifndef TOOLKIT_QT NOTREACHED(); +#else + LOG(INFO) << "Failed to create PPAPI resource host" + << IPC_MESSAGE_ID_CLASS(nested_msg.type()) + << IPC_MESSAGE_ID_LINE(nested_msg.type()); +#endif return; } diff --git a/chromium/services/device/wake_lock/power_save_blocker/BUILD.gn b/chromium/services/device/wake_lock/power_save_blocker/BUILD.gn index e04629ca1a9..a813c675f5c 100644 --- a/chromium/services/device/wake_lock/power_save_blocker/BUILD.gn +++ b/chromium/services/device/wake_lock/power_save_blocker/BUILD.gn @@ -40,7 +40,8 @@ source_set("power_save_blocker") { if (use_x11) { configs += [ "//build/config/linux:x11" ] - if (!is_chromeos) { + if (use_xscrnsaver) { + defines = [ "USE_XSCRNSAVER" ] configs += [ "//build/config/linux:xscrnsaver" ] } deps += [ diff --git a/chromium/services/device/wake_lock/power_save_blocker/power_save_blocker_x11.cc b/chromium/services/device/wake_lock/power_save_blocker/power_save_blocker_x11.cc index f8a4ac3563f..7df37d99862 100644 --- a/chromium/services/device/wake_lock/power_save_blocker/power_save_blocker_x11.cc +++ b/chromium/services/device/wake_lock/power_save_blocker/power_save_blocker_x11.cc @@ -4,7 +4,9 @@ #include <X11/Xlib.h> #include <X11/extensions/dpms.h> +#if defined(USE_XSCRNSAVER) #include <X11/extensions/scrnsaver.h> +#endif #include <stdint.h> #include <memory> @@ -420,8 +422,10 @@ void PowerSaveBlocker::Delegate::XSSSuspendSet(bool suspend) { if (!XSSAvailable()) return; +#if defined(USE_XSCRNSAVER) XDisplay* display = gfx::GetXDisplay(); XScreenSaverSuspend(display, suspend); +#endif } bool PowerSaveBlocker::Delegate::DPMSEnabled() { @@ -429,7 +433,7 @@ bool PowerSaveBlocker::Delegate::DPMSEnabled() { XDisplay* display = gfx::GetXDisplay(); BOOL enabled = false; int dummy; - if (DPMSQueryExtension(display, &dummy, &dummy) && DPMSCapable(display)) { + if (display && DPMSQueryExtension(display, &dummy, &dummy) && DPMSCapable(display)) { CARD16 state; DPMSInfo(display, &state, &enabled); } @@ -437,6 +441,7 @@ bool PowerSaveBlocker::Delegate::DPMSEnabled() { } bool PowerSaveBlocker::Delegate::XSSAvailable() { +#if defined(USE_XSCRNSAVER) DCHECK(ui_task_runner_->RunsTasksInCurrentSequence()); // X Screen Saver isn't accessible in headless mode. if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless)) @@ -446,6 +451,9 @@ bool PowerSaveBlocker::Delegate::XSSAvailable() { int major; int minor; + if (!display) + return false; + if (!XScreenSaverQueryExtension(display, &dummy, &dummy)) return false; @@ -453,6 +461,9 @@ bool PowerSaveBlocker::Delegate::XSSAvailable() { return false; return major > 1 || (major == 1 && minor >= 1); +#else + return false; +#endif } DBusAPI PowerSaveBlocker::Delegate::SelectAPI() { diff --git a/chromium/services/resource_coordinator/BUILD.gn b/chromium/services/resource_coordinator/BUILD.gn index 15cf7279a64..373e309cb33 100644 --- a/chromium/services/resource_coordinator/BUILD.gn +++ b/chromium/services/resource_coordinator/BUILD.gn @@ -5,6 +5,7 @@ # There should be only one resource coordinator. It is currently # in the browser process. So, only //content/browser should link to this target. # Others modules should only need the public targets. +import("//build/config/features.gni") import("//services/catalog/public/tools/catalog.gni") import("//services/service_manager/public/cpp/service.gni") import("//services/service_manager/public/service_manifest.gni") @@ -56,6 +57,17 @@ source_set("lib") { "//services/resource_coordinator/tracing:lib", "//services/service_manager/public/cpp/standalone_service:standalone_service", ] + + if (use_qt) { + sources -= [ + "observers/metrics_collector.cc", + "observers/metrics_collector.h", + ] + public_deps -= [ + "//components/ukm:ukm", + "//services/metrics/public/cpp:ukm_builders", + ] + } } service_manifest("manifest") { diff --git a/chromium/services/resource_coordinator/resource_coordinator_service.cc b/chromium/services/resource_coordinator/resource_coordinator_service.cc index 386675af5ca..855e1310ab7 100644 --- a/chromium/services/resource_coordinator/resource_coordinator_service.cc +++ b/chromium/services/resource_coordinator/resource_coordinator_service.cc @@ -8,7 +8,9 @@ #include "base/memory/ptr_util.h" #include "services/resource_coordinator/memory_instrumentation/coordinator_impl.h" +#if !defined(TOOLKIT_QT) #include "services/resource_coordinator/observers/metrics_collector.h" +#endif #include "services/resource_coordinator/observers/tab_signal_generator_impl.h" #include "services/resource_coordinator/service_callbacks_impl.h" #include "services/resource_coordinator/tracing/agent_registry.h" @@ -52,8 +54,10 @@ void ResourceCoordinatorService::OnStart() { coordination_unit_manager_.RegisterObserver( std::move(tab_signal_generator_impl)); +#if !defined(TOOLKIT_QT) coordination_unit_manager_.RegisterObserver( base::MakeUnique<MetricsCollector>()); +#endif coordination_unit_manager_.OnStart(®istry_, ref_factory_.get()); diff --git a/chromium/services/service_manager/embedder/main.cc b/chromium/services/service_manager/embedder/main.cc index 87ac6f05394..bea84caf605 100644 --- a/chromium/services/service_manager/embedder/main.cc +++ b/chromium/services/service_manager/embedder/main.cc @@ -330,7 +330,9 @@ int Main(const MainParams& params) { #if defined(OS_MACOSX) && BUILDFLAG(USE_ALLOCATOR_SHIM) base::allocator::InitializeAllocatorShim(); #endif +#if !defined(TOOLKIT_QT) base::EnableTerminationOnOutOfMemory(); +#endif #if defined(OS_LINUX) // The various desktop environments set this environment variable that allows diff --git a/chromium/services/ui/clipboard/BUILD.gn b/chromium/services/ui/clipboard/BUILD.gn index 0eabe335094..75f4e7413d6 100644 --- a/chromium/services/ui/clipboard/BUILD.gn +++ b/chromium/services/ui/clipboard/BUILD.gn @@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/features.gni") import("//services/catalog/public/tools/catalog.gni") import("//services/service_manager/public/cpp/service.gni") import("//services/service_manager/public/service_manifest.gni") @@ -42,6 +43,11 @@ source_set("tests") { ":lib", "//services/ui", ] + if (use_qt) { + data_deps -= [ + "//services/ui", + ] + } } service_manifest("unittest_manifest") { diff --git a/chromium/services/ui/public/cpp/BUILD.gn b/chromium/services/ui/public/cpp/BUILD.gn index b8903341a6a..a4c653b4a65 100644 --- a/chromium/services/ui/public/cpp/BUILD.gn +++ b/chromium/services/ui/public/cpp/BUILD.gn @@ -38,6 +38,12 @@ source_set("cpp") { "//services/ui", ] + if (use_qt) { + data_deps -= [ + "//services/ui", + ] + } + defines = [ "GL_GLEXT_PROTOTYPES" ] allow_circular_includes_from = [ ":internal" ] @@ -76,6 +82,12 @@ source_set("internal") { "//services/ui", ] + if (use_qt) { + data_deps -= [ + "//services/ui", + ] + } + defines = [ "GL_GLEXT_PROTOTYPES" ] if (use_ozone) { diff --git a/chromium/storage/browser/quota/quota_manager.cc b/chromium/storage/browser/quota/quota_manager.cc index 8e57fc51009..e0d4569add6 100644 --- a/chromium/storage/browser/quota/quota_manager.cc +++ b/chromium/storage/browser/quota/quota_manager.cc @@ -865,7 +865,6 @@ void QuotaManager::GetUsageAndQuotaWithBreakdown( const GURL& origin, StorageType type, const UsageAndQuotaWithBreakdownCallback& callback) { - DCHECK(origin == origin.GetOrigin()); if (!IsSupportedType(type) || (is_incognito_ && !IsSupportedIncognitoType(type))) { callback.Run(kQuotaErrorNotSupported, 0, 0, diff --git a/chromium/third_party/WebKit/Source/BUILD.gn b/chromium/third_party/WebKit/Source/BUILD.gn index 1f56be42fa6..6a931953695 100644 --- a/chromium/third_party/WebKit/Source/BUILD.gn +++ b/chromium/third_party/WebKit/Source/BUILD.gn @@ -54,7 +54,7 @@ config("blink_pch") { # This is a string rather than a file GN knows about. It has to match # exactly what's in the /FI flag below, and what might appear in the # source code in quotes for an #include directive. - precompiled_header = rebase_path("build/win/Precompile.h", root_build_dir) + precompiled_header = "third_party/WebKit/Source/build/win/Precompile.h" # This is a file that GN will compile with the above header. It will be # implicitly added to the sources (potentially multiple times, with one diff --git a/chromium/third_party/WebKit/Source/bindings/scripts/aggregate_generated_bindings.py b/chromium/third_party/WebKit/Source/bindings/scripts/aggregate_generated_bindings.py index 5619f48e544..78e281e3078 100755 --- a/chromium/third_party/WebKit/Source/bindings/scripts/aggregate_generated_bindings.py +++ b/chromium/third_party/WebKit/Source/bindings/scripts/aggregate_generated_bindings.py @@ -54,6 +54,7 @@ import re import sys from utilities import idl_filename_to_basename from utilities import read_idl_files_list_from_file +from utilities import abs from utilities import to_snake_case COPYRIGHT_TEMPLATE = """/* @@ -128,12 +129,12 @@ def write_content(content, output_file_name): def main(): options, filenames = parse_options() component = options.component - idl_filenames = read_idl_files_list_from_file(filenames[0], + idl_filenames = read_idl_files_list_from_file(abs(filenames[0]), is_gyp_format=False) basenames = [idl_filename_to_basename(file_path) for file_path in idl_filenames] file_contents = generate_content(component, basenames, options.snake_case_generated_files) - write_content(file_contents, filenames[1]) + write_content(file_contents, abs(filenames[1])) if __name__ == '__main__': diff --git a/chromium/third_party/WebKit/Source/bindings/scripts/compute_interfaces_info_individual.py b/chromium/third_party/WebKit/Source/bindings/scripts/compute_interfaces_info_individual.py index 98fee87cc2e..1bb37d28239 100755 --- a/chromium/third_party/WebKit/Source/bindings/scripts/compute_interfaces_info_individual.py +++ b/chromium/third_party/WebKit/Source/bindings/scripts/compute_interfaces_info_individual.py @@ -56,6 +56,7 @@ from utilities import read_idl_files_list_from_file from utilities import shorten_union_name from utilities import to_snake_case from utilities import write_pickle_file +from utilities import abs module_path = os.path.dirname(__file__) @@ -108,6 +109,13 @@ def include_path(idl_filename, snake_case_generated_files, implemented_as=None): else: relative_dir = relative_dir_posix(idl_filename, source_path) + # The generated relative include path might be wrong if the relative path + # points to a parent directory in case of shadow build. To avoid jumbled + # relative paths use absolute path instead. + if relative_dir.startswith(".."): + relative_dir = abs(os.path.dirname(idl_filename)) + relative_dir = relative_dir.replace(os.path.sep, posixpath.sep) + # IDL file basename is used even if only a partial interface file output_file_basename = implemented_as or idl_filename_to_basename(idl_filename) if snake_case_generated_files: @@ -222,7 +230,7 @@ class InterfaceInfoCollector(object): interface_info['unforgeable_attributes'] = unforgeable_attributes return interface_info - definitions = self.reader.read_idl_file(idl_filename) + definitions = self.reader.read_idl_file(abs(idl_filename)) this_union_types = collect_union_types_from_definitions(definitions) self.union_types.update(this_union_types) diff --git a/chromium/third_party/WebKit/Source/bindings/scripts/idl_compiler.py b/chromium/third_party/WebKit/Source/bindings/scripts/idl_compiler.py index d876a0c1930..ffeda15737b 100755 --- a/chromium/third_party/WebKit/Source/bindings/scripts/idl_compiler.py +++ b/chromium/third_party/WebKit/Source/bindings/scripts/idl_compiler.py @@ -45,6 +45,7 @@ from idl_reader import IdlReader from utilities import create_component_info_provider from utilities import read_idl_files_list_from_file from utilities import write_file +from utilities import abs def parse_options(): @@ -128,7 +129,7 @@ class IdlCompiler(object): def generate_bindings(code_generator_class, info_provider, options, input_filenames): idl_compiler = IdlCompiler( - output_directory=options.output_directory, + output_directory=abs(options.output_directory), cache_directory=options.cache_directory, code_generator_class=code_generator_class, snake_case_generated_files=options.snake_case_generated_files, diff --git a/chromium/third_party/WebKit/Source/bindings/scripts/utilities.py b/chromium/third_party/WebKit/Source/bindings/scripts/utilities.py index b641b42b642..830cc9b09b8 100644 --- a/chromium/third_party/WebKit/Source/bindings/scripts/utilities.py +++ b/chromium/third_party/WebKit/Source/bindings/scripts/utilities.py @@ -255,13 +255,20 @@ def create_component_info_provider(info_dir, component): # Basic file reading/writing ################################################################################ +def abs(filename): + # open, abspath, etc. are all limited to the 260 char MAX_PATH and this causes + # problems when we try to resolve long relative paths in the WebKit directory structure. + return os.path.normpath(os.path.join(os.getcwd(), filename)) + def get_file_contents(filename): + filename = abs(filename) with open(filename) as f: return f.read() def read_file_to_list(filename): """Returns a list of (stripped) lines for a given filename.""" + filename = abs(filename) with open(filename) as f: return [line.rstrip('\n') for line in f] @@ -287,7 +294,7 @@ def read_idl_files_list_from_file(filename, is_gyp_format): If is_gyp_format is True, the file is treated as a newline-separated list with no quoting or escaping. When False, the file is interpreted as a Posix-style quoted and space-separated list.""" - with open(filename) as input_file: + with open(abs(filename)) as input_file: if is_gyp_format: file_names = sorted([os.path.realpath(line.rstrip('\n')) for line in input_file]) @@ -308,11 +315,13 @@ def read_pickle_files(pickle_filenames): def read_pickle_file(pickle_filename): + pickle_filename = abs(pickle_filename) with open(pickle_filename) as pickle_file: return pickle.load(pickle_file) def write_file(new_text, destination_filename): + destination_filename = abs(destination_filename) # If |new_text| is same with the file content, we skip updating. if os.path.isfile(destination_filename): with open(destination_filename) as destination_file: @@ -327,6 +336,7 @@ def write_file(new_text, destination_filename): def write_pickle_file(pickle_filename, data): + pickle_filename = abs(pickle_filename) # If |data| is same with the file content, we skip updating. if os.path.isfile(pickle_filename): with open(pickle_filename) as pickle_file: diff --git a/chromium/third_party/WebKit/Source/build/scripts/rule_bison.py b/chromium/third_party/WebKit/Source/build/scripts/rule_bison.py index cd99a3747c4..77344e8ff46 100755 --- a/chromium/third_party/WebKit/Source/build/scripts/rule_bison.py +++ b/chromium/third_party/WebKit/Source/build/scripts/rule_bison.py @@ -41,11 +41,12 @@ import os import os.path import subprocess import sys +from utilities import abs assert len(sys.argv) == 4 or len(sys.argv) == 5 -inputFile = sys.argv[1] -outputDir = sys.argv[2] +inputFile = abs(sys.argv[1]) +outputDir = abs(sys.argv[2]) bisonExe = sys.argv[3] if len(sys.argv) > 4: os.environ['DEVELOPER_DIR'] = sys.argv[4] diff --git a/chromium/third_party/WebKit/Source/build/scripts/scripts.gni b/chromium/third_party/WebKit/Source/build/scripts/scripts.gni index e6789efa3f7..327923530cc 100644 --- a/chromium/third_party/WebKit/Source/build/scripts/scripts.gni +++ b/chromium/third_party/WebKit/Source/build/scripts/scripts.gni @@ -64,8 +64,13 @@ make_trie_helpers_files = # The executables are relative to the build directory. Don't rebase it because # on Posix we want to run the system one on the path. if (host_os == "win") { - gperf_exe = rebase_path("//third_party/gperf/bin/gperf.exe", root_build_dir) - bison_exe = rebase_path("//third_party/bison/bin/bison.exe", root_build_dir) + if (use_qt) { + gperf_exe = "gperf.exe" + bison_exe = "bison.exe" + } else { + gperf_exe = rebase_path("//third_party/gperf/bin/gperf.exe", root_build_dir) + bison_exe = rebase_path("//third_party/bison/bin/bison.exe", root_build_dir) + } } else { gperf_exe = "gperf" bison_exe = "bison" diff --git a/chromium/third_party/WebKit/Source/build/scripts/utilities.py b/chromium/third_party/WebKit/Source/build/scripts/utilities.py new file mode 100644 index 00000000000..f236b04cc77 --- /dev/null +++ b/chromium/third_party/WebKit/Source/build/scripts/utilities.py @@ -0,0 +1,10 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import os + +def abs(filename): + # open, abspath, etc. are all limited to the 260 char MAX_PATH and this causes + # problems when we try to resolve long relative paths in the WebKit directory structure. + return os.path.normpath(os.path.join(os.getcwd(), filename)) diff --git a/chromium/third_party/WebKit/Source/controller/BUILD.gn b/chromium/third_party/WebKit/Source/controller/BUILD.gn index 1d29633ba10..cd867795423 100644 --- a/chromium/third_party/WebKit/Source/controller/BUILD.gn +++ b/chromium/third_party/WebKit/Source/controller/BUILD.gn @@ -48,6 +48,10 @@ component("controller") { if (remove_webcore_debug_symbols) { configs -= [ "//build/config/compiler:default_symbols" ] configs += remove_webcore_symbols_config + if (is_debug) { + configs -= [ "//build/config/compiler:default_optimization" ] + configs += [ "//build/config/compiler:optimize_size_only" ] + } } } diff --git a/chromium/third_party/WebKit/Source/core/core.gni b/chromium/third_party/WebKit/Source/core/core.gni index f1f7963faae..09f86ae317b 100644 --- a/chromium/third_party/WebKit/Source/core/core.gni +++ b/chromium/third_party/WebKit/Source/core/core.gni @@ -33,6 +33,10 @@ if (is_win && is_official_build) { if (remove_webcore_debug_symbols) { core_config_remove += [ "//build/config/compiler:default_symbols" ] core_config_add += remove_webcore_symbols_config + if (is_debug) { + core_config_remove += [ "//build/config/compiler:default_optimization" ] + core_config_add += [ "//build/config/compiler:optimize_size_only" ] + } } # Use this target type to link core targets. diff --git a/chromium/third_party/WebKit/Source/core/css/FontFaceCache.cpp b/chromium/third_party/WebKit/Source/core/css/FontFaceCache.cpp index 8c145aef874..43ff6d6ac00 100644 --- a/chromium/third_party/WebKit/Source/core/css/FontFaceCache.cpp +++ b/chromium/third_party/WebKit/Source/core/css/FontFaceCache.cpp @@ -140,6 +140,8 @@ void FontFaceCache::IncrementVersion() { CSSSegmentedFontFace* FontFaceCache::Get( const FontDescription& font_description, const AtomicString& family) { + if (family.IsEmpty()) + return nullptr; SegmentedFacesByFamily::iterator segmented_faces_for_family = segmented_faces_.find(family); if (segmented_faces_for_family == segmented_faces_.end() || diff --git a/chromium/third_party/WebKit/Source/core/dom/CollectionIndexCache.h b/chromium/third_party/WebKit/Source/core/dom/CollectionIndexCache.h index c71e657ba53..d395ce2061d 100644 --- a/chromium/third_party/WebKit/Source/core/dom/CollectionIndexCache.h +++ b/chromium/third_party/WebKit/Source/core/dom/CollectionIndexCache.h @@ -217,8 +217,9 @@ CollectionIndexCache<Collection, NodeType>::NodeAfterCachedNode( collection.TraverseForwardToOffset(index, *CachedNode(), current_index); if (!current_node) { // Did not find the node. On plus side, we now know the length. - if (IsCachedNodeCountValid()) + if (IsCachedNodeCountValid()) { DCHECK_EQ(current_index + 1, CachedNodeCount()); + } SetCachedNodeCount(current_index + 1); return nullptr; } diff --git a/chromium/third_party/WebKit/Source/core/dom/QualifiedName.cpp b/chromium/third_party/WebKit/Source/core/dom/QualifiedName.cpp index 8a17372a4ca..32acc2a87a8 100644 --- a/chromium/third_party/WebKit/Source/core/dom/QualifiedName.cpp +++ b/chromium/third_party/WebKit/Source/core/dom/QualifiedName.cpp @@ -106,9 +106,13 @@ QualifiedName::QualifiedNameImpl::~QualifiedNameImpl() { } String QualifiedName::ToString() const { - String local = LocalName(); + const String& local = LocalName().GetString(); if (HasPrefix()) return Prefix().GetString() + ":" + local; +#if !defined(NDEBUG) + if (!local.IsSafeToSendToAnotherThread()) + return local.IsolatedCopy(); +#endif return local; } diff --git a/chromium/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.cpp b/chromium/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.cpp index 6a54f3b3221..42412c6d34a 100644 --- a/chromium/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.cpp +++ b/chromium/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.cpp @@ -854,6 +854,13 @@ v8::Local<v8::Context> WebLocalFrameImpl::MainWorldScriptContext() const { return script_state->GetContext(); } +v8::Local<v8::Context> WebLocalFrameImpl::IsolatedWorldScriptContext(int worldID) const { + scoped_refptr<DOMWrapperWorld> world = DOMWrapperWorld::EnsureIsolatedWorld(ToIsolate(GetFrame()), worldID); + ScriptState* script_state = ToScriptState(GetFrame(), *world.get()); + CHECK(script_state); + return script_state->GetContext(); +} + v8::Local<v8::Object> WebLocalFrameImpl::GlobalProxy() const { return MainWorldScriptContext()->Global(); } diff --git a/chromium/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.h b/chromium/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.h index 77f4ba4ab43..838bfa0579a 100644 --- a/chromium/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.h +++ b/chromium/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.h @@ -142,6 +142,7 @@ class CORE_EXPORT WebLocalFrameImpl final int argc, v8::Local<v8::Value> argv[]) override; v8::Local<v8::Context> MainWorldScriptContext() const override; + v8::Local<v8::Context> IsolatedWorldScriptContext(int worldID) const override; v8::Local<v8::Object> GlobalProxy() const override; void Reload(WebFrameLoadType) override; void ReloadWithOverrideURL(const WebURL& override_url, diff --git a/chromium/third_party/WebKit/Source/devtools/scripts/build/generate_devtools_grd.py b/chromium/third_party/WebKit/Source/devtools/scripts/build/generate_devtools_grd.py index fa6595cea4b..be611038487 100755 --- a/chromium/third_party/WebKit/Source/devtools/scripts/build/generate_devtools_grd.py +++ b/chromium/third_party/WebKit/Source/devtools/scripts/build/generate_devtools_grd.py @@ -90,6 +90,8 @@ def parse_args(argv): static_files_list_position = argv.index('--static_files_list') static_files_list_path = argv[static_files_list_position + 1] source_files = argv[:static_files_list_position] + # Workaround for python's path length limit on Windows. + static_files_list_path = os.path.normpath(os.path.join(os.getcwd(), static_files_list_path)) with open(static_files_list_path, 'r') as static_list_file: source_files.extend([line.rstrip('\n') for line in static_list_file.readlines()]) elif '--static_files_args' in argv: diff --git a/chromium/third_party/WebKit/Source/modules/BUILD.gn b/chromium/third_party/WebKit/Source/modules/BUILD.gn index 865b43ef03c..86e3d1bcfb6 100644 --- a/chromium/third_party/WebKit/Source/modules/BUILD.gn +++ b/chromium/third_party/WebKit/Source/modules/BUILD.gn @@ -174,6 +174,10 @@ target("jumbo_" + modules_target_type, "modules") { if (remove_webcore_debug_symbols) { configs -= [ "//build/config/compiler:default_symbols" ] configs += remove_webcore_symbols_config + if (is_debug) { + configs -= [ "//build/config/compiler:default_optimization" ] + configs += [ "//build/config/compiler:optimize_size_only" ] + } } } diff --git a/chromium/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp b/chromium/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp index 249f2bed3f7..d2ce8c25804 100644 --- a/chromium/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp +++ b/chromium/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp @@ -156,7 +156,8 @@ IDBTransaction::IDBTransaction(ExecutionContext* execution_context, open_db_request_(open_db_request), mode_(kWebIDBTransactionModeVersionChange), state_(kInactive), - old_database_metadata_(old_metadata) { + old_database_metadata_(old_metadata), + scope_() { DCHECK(database_); DCHECK(open_db_request_); DCHECK(scope_.IsEmpty()); diff --git a/chromium/third_party/WebKit/Source/modules/modules.gni b/chromium/third_party/WebKit/Source/modules/modules.gni index 368956c8c69..9abff1fdce6 100644 --- a/chromium/third_party/WebKit/Source/modules/modules.gni +++ b/chromium/third_party/WebKit/Source/modules/modules.gni @@ -74,5 +74,9 @@ set_defaults("blink_modules_sources") { if (remove_webcore_debug_symbols) { configs -= [ "//build/config/compiler:default_symbols" ] configs += remove_webcore_symbols_config + if (is_debug) { + configs -= [ "//build/config/compiler:default_optimization" ] + configs += [ "//build/config/compiler:optimize_size_only" ] + } } } diff --git a/chromium/third_party/WebKit/Source/platform/BUILD.gn b/chromium/third_party/WebKit/Source/platform/BUILD.gn index de62e8f687e..bd3fd80c5cf 100644 --- a/chromium/third_party/WebKit/Source/platform/BUILD.gn +++ b/chromium/third_party/WebKit/Source/platform/BUILD.gn @@ -204,7 +204,7 @@ config("blink_platform_pch") { # This is a string rather than a file GN knows about. It has to match # exactly what's in the /FI flag below, and what might appear in the # source code in quotes for an #include directive. - precompiled_header = rebase_path("Precompile-platform.h", root_build_dir) + precompiled_header = "third_party/WebKit/Source/platform/Precompile-platform.h" # This is a file that GN will compile with the above header. It will be # implicitly added to the sources (potentially multiple times, with one @@ -1647,6 +1647,10 @@ jumbo_component("platform") { if (remove_webcore_debug_symbols) { configs -= [ "//build/config/compiler:default_symbols" ] configs += remove_webcore_symbols_config + if (is_debug) { + configs -= [ "//build/config/compiler:default_optimization" ] + configs += [ "//build/config/compiler:optimize_size_only" ] + } } } diff --git a/chromium/third_party/WebKit/Source/platform/blob/BlobData.cpp b/chromium/third_party/WebKit/Source/platform/blob/BlobData.cpp index 9ed08fae5b0..a0b8099adf0 100644 --- a/chromium/third_party/WebKit/Source/platform/blob/BlobData.cpp +++ b/chromium/third_party/WebKit/Source/platform/blob/BlobData.cpp @@ -291,7 +291,7 @@ BlobDataHandle::BlobDataHandle(std::unique_ptr<BlobData> data, long long size) size_t current_memory_population = 0; Vector<DataElementPtr> elements; - const DataElementPtr null_element = nullptr; + const DataElementPtr null_element(nullptr); BlobBytesProvider* last_bytes_provider = nullptr; RefPtr<WebTaskRunner> file_runner = Platform::Current()->FileTaskRunner(); diff --git a/chromium/third_party/WebKit/Source/platform/fonts/linux/FontRenderStyle.cpp b/chromium/third_party/WebKit/Source/platform/fonts/linux/FontRenderStyle.cpp index 658bc846597..d9dbd283aaf 100644 --- a/chromium/third_party/WebKit/Source/platform/fonts/linux/FontRenderStyle.cpp +++ b/chromium/third_party/WebKit/Source/platform/fonts/linux/FontRenderStyle.cpp @@ -11,10 +11,43 @@ #include "public/platform/linux/WebFontRenderStyle.h" #include "public/platform/linux/WebSandboxSupport.h" +#include "ui/gfx/font_render_params.h" +#include "ui/gfx/font.h" + namespace blink { namespace { +// These functions are also implemented in sandbox_ipc_linux.cc +// Converts gfx::FontRenderParams::Hinting to WebFontRenderStyle::hintStyle. +// Returns an int for serialization, but the underlying Blink type is a char. +int ConvertHinting(gfx::FontRenderParams::Hinting hinting) { + switch (hinting) { + case gfx::FontRenderParams::HINTING_NONE: return 0; + case gfx::FontRenderParams::HINTING_SLIGHT: return 1; + case gfx::FontRenderParams::HINTING_MEDIUM: return 2; + case gfx::FontRenderParams::HINTING_FULL: return 3; + } + NOTREACHED() << "Unexpected hinting value " << hinting; + return 0; +} + +// Converts gfx::FontRenderParams::SubpixelRendering to +// WebFontRenderStyle::useSubpixelRendering. Returns an int for serialization, +// but the underlying Blink type is a char. +int ConvertSubpixelRendering( + gfx::FontRenderParams::SubpixelRendering rendering) { + switch (rendering) { + case gfx::FontRenderParams::SUBPIXEL_RENDERING_NONE: return 0; + case gfx::FontRenderParams::SUBPIXEL_RENDERING_RGB: return 1; + case gfx::FontRenderParams::SUBPIXEL_RENDERING_BGR: return 1; + case gfx::FontRenderParams::SUBPIXEL_RENDERING_VRGB: return 1; + case gfx::FontRenderParams::SUBPIXEL_RENDERING_VBGR: return 1; + } + NOTREACHED() << "Unexpected subpixel rendering value " << rendering; + return 0; +} + SkPaint::Hinting g_skia_hinting = SkPaint::kNormal_Hinting; bool g_use_skia_auto_hint = true; bool g_use_skia_bitmaps = true; @@ -56,10 +89,30 @@ FontRenderStyle FontRenderStyle::QuerySystem(const CString& family, #if defined(OS_ANDROID) style.SetDefaults(); #else - // If the font name is missing (i.e. probably a web font) or the sandbox is - // disabled, use the system defaults. - if (!family.length() || !Platform::Current()->GetSandboxSupport()) { - style.SetDefaults(); + // If the the sandbox is disabled, we can query font parameters directly. + if (!Platform::Current()->GetSandboxSupport()) { + gfx::FontRenderParamsQuery query; + if (family.length()) + query.families.push_back(family.data()); + query.pixel_size = text_size; + switch (font_style.slant()) { + case SkFontStyle::kUpright_Slant: + query.style = gfx::Font::NORMAL; + break; + case SkFontStyle::kItalic_Slant: + case SkFontStyle::kOblique_Slant: + query.style = gfx::Font::ITALIC; + break; + } + query.weight = (gfx::Font::Weight)font_style.weight(); + const gfx::FontRenderParams params = gfx::GetFontRenderParams(query, NULL); + style.use_bitmaps = params.use_bitmaps; + style.use_auto_hint = params.autohinter; + style.use_hinting = params.hinting != gfx::FontRenderParams::HINTING_NONE; + style.hint_style = ConvertHinting(params.hinting); + style.use_anti_alias = params.antialiasing; + style.use_subpixel_rendering = ConvertSubpixelRendering(params.subpixel_rendering); + style.use_subpixel_positioning = params.subpixel_positioning; } else { bool is_bold = font_style.weight() >= SkFontStyle::kSemiBold_Weight; bool is_italic = font_style.slant() != SkFontStyle::kUpright_Slant; @@ -108,8 +161,8 @@ void FontRenderStyle::ApplyToPaint(SkPaint& paint, if (use_anti_alias) paint.setLCDRenderText(use_subpixel_rendering); - // Do not enable subpixel text on low-dpi if full hinting is requested. - bool use_subpixel_text = (paint.getHinting() != SkPaint::kFull_Hinting || + // Do not enable subpixel text on low-dpi if normal or full hinting is requested. + bool use_subpixel_text = (paint.getHinting() < SkPaint::kNormal_Hinting || device_scale_factor > 1.0f); // TestRunner specifically toggles the subpixel positioning flag. diff --git a/chromium/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h b/chromium/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h index d8c66902263..50e39dcb47e 100644 --- a/chromium/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h +++ b/chromium/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.h @@ -9,6 +9,7 @@ #include "platform/graphics/WebGraphicsContext3DProviderWrapper.h" #include "platform/wtf/ThreadSpecific.h" +#include <functional> #include <memory> namespace blink { diff --git a/chromium/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp b/chromium/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp index 5c9a0843067..7995d87ec85 100644 --- a/chromium/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp +++ b/chromium/third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp @@ -829,7 +829,7 @@ std::vector<SkISize> JPEGImageDecoder::GetSupportedDecodeSizes() const { // If you need a specific implementation for other J_COLOR_SPACE values, // please add a full template specialization for this function below. template <J_COLOR_SPACE colorSpace> -void SetPixel(ImageFrame::PixelData*, JSAMPARRAY samples, int column) = delete; +void SetPixel(ImageFrame::PixelData*, JSAMPARRAY samples, int column); // Used only for debugging with libjpeg (instead of libjpeg-turbo). template <> diff --git a/chromium/third_party/WebKit/Source/platform/loader/BUILD.gn b/chromium/third_party/WebKit/Source/platform/loader/BUILD.gn index 7a98510d4c5..f67a023cd8c 100644 --- a/chromium/third_party/WebKit/Source/platform/loader/BUILD.gn +++ b/chromium/third_party/WebKit/Source/platform/loader/BUILD.gn @@ -101,6 +101,7 @@ jumbo_source_set("loader") { "//third_party/WebKit/Source/platform:make_platform_generated", "//third_party/WebKit/common:blink_common", "//third_party/WebKit/public:mojo_bindings_blink", + "//url/mojo:url_mojom_gurl_blink__generator", ] public_deps = [ diff --git a/chromium/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm b/chromium/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm index 6b16f619160..382b1aad9af 100644 --- a/chromium/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm +++ b/chromium/third_party/WebKit/Source/platform/mac/ScrollAnimatorMac.mm @@ -884,7 +884,7 @@ void ScrollAnimatorMac::DidAddVerticalScrollbar(Scrollbar& scrollbar) { vertical_scrollbar_painter_delegate_.AdoptNS( [[BlinkScrollbarPainterDelegate alloc] initWithScrollbar:&scrollbar]); - [painter setDelegate:vertical_scrollbar_painter_delegate_.Get()]; + [painter setDelegate:(id)vertical_scrollbar_painter_delegate_.Get()]; [scrollbar_painter_controller_.Get() setVerticalScrollerImp:painter]; } @@ -910,7 +910,7 @@ void ScrollAnimatorMac::DidAddHorizontalScrollbar(Scrollbar& scrollbar) { horizontal_scrollbar_painter_delegate_.AdoptNS( [[BlinkScrollbarPainterDelegate alloc] initWithScrollbar:&scrollbar]); - [painter setDelegate:horizontal_scrollbar_painter_delegate_.Get()]; + [painter setDelegate:(id)horizontal_scrollbar_painter_delegate_.Get()]; [scrollbar_painter_controller_.Get() setHorizontalScrollerImp:painter]; } diff --git a/chromium/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h b/chromium/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h index baab32aeb68..d29f5e68b93 100644 --- a/chromium/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h +++ b/chromium/third_party/WebKit/Source/platform/scheduler/base/task_queue_impl.h @@ -74,11 +74,8 @@ class PLATFORM_EXPORT TaskQueueImpl { int sequence_num; bool operator<=(const DelayedWakeUp& other) const { - if (time == other.time) { - // Debug gcc builds can compare an element against itself. - DCHECK(sequence_num != other.sequence_num || this == &other); - return (sequence_num - other.sequence_num) < 0; - } + if (time == other.time) + return (sequence_num - other.sequence_num) <= 0; return time < other.time; } }; diff --git a/chromium/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp b/chromium/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp index 7115e14e965..e172783d085 100644 --- a/chromium/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp +++ b/chromium/third_party/WebKit/Source/platform/weborigin/SecurityOrigin.cpp @@ -144,7 +144,7 @@ SecurityOrigin::SecurityOrigin(const KURL& url) port_ = kInvalidPort; // By default, only local SecurityOrigins can load local resources. - can_load_local_resources_ = IsLocal(); + can_load_local_resources_ = IsLocal() || DeprecatedEqualIgnoringCase(protocol_, "qrc"); } SecurityOrigin::SecurityOrigin() diff --git a/chromium/third_party/WebKit/Source/platform/wtf/BUILD.gn b/chromium/third_party/WebKit/Source/platform/wtf/BUILD.gn index 36dbc8a8772..0ed7553ef05 100644 --- a/chromium/third_party/WebKit/Source/platform/wtf/BUILD.gn +++ b/chromium/third_party/WebKit/Source/platform/wtf/BUILD.gn @@ -259,7 +259,7 @@ component("wtf") { configs += [ "//third_party/WebKit/Source:config", "//third_party/WebKit/Source:non_test_config", - "//third_party/WebKit/Source:blink_pch", + "//third_party/WebKit/Source/platform:blink_platform_pch", ] defines = [ "WTF_IMPLEMENTATION=1" ] @@ -321,6 +321,10 @@ component("wtf") { if (remove_webcore_debug_symbols) { configs -= [ "//build/config/compiler:default_symbols" ] configs += remove_webcore_symbols_config + if (is_debug) { + configs -= [ "//build/config/compiler:default_optimization" ] + configs += [ "//build/config/compiler:optimize_size_only" ] + } } } @@ -380,7 +384,7 @@ test("wtf_unittests") { configs += [ "//third_party/WebKit/Source:config", - "//third_party/WebKit/Source:blink_pch", + "//third_party/WebKit/Source/platform:blink_platform_pch", ] deps = [ diff --git a/chromium/third_party/WebKit/Source/platform/wtf/LinkedHashSet.h b/chromium/third_party/WebKit/Source/platform/wtf/LinkedHashSet.h index 2b78d242386..393d5244650 100644 --- a/chromium/third_party/WebKit/Source/platform/wtf/LinkedHashSet.h +++ b/chromium/third_party/WebKit/Source/platform/wtf/LinkedHashSet.h @@ -725,6 +725,8 @@ inline LinkedHashSet<T, U, V, W>& LinkedHashSet<T, U, V, W>::operator=( return *this; } +inline void SwapAnchor(LinkedHashSetNodeBase& a, LinkedHashSetNodeBase& b); + template <typename T, typename U, typename V, typename W> inline void LinkedHashSet<T, U, V, W>::Swap(LinkedHashSet& other) { impl_.swap(other.impl_); diff --git a/chromium/third_party/WebKit/Source/platform/wtf/text/TextCodec.h b/chromium/third_party/WebKit/Source/platform/wtf/text/TextCodec.h index 2f8f3c86638..bef4fd7ab79 100644 --- a/chromium/third_party/WebKit/Source/platform/wtf/text/TextCodec.h +++ b/chromium/third_party/WebKit/Source/platform/wtf/text/TextCodec.h @@ -73,7 +73,7 @@ enum FlushBehavior { static_assert(!kDoNotFlush, "DoNotFlush should be falsy"); static_assert(kFetchEOF, "FetchEOF should be truthy"); -static_assert(kDataEOF, "DataEOF should be truthy"); +static_assert(kDataEOF != 0, "DataEOF should be truthy"); class WTF_EXPORT TextCodec { WTF_MAKE_NONCOPYABLE(TextCodec); diff --git a/chromium/third_party/WebKit/Source/platform/wtf/typed_arrays/ArrayBufferContents.h b/chromium/third_party/WebKit/Source/platform/wtf/typed_arrays/ArrayBufferContents.h index 0671c471cbe..7398df317a6 100644 --- a/chromium/third_party/WebKit/Source/platform/wtf/typed_arrays/ArrayBufferContents.h +++ b/chromium/third_party/WebKit/Source/platform/wtf/typed_arrays/ArrayBufferContents.h @@ -63,13 +63,13 @@ class WTF_EXPORT ArrayBufferContents { allocation_length_(0), data_(data), data_length_(0), - kind_(AllocationKind::kNormal), + kind_(ArrayBufferContents::AllocationKind::kNormal), deleter_(deleter) {} DataHandle(void* allocation_base, size_t allocation_length, void* data, size_t data_length, - AllocationKind kind, + ArrayBufferContents::AllocationKind kind, DataDeleter deleter) : allocation_base_(allocation_base), allocation_length_(allocation_length), @@ -94,11 +94,11 @@ class WTF_EXPORT ArrayBufferContents { reinterpret_cast<uintptr_t>(allocation_base_) + allocation_length_); switch (kind_) { - case AllocationKind::kNormal: + case ArrayBufferContents::AllocationKind::kNormal: DCHECK(deleter_); deleter_(data_); return; - case AllocationKind::kReservation: + case ArrayBufferContents::AllocationKind::kReservation: ReleaseReservedMemory(allocation_base_, allocation_length_); return; } diff --git a/chromium/third_party/WebKit/common/origin_trials/trial_token_validator.cc b/chromium/third_party/WebKit/common/origin_trials/trial_token_validator.cc index ef90800d5b7..a68b239b8be 100644 --- a/chromium/third_party/WebKit/common/origin_trials/trial_token_validator.cc +++ b/chromium/third_party/WebKit/common/origin_trials/trial_token_validator.cc @@ -93,12 +93,14 @@ TrialTokenValidator::GetValidTokensFromHeaders( size_t iter = 0; std::string token; - while (headers->EnumerateHeader(&iter, "Origin-Trial", &token)) { - std::string token_feature; - if (TrialTokenValidator::ValidateToken(token, origin, &token_feature, - current_time) == - OriginTrialTokenStatus::kSuccess) { - (*tokens)[token_feature].push_back(token); + if (headers) { + while (headers->EnumerateHeader(&iter, "Origin-Trial", &token)) { + std::string token_feature; + if (TrialTokenValidator::ValidateToken(token, origin, &token_feature, + current_time) == + OriginTrialTokenStatus::kSuccess) { + (*tokens)[token_feature].push_back(token); + } } } return tokens; diff --git a/chromium/third_party/WebKit/public/web/WebLocalFrame.h b/chromium/third_party/WebKit/public/web/WebLocalFrame.h index 1300a8e3e1e..07e7717568d 100644 --- a/chromium/third_party/WebKit/public/web/WebLocalFrame.h +++ b/chromium/third_party/WebKit/public/web/WebLocalFrame.h @@ -445,6 +445,10 @@ class WebLocalFrame : public WebFrame { virtual void SetIsolatedWorldHumanReadableName(int world_id, const WebString&) = 0; + // Gets or creates the context of the isolated world + // As in requestExecuteScriptInIsolatedWorld: 0 < worldId < EmbedderWorldIdLimit + virtual v8::Local<v8::Context> IsolatedWorldScriptContext(int worldID) const = 0; + // Logs to the console associated with this frame. virtual void AddMessageToConsole(const WebConsoleMessage&) = 0; diff --git a/chromium/third_party/angle/src/gpu_info_util/SystemInfo_x11.cpp b/chromium/third_party/angle/src/gpu_info_util/SystemInfo_x11.cpp index 3513309f36a..792305f5503 100644 --- a/chromium/third_party/angle/src/gpu_info_util/SystemInfo_x11.cpp +++ b/chromium/third_party/angle/src/gpu_info_util/SystemInfo_x11.cpp @@ -30,7 +30,7 @@ bool GetNvidiaDriverVersionWithXNVCtrl(std::string *version) Display *display = XOpenDisplay(nullptr); - if (XNVCTRLQueryExtension(display, &eventBase, &errorBase)) + if (display && XNVCTRLQueryExtension(display, &eventBase, &errorBase)) { int screenCount = ScreenCount(display); for (int screen = 0; screen < screenCount; ++screen) diff --git a/chromium/third_party/boringssl/src/crypto/x509/x509_def.c b/chromium/third_party/boringssl/src/crypto/x509/x509_def.c index cb34ea4a946..20fff123192 100644 --- a/chromium/third_party/boringssl/src/crypto/x509/x509_def.c +++ b/chromium/third_party/boringssl/src/crypto/x509/x509_def.c @@ -59,11 +59,13 @@ /* TODO(fork): cleanup */ +#ifndef OPENSSLDIR #if defined(OPENSSL_FUCHSIA) #define OPENSSLDIR "/system/data/boringssl" #else #define OPENSSLDIR "/etc/ssl" #endif +#endif #define X509_CERT_AREA OPENSSLDIR #define X509_CERT_DIR OPENSSLDIR "/certs" diff --git a/chromium/third_party/cld/README.chromium b/chromium/third_party/cld/README.chromium index 3d2e0e8140c..5b59354d79f 100644 --- a/chromium/third_party/cld/README.chromium +++ b/chromium/third_party/cld/README.chromium @@ -1,6 +1,5 @@ Name: Compact Language Detector Short Name: cld -URL: NA Version: 0 License: Apache 2.0 Security Critical: no diff --git a/chromium/third_party/ffmpeg/BUILD.gn b/chromium/third_party/ffmpeg/BUILD.gn index 6ebb34b68d4..2cfb22008cf 100755 --- a/chromium/third_party/ffmpeg/BUILD.gn +++ b/chromium/third_party/ffmpeg/BUILD.gn @@ -152,9 +152,15 @@ config("ffmpegsumo_warnings") { buildflag_header("ffmpeg_features") { header = "ffmpeg_features.h" - flags = [ - "USE_SYSTEM_FFMPEG=false", - ] + if (use_system_ffmpeg) { + flags = [ + "USE_SYSTEM_FFMPEG=true", + ] + } else { + flags = [ + "USE_SYSTEM_FFMPEG=false", + ] + } } if (is_component_ffmpeg) { @@ -407,6 +413,48 @@ target(link_target_type, "ffmpeg_internal") { } } +if (use_system_ffmpeg) { + import("//build/config/linux/pkg_config.gni") + import("//build/shim_headers.gni") + + pkg_config("system_ffmpeg") { + packages = [ + "libavcodec", + "libavformat", + "libavutil", + ] + } + + shim_headers("libavcodec_shim") { + root_path = "libavcodec" + prefix = "libavcodec/" + headers = [ + "avcodec.h", + ] + } + + shim_headers("libavformat_shim") { + root_path = "libavformat" + prefix = "libavformat/" + headers = [ + "avformat.h", + "avio.h", + ] + } + + shim_headers("libavutil_shim") { + root_path = "libavutil" + prefix = "libavutil/" + headers = [ + "avutil.h", + "imgutils.h", + "log.h", + "mathematics.h", + "opt.h", + ] + } +} + if (is_component_ffmpeg) { shared_library("ffmpeg") { if (is_android) { @@ -437,9 +485,12 @@ if (is_component_ffmpeg) { } } else { source_set("ffmpeg") { - public_configs = [ ":ffmpeg_dependent_config" ] - deps = [ - ":ffmpeg_internal", - ] + if (use_system_ffmpeg) { + public_configs = [ ":system_ffmpeg" ] + deps = [ ":libavcodec_shim", ":libavformat_shim", ":libavutil_shim" ] + } else { + public_configs = [ ":ffmpeg_dependent_config" ] + deps = [ ":ffmpeg_internal" ] + } } } diff --git a/chromium/third_party/ffmpeg/ffmpeg_options.gni b/chromium/third_party/ffmpeg/ffmpeg_options.gni index c51c213923e..dd37c03a1e7 100644 --- a/chromium/third_party/ffmpeg/ffmpeg_options.gni +++ b/chromium/third_party/ffmpeg/ffmpeg_options.gni @@ -49,6 +49,8 @@ declare_args() { # directives as used in chromium's clang stdatomic.h. # Some background: https://bugs.llvm.org/show_bug.cgi?id=26828 ffmpeg_use_atomics_fallback = !is_clang + + use_system_ffmpeg = false } assert(ffmpeg_branding == "Chromium" || diff --git a/chromium/third_party/ffmpeg/libavutil/cpu.c b/chromium/third_party/ffmpeg/libavutil/cpu.c index a22da0fa8c0..ceb36505cdb 100644 --- a/chromium/third_party/ffmpeg/libavutil/cpu.c +++ b/chromium/third_party/ffmpeg/libavutil/cpu.c @@ -17,7 +17,12 @@ */ #include <stdint.h> +// GCC 4.8 doesn't provide stdatomic.h, so use the compat version. +#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) < 409 +#include <compat/atomics/gcc/stdatomic.h> +#else #include <stdatomic.h> +#endif #include "cpu.h" #include "cpu_internal.h" diff --git a/chromium/third_party/flac/BUILD.gn b/chromium/third_party/flac/BUILD.gn index ae81550588b..f6001b59e31 100644 --- a/chromium/third_party/flac/BUILD.gn +++ b/chromium/third_party/flac/BUILD.gn @@ -2,6 +2,13 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/linux/pkg_config.gni") +import("//build/shim_headers.gni") + +declare_args() { + use_system_flac = false +} + config("flac_config") { defines = [ "FLAC__NO_DLL", @@ -22,7 +29,7 @@ config("flac_private_config") { } } -source_set("flac") { +source_set("bundled_flac") { sources = [ "include/FLAC/all.h", "include/FLAC/assert.h", @@ -111,3 +118,33 @@ source_set("flac") { ] } } + +if (use_system_flac) { + pkg_config("system_flac") { + packages = [ "flac" ] + } +} + +shim_headers("flac_shim") { + root_path = "include" + headers = [ + "FLAC/all.h", + "FLAC/assert.h", + "FLAC/callback.h", + "FLAC/export.h", + "FLAC/format.h", + "FLAC/metadata.h", + "FLAC/ordinals.h", + "FLAC/stream_decoder.h", + "FLAC/stream_encoder.h", + ] +} + +group("flac") { + if (use_system_flac) { + deps = [ ":flac_shim" ] + public_configs = [ ":system_flac" ] + } else { + public_deps = [ ":bundled_flac" ] + } +} diff --git a/chromium/third_party/icu/BUILD.gn b/chromium/third_party/icu/BUILD.gn index 3f4cff9163a..41e7c678ffc 100644 --- a/chromium/third_party/icu/BUILD.gn +++ b/chromium/third_party/icu/BUILD.gn @@ -3,8 +3,15 @@ # found in the LICENSE file. import("//build/config/host_byteorder.gni") + +import("//build/config/linux/pkg_config.gni") +import("//build/shim_headers.gni") import("//third_party/icu/config.gni") +declare_args() { + use_system_icu = false +} + if (is_android) { import("//build/config/android/rules.gni") } @@ -23,7 +30,7 @@ group("icu") { } # Shared config used by ICU and all dependents. -config("icu_config") { +config("bundled_icu_config") { defines = [ # Tell ICU to not insert |using namespace icu;| into its headers, # so that chrome's source explicitly has to use |icu::|. @@ -108,7 +115,7 @@ config("icu_code") { } } -component("icui18n") { +component("bundled_icui18n") { # find source/i18n -maxdepth 1 ! -type d | egrep '\.(c|cpp|h)$' |\ # sort | sed 's/^\(.*\)$/ "\1",/' sources = [ @@ -557,7 +564,7 @@ component("icui18n") { } } -component("icuuc") { +component("bundled_icuuc") { # find source/common -maxdepth 1 ! -type d | egrep '\.(c|cpp|h)$' |\ # sort | sed 's/^\(.*\)$/ "\1",/' sources = [ @@ -1003,7 +1010,6 @@ if (current_cpu == "mips" || current_cpu == "mips64" || } data_bundle = "${data_bundle_prefix}.dat" -# TODO(GYP) support use_system_icu. if (icu_use_data_file) { if (is_ios) { bundle_data("icudata") { @@ -1053,3 +1059,241 @@ if (icu_use_data_file) { } } } + +config("system_icu_config") { + defines = [ + "USING_SYSTEM_ICU=1", + "ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC", + ] +} + +if (use_system_icu) { + pkg_config("system_icui18n") { + packages = [ "icu-i18n" ] + } + + pkg_config("system_icuuc") { + packages = [ "icu-uc" ] + } +} + +shim_headers("icui18n_shim") { + root_path = "source/i18n/unicode" + prefix = "unicode/" + headers = [ + # This list can easily be updated using the command below: + # find third_party/icu/source/i18n/unicode \ + # -iname '*.h' -printf '"%p",\n' | \ + # sed -e 's|third_party/icu/source/i18n/unicode/||' | sort -u + "alphaindex.h", + "basictz.h", + "calendar.h", + "choicfmt.h", + "coleitr.h", + "coll.h", + "compactdecimalformat.h", + "curramt.h", + "currpinf.h", + "currunit.h", + "datefmt.h", + "dcfmtsym.h", + "decimfmt.h", + "dtfmtsym.h", + "dtitvfmt.h", + "dtitvinf.h", + "dtptngen.h", + "dtrule.h", + "fieldpos.h", + "fmtable.h", + "format.h", + "fpositer.h", + "gender.h", + "gregocal.h", + "measfmt.h", + "measunit.h", + "measure.h", + "msgfmt.h", + "numfmt.h", + "numsys.h", + "plurfmt.h", + "plurrule.h", + "rbnf.h", + "rbtz.h", + "regex.h", + "region.h", + "reldatefmt.h", + "scientificnumberformatter.h", + "search.h", + "selfmt.h", + "simpletz.h", + "smpdtfmt.h", + "sortkey.h", + "stsearch.h", + "tblcoll.h", + "timezone.h", + "tmunit.h", + "tmutamt.h", + "tmutfmt.h", + "translit.h", + "tzfmt.h", + "tznames.h", + "tzrule.h", + "tztrans.h", + "ucal.h", + "ucoleitr.h", + "ucol.h", + "ucsdet.h", + "udateintervalformat.h", + "udat.h", + "udatpg.h", + "ufieldpositer.h", + "uformattable.h", + "ugender.h", + "ulocdata.h", + "umsg.h", + "unirepl.h", + "unum.h", + "unumsys.h", + "upluralrules.h", + "uregex.h", + "uregion.h", + "usearch.h", + "uspoof.h", + "utmscale.h", + "utrans.h", + "vtzone.h", + ] +} + +shim_headers("icuuc_shim") { + root_path = "source/common/unicode" + prefix = "unicode/" + headers = [ + # This list can easily be updated using the command below: + # find third_party/icu/source/common/unicode \ + # -iname '*.h' -printf '"%p",\n' | \ + # sed -e 's|third_party/icu/source/common/unicode/||' | sort -u + "appendable.h", + "brkiter.h", + "bytestream.h", + "bytestriebuilder.h", + "bytestrie.h", + "caniter.h", + "chariter.h", + "dbbi.h", + "docmain.h", + "dtintrv.h", + "enumset.h", + "errorcode.h", + "filteredbrk.h", + "icudataver.h", + "icuplug.h", + "idna.h", + "listformatter.h", + "localpointer.h", + "locdspnm.h", + "locid.h", + "messagepattern.h", + "normalizer2.h", + "normlzr.h", + "parseerr.h", + "parsepos.h", + "platform.h", + "ptypes.h", + "putil.h", + "rbbi.h", + "rep.h", + "resbund.h", + "schriter.h", + "std_string.h", + "strenum.h", + "stringpiece.h", + "stringtriebuilder.h", + "symtable.h", + "ubidi.h", + "ubrk.h", + "ucasemap.h", + "ucat.h", + "uchar.h", + "ucharstriebuilder.h", + "ucharstrie.h", + "uchriter.h", + "uclean.h", + "ucnv_cb.h", + "ucnv_err.h", + "ucnv.h", + "ucnvsel.h", + "uconfig.h", + "ucurr.h", + "udata.h", + "udisplaycontext.h", + "uenum.h", + "uidna.h", + "uiter.h", + "uldnames.h", + "ulistformatter.h", + "uloc.h", + "umachine.h", + "umisc.h", + "unifilt.h", + "unifunct.h", + "unimatch.h", + "uniset.h", + "unistr.h", + "unorm2.h", + "unorm.h", + "uobject.h", + "urename.h", + "urep.h", + "ures.h", + "uscript.h", + "uset.h", + "usetiter.h", + "ushape.h", + "usprep.h", + "ustring.h", + "ustringtrie.h", + "utext.h", + "utf16.h", + "utf32.h", + "utf8.h", + "utf.h", + "utf_old.h", + "utrace.h", + "utypes.h", + "uvernum.h", + "uversion.h", + ] +} + +config("icu_config") { + if (use_system_icu) { + configs = [ ":system_icu_config"] + } else { + configs = [ ":bundled_icu_config"] + } +} + +group("icuuc") { + if (use_system_icu) { + deps = [ ":icuuc_shim" ] + public_configs = [ + ":system_icu_config", + ":system_icuuc", + ] + } else { + public_deps = [ ":bundled_icuuc" ] + } +} + +group("icui18n") { + if (use_system_icu) { + deps = [ ":icui18n_shim" ] + public_configs = [ + ":system_icu_config", + ":system_icui18n", + ] + } else { + public_deps = [ ":bundled_icui18n" ] + } +} diff --git a/chromium/third_party/libpng/BUILD.gn b/chromium/third_party/libpng/BUILD.gn index 3d9eac6b90c..34af412a233 100644 --- a/chromium/third_party/libpng/BUILD.gn +++ b/chromium/third_party/libpng/BUILD.gn @@ -5,6 +5,10 @@ import("//build/config/chromecast_build.gni") import("//build/config/arm.gni") +declare_args() { + use_system_libpng = false +} + config("libpng_config") { include_dirs = [ "." ] @@ -102,16 +106,35 @@ source_set("libpng_sources") { configs += [ ":clang_warnings" ] } -if (is_win) { - component("libpng") { - public_deps = [ - ":libpng_sources", - ] +if (!use_system_libpng) { + if (is_win) { + component("libpng") { + public_deps = [ + ":libpng_sources", + ] + } + } else { + group("libpng") { + public_deps = [ + ":libpng_sources", + ] + } } } else { - group("libpng") { - public_deps = [ - ":libpng_sources", + import("//build/config/linux/pkg_config.gni") + import("//build/shim_headers.gni") + pkg_config("system_libpng") { + packages = [ "libpng" ] + } + shim_headers("libpng_shim") { + root_path = "." + headers = [ + "png.h", + "pngconf.h", ] } + source_set("libpng") { + deps = [ ":libpng_shim" ] + public_configs = [ ":system_libpng" ] + } } diff --git a/chromium/third_party/libvpx/BUILD.gn b/chromium/third_party/libvpx/BUILD.gn index c2617354477..9026358505a 100644 --- a/chromium/third_party/libvpx/BUILD.gn +++ b/chromium/third_party/libvpx/BUILD.gn @@ -4,10 +4,16 @@ import("//build/config/arm.gni") import("//build/config/android/config.gni") +import("//build/config/linux/pkg_config.gni") import("//build/config/sanitizers/sanitizers.gni") +import("//build/shim_headers.gni") import("//third_party/libvpx/libvpx_srcs.gni") import("//third_party/yasm/yasm_assemble.gni") +declare_args() { + use_system_libvpx = false +} + # Sets the architecture name for building libvpx. if (current_cpu == "x86") { cpu_arch_full = "ia32" @@ -286,7 +292,7 @@ if (current_cpu == "arm" && arm_assembly_sources != []) { } } -static_library("libvpx") { +static_library("bundled_libvpx") { if (!is_debug && is_win) { configs -= [ "//build/config/compiler:default_optimization" ] configs += [ "//build/config/compiler:optimize_max" ] @@ -344,3 +350,34 @@ static_library("libvpx") { public_configs = [ ":libvpx_external_config" ] } + +if (use_system_libvpx) { + pkg_config("system_libvpx") { + packages = [ "vpx" ] + } +} + +shim_headers("libvpx_shim") { + root_path = "source/libvpx/vpx" + prefix = "vpx/" + headers = [ + "vp8.h", + "vp8cx.h", + "vp8dx.h", + "vpx_codec.h", + "vpx_decoder.h", + "vpx_encoder.h", + "vpx_frame_buffer.h", + "vpx_image.h", + "vpx_integer.h", + ] +} + +group("libvpx") { + if (use_system_libvpx) { + deps = [ ":libvpx_shim" ] + public_configs = [ ":system_libvpx" ] + } else { + public_deps = [ ":bundled_libvpx" ] + } +} diff --git a/chromium/third_party/libwebp/BUILD.gn b/chromium/third_party/libwebp/BUILD.gn index 1b2342f83c5..91483026f9e 100644 --- a/chromium/third_party/libwebp/BUILD.gn +++ b/chromium/third_party/libwebp/BUILD.gn @@ -4,6 +4,11 @@ import("//build/config/arm.gni") import("//build/config/sanitizers/sanitizers.gni") +import("//build/config/linux/pkg_config.gni") + +declare_args() { + use_system_libwebp = false +} config("libwebp_config") { include_dirs = [ "./src" ] @@ -358,18 +363,29 @@ static_library("libwebp_utils") { public_configs = [ ":libwebp_utils_warnings" ] } -group("libwebp") { - deps = [ - ":libwebp_dec", - ":libwebp_demux", - ":libwebp_dsp", - ":libwebp_enc", - ":libwebp_mux", - ":libwebp_utils", - ] - public_configs = [ ":libwebp_config" ] - if (use_dsp_neon) { - deps += [ ":libwebp_dsp_neon" ] +if (!use_system_libwebp) { + group("libwebp") { + deps = [ + ":libwebp_dec", + ":libwebp_demux", + ":libwebp_dsp", + ":libwebp_enc", + ":libwebp_mux", + ":libwebp_utils", + ] + public_configs = [ ":libwebp_config" ] + if (use_dsp_neon) { + deps += [ ":libwebp_dsp_neon" ] + } + } +} + +if (use_system_libwebp) { + pkg_config("system_libwebp") { + packages = [ "libwebp", "libwebpmux", "libwebpdemux" ] + } + group("libwebp") { + public_configs = [ ":system_libwebp" ] } } diff --git a/chromium/third_party/libxml/BUILD.gn b/chromium/third_party/libxml/BUILD.gn index f64fdbc5285..cac8c9260a5 100644 --- a/chromium/third_party/libxml/BUILD.gn +++ b/chromium/third_party/libxml/BUILD.gn @@ -12,6 +12,10 @@ if (is_linux || is_android || is_nacl || is_fuchsia) { os_include = "win32" } +declare_args() { + use_system_libxml = false +} + config("libxml_config") { # Define LIBXML_STATIC as nothing to match how libxml.h (an internal header) # defines LIBXML_STATIC, otherwise we get the macro redefined warning from @@ -73,7 +77,7 @@ config("libxml_warnings") { } } -static_library("libxml") { +static_library("bundled_libxml") { output_name = "libxml2" # Commented out sources are libxml2 files we do not want to include. They are @@ -236,3 +240,22 @@ static_library("libxml") { include_dirs = [ "$os_include" ] } + +if (use_system_libxml) { + import("//build/config/linux/pkg_config.gni") + pkg_config("system_libxml") { + packages = [ "libxml-2.0" ] + } + source_set("libxml") { + sources = [ + "chromium/libxml_utils.cc", + "chromium/libxml_utils.h", + ] + + public_configs = [ ":system_libxml" ] + } +} else { + group("libxml") { + public_deps = [ ":bundled_libxml" ] + } +} diff --git a/chromium/third_party/libxslt/BUILD.gn b/chromium/third_party/libxslt/BUILD.gn index de0653472f2..65ec774a8af 100644 --- a/chromium/third_party/libxslt/BUILD.gn +++ b/chromium/third_party/libxslt/BUILD.gn @@ -2,6 +2,10 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +declare_args() { + use_system_libxslt = false +} + config("libxslt_config") { defines = [ "LIBXSLT_STATIC" ] include_dirs = [ "src" ] @@ -20,7 +24,7 @@ config("libxslt_warnings") { } } -static_library("libxslt") { +static_library("bundled_libxslt") { sources = [ "linux/config.h", "mac/config.h", @@ -101,3 +105,17 @@ static_library("libxslt") { "//third_party/libxml", ] } + +if (use_system_libxslt) { + import("//build/config/linux/pkg_config.gni") + pkg_config("system_libxslt") { + packages = [ "libxslt" ] + } + source_set("libxslt") { + public_configs = [ ":system_libxslt" ] + } +} else { + group("libxslt") { + public_deps = [ ":bundled_libxslt" ] + } +} diff --git a/chromium/third_party/libyuv/BUILD.gn b/chromium/third_party/libyuv/BUILD.gn index 34a9975bf82..fb19c5d4c88 100644 --- a/chromium/third_party/libyuv/BUILD.gn +++ b/chromium/third_party/libyuv/BUILD.gn @@ -7,6 +7,7 @@ # be found in the AUTHORS file in the root of the source tree. import("libyuv.gni") +import("//build/config/features.gni") import("//testing/test.gni") declare_args() { @@ -44,7 +45,7 @@ group("default") { group("libyuv") { public_configs = [ ":libyuv_config" ] - if (is_win && target_cpu == "x64") { + if (is_win && target_cpu == "x64" && !use_qt) { # Compile with clang in order to get inline assembly public_deps = [ ":libyuv_internal(//build/toolchain/win:win_clang_x64)", diff --git a/chromium/third_party/mesa/src/src/gallium/state_trackers/d3d1x/w32api b/chromium/third_party/mesa/src/src/gallium/state_trackers/d3d1x/w32api deleted file mode 120000 index e47a1989e10..00000000000 --- a/chromium/third_party/mesa/src/src/gallium/state_trackers/d3d1x/w32api +++ /dev/null @@ -1 +0,0 @@ -/usr/include/wine/windows
\ No newline at end of file diff --git a/chromium/third_party/openh264/BUILD.gn b/chromium/third_party/openh264/BUILD.gn index 7b9d4588b80..e33b5233b5b 100644 --- a/chromium/third_party/openh264/BUILD.gn +++ b/chromium/third_party/openh264/BUILD.gn @@ -2,7 +2,9 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/linux/pkg_config.gni") import("//build/config/sanitizers/sanitizers.gni") +import("//build/shim_headers.gni") import("//third_party/openh264/openh264_args.gni") import("//third_party/openh264/openh264_sources.gni") import("//third_party/yasm/yasm_assemble.gni") @@ -101,7 +103,7 @@ if (use_assembler) { } } # if (is_win || is_linux) -source_set("common") { +source_set("bundled_common") { sources = openh264_common_sources include_dirs = openh264_common_include_dirs @@ -124,7 +126,7 @@ source_set("common") { } } -source_set("processing") { +source_set("bundled_processing") { sources = openh264_processing_sources include_dirs = openh264_processing_include_dirs @@ -132,7 +134,7 @@ source_set("processing") { configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ ":config" ] deps = [ - ":common", + ":bundled_common", ] if (use_assembler) { defines = [ "X86_ASM" ] @@ -140,7 +142,7 @@ source_set("processing") { } } -source_set("encoder") { +source_set("bundled_encoder") { sources = openh264_encoder_sources include_dirs = openh264_encoder_include_dirs @@ -154,11 +156,55 @@ source_set("encoder") { configs -= [ "//build/config/clang:extra_warnings" ] } deps = [ - ":common", - ":processing", + ":bundled_common", + ":bundled_processing", ] if (use_assembler) { defines = [ "X86_ASM" ] deps += [ ":openh264_encoder_yasm" ] } } + +if (use_system_openh264) { + pkg_config("system_openh264") { + packages = [ "openh264" ] + } +} + +shim_headers("openh264_shim") { + prefix = "wels/" + root_path = "src/codec/api/svc" + headers = [ + "codec_api.h", + "codec_app_def.h", + "codec_def.h", + "codec_ver.h", + ] +} + +group("common") { + if (use_system_openh264) { + deps = [ ":openh264_shim" ] + public_configs = [ ":system_openh264" ] + } else { + public_deps = [ ":bundled_common" ] + } +} + +group("processing") { + if (use_system_openh264) { + deps = [ ":openh264_shim" ] + public_configs = [ ":system_openh264" ] + } else { + public_deps = [ ":bundled_processing" ] + } +} + +group("encoder") { + if (use_system_openh264) { + deps = [ ":openh264_shim" ] + public_configs = [ ":system_openh264" ] + } else { + public_deps = [ ":bundled_encoder" ] + } +} diff --git a/chromium/third_party/openh264/openh264_args.gni b/chromium/third_party/openh264/openh264_args.gni index b7558fbd5bf..a1d20380fc3 100644 --- a/chromium/third_party/openh264/openh264_args.gni +++ b/chromium/third_party/openh264/openh264_args.gni @@ -9,4 +9,5 @@ declare_args() { # CHECK THE OPENH264 LICENSE/PATENT BEFORE BUILDING, see # http://www.openh264.org/. use_openh264 = false + use_system_openh264 = false } diff --git a/chromium/third_party/opus/BUILD.gn b/chromium/third_party/opus/BUILD.gn index ac0c9522b78..e9a7d13f53e 100644 --- a/chromium/third_party/opus/BUILD.gn +++ b/chromium/third_party/opus/BUILD.gn @@ -3,8 +3,14 @@ # found in the LICENSE file. import("//build/config/arm.gni") +import("//build/config/linux/pkg_config.gni") +import("//build/shim_headers.gni") import("//testing/test.gni") +declare_args() { + use_system_opus = false +} + # If fixed point implementation shall be used (otherwise float). use_opus_fixed_point = current_cpu == "arm" || current_cpu == "arm64" @@ -56,7 +62,7 @@ if (use_opus_rtcd) { } } -static_library("opus") { +static_library("bundled_opus") { sources = [ "src/celt/_kiss_fft_guts.h", "src/celt/arch.h", @@ -523,3 +529,29 @@ test("test_opus_padding") { ":opus", ] } + +if (use_system_opus) { + pkg_config("system_opus") { + packages = [ "opus" ] + } +} + +shim_headers("opus_shim") { + root_path = "src/include" + headers = [ + "opus.h", + "opus_custom.h", + "opus_defines.h", + "opus_multistream.h", + "opus_types.h", + ] +} + +group("opus") { + if (use_system_opus) { + deps = [ ":opus_shim" ] + public_configs = [ ":system_opus" ] + } else { + public_deps = [ ":bundled_opus" ] + } +} diff --git a/chromium/third_party/pdfium/pdfium.gni b/chromium/third_party/pdfium/pdfium.gni index 530301a5d9b..41616685d00 100644 --- a/chromium/third_party/pdfium/pdfium.gni +++ b/chromium/third_party/pdfium/pdfium.gni @@ -57,7 +57,7 @@ declare_args() { use_coverage = false # Don't build against bundled zlib. - use_system_zlib = false + pdfium_use_system_zlib = false # Don't build against bundled lcms2. use_system_lcms2 = false diff --git a/chromium/third_party/pdfium/third_party/BUILD.gn b/chromium/third_party/pdfium/third_party/BUILD.gn index 3411b656ef1..51e844086d4 100644 --- a/chromium/third_party/pdfium/third_party/BUILD.gn +++ b/chromium/third_party/pdfium/third_party/BUILD.gn @@ -329,7 +329,7 @@ config("system_zlib_config") { } group("zlib") { - if (use_system_zlib) { + if (pdfium_use_system_zlib) { public_configs = [ ":system_zlib_config" ] } else { public_deps = [ diff --git a/chromium/third_party/re2/BUILD.gn b/chromium/third_party/re2/BUILD.gn index b96f75402bf..5d12bd266d1 100644 --- a/chromium/third_party/re2/BUILD.gn +++ b/chromium/third_party/re2/BUILD.gn @@ -3,12 +3,17 @@ # found in the LICENSE file. import("//testing/libfuzzer/fuzzer_test.gni") +import("//build/shim_headers.gni") + +declare_args() { + use_system_re2 = false +} config("re2_config") { include_dirs = [ "src" ] } -static_library("re2") { +static_library("bundled_re2") { sources = [ "src/re2/bitmap256.h", "src/re2/bitstate.cc", @@ -68,3 +73,27 @@ fuzzer_test("third_party_re2_fuzzer") { ":re2", ] } + +shim_headers("re2_shim") { + root_path = "src/re2" + prefix = "re2/" + headers = [ + "filtered_re2.h", + "re2.h", + "set.h", + "stringpiece.h" + ] +} + +source_set("system_re2") { + deps = [ ":re2_shim" ] + libs = [ "re2" ] +} + +group("re2") { + if (use_system_re2) { + public_deps = [ ":system_re2" ] + } else { + public_deps = [ ":bundled_re2" ] + } +} diff --git a/chromium/third_party/skia/dm/DM.cpp b/chromium/third_party/skia/dm/DM.cpp index 6b76a92a1e9..f95b622a865 100644 --- a/chromium/third_party/skia/dm/DM.cpp +++ b/chromium/third_party/skia/dm/DM.cpp @@ -51,7 +51,7 @@ extern void SkPDFImageDumpStats(); #endif -#include "png.h" +#include "third_party/libpng/png.h" #include <stdlib.h> diff --git a/chromium/third_party/skia/include/private/GrSwizzle.h b/chromium/third_party/skia/include/private/GrSwizzle.h index db645dbe49b..e52379f9e16 100644 --- a/chromium/third_party/skia/include/private/GrSwizzle.h +++ b/chromium/third_party/skia/include/private/GrSwizzle.h @@ -126,9 +126,10 @@ public: case 3: return AAAA(); default: - SK_ABORT("Mod is broken?!?"); - return RGBA(); + break; } + SK_ABORT("Mod is broken?!?"); + return RGBA(); } }; diff --git a/chromium/third_party/skia/src/codec/SkPngCodec.cpp b/chromium/third_party/skia/src/codec/SkPngCodec.cpp index 1c88b4780fe..aa8125038f8 100644 --- a/chromium/third_party/skia/src/codec/SkPngCodec.cpp +++ b/chromium/third_party/skia/src/codec/SkPngCodec.cpp @@ -21,7 +21,7 @@ #include "SkTemplates.h" #include "SkUtils.h" -#include "png.h" +#include "third_party/libpng/png.h" #include <algorithm> // This warning triggers false postives way too often in here. diff --git a/chromium/third_party/skia/src/images/SkPngEncoder.cpp b/chromium/third_party/skia/src/images/SkPngEncoder.cpp index 748953fb4d6..0dfdbddaf4b 100644 --- a/chromium/third_party/skia/src/images/SkPngEncoder.cpp +++ b/chromium/third_party/skia/src/images/SkPngEncoder.cpp @@ -16,7 +16,7 @@ #include "SkString.h" #include "SkPngEncoder.h" -#include "png.h" +#include "third_party/libpng/png.h" static_assert(PNG_FILTER_NONE == (int)SkPngEncoder::FilterFlag::kNone, "Skia libpng filter err."); static_assert(PNG_FILTER_SUB == (int)SkPngEncoder::FilterFlag::kSub, "Skia libpng filter err."); diff --git a/chromium/third_party/skia/tools/debugger/SkDrawCommand.cpp b/chromium/third_party/skia/tools/debugger/SkDrawCommand.cpp index 3e05da05729..a467399d0fd 100644 --- a/chromium/third_party/skia/tools/debugger/SkDrawCommand.cpp +++ b/chromium/third_party/skia/tools/debugger/SkDrawCommand.cpp @@ -7,7 +7,7 @@ #include "SkDrawCommand.h" -#include "png.h" +#include "third_party/libpng/png.h" #include "SkAutoMalloc.h" #include "SkBlurMaskFilter.h" diff --git a/chromium/third_party/skia/tools/gyp b/chromium/third_party/skia/tools/gyp deleted file mode 120000 index d871f5b0075..00000000000 --- a/chromium/third_party/skia/tools/gyp +++ /dev/null @@ -1 +0,0 @@ -../third_party/externals/gyp/
\ No newline at end of file diff --git a/chromium/third_party/snappy/BUILD.gn b/chromium/third_party/snappy/BUILD.gn index 324a06ab58d..ac48dd018a4 100644 --- a/chromium/third_party/snappy/BUILD.gn +++ b/chromium/third_party/snappy/BUILD.gn @@ -2,7 +2,9 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//testing/test.gni") +declare_args() { + use_system_snappy = false +} config("snappy_config") { include_dirs = [ "src" ] @@ -32,7 +34,7 @@ config("snappy_warnings") { } } -static_library("snappy") { +static_library("bundled_snappy") { sources = [ "src/snappy-internal.h", "src/snappy-sinksource.cc", @@ -64,3 +66,38 @@ static_library("snappy") { # platforms that we build for. defines = [ "HAVE_CONFIG_H" ] } + +if (use_system_snappy) { + import("//build/shim_headers.gni") + + shim_headers("snappy_shim") { + root_path = "src" + headers = [ + "snappy-c.h", + "snappy-sinksource.h", + "snappy.h", + ] + } + shim_headers("snappy_shim_platform") { + if (is_win) { + root_path = "win32" + } else if (is_mac) { + root_path = "mac" + } else { + root_path = "linux" + } + headers = [ "snappy-stubs-public.h" ] + } + + source_set("snappy") { + deps = [ + ":snappy_shim", + ":snappy_shim_platform" + ] + libs = [ "snappy" ] + } +} else { + group("snappy") { + public_deps = [ ":bundled_snappy" ] + } +} diff --git a/chromium/third_party/wayland/BUILD.gn b/chromium/third_party/wayland/BUILD.gn index b77082766d1..00bbf27b7d1 100644 --- a/chromium/third_party/wayland/BUILD.gn +++ b/chromium/third_party/wayland/BUILD.gn @@ -2,6 +2,10 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +declare_args() { + use_system_libffi = true +} + config("wayland_config") { include_dirs = [ "include/src", @@ -33,9 +37,13 @@ static_library("wayland_private") { configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code", - "//build/config/linux/libffi", ":wayland_config", ] + if (use_system_libffi) { + configs += [ + "//build/config/linux/libffi" + ] + } } static_library("wayland_protocol") { @@ -70,9 +78,14 @@ static_library("wayland_server") { configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code", - "//build/config/linux/libffi", ] + if (use_system_libffi) { + configs += [ + "//build/config/linux/libffi" + ] + } + public_configs = [ ":wayland_config" ] } @@ -91,8 +104,13 @@ static_library("wayland_client") { configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code", - "//build/config/linux/libffi", ] + if (use_system_libffi) { + configs += [ + "//build/config/linux/libffi" + ] + } + public_configs = [ ":wayland_config" ] } diff --git a/chromium/third_party/webrtc/modules/desktop_capture/screen_capturer_mac.mm b/chromium/third_party/webrtc/modules/desktop_capture/screen_capturer_mac.mm index bd116dd6c0a..4f4df7d8137 100644 --- a/chromium/third_party/webrtc/modules/desktop_capture/screen_capturer_mac.mm +++ b/chromium/third_party/webrtc/modules/desktop_capture/screen_capturer_mac.mm @@ -748,7 +748,7 @@ std::unique_ptr<DesktopCapturer> DesktopCapturer::CreateRawScreenCapturer( return nullptr; } - return capturer; + return std::move(capturer); } } // namespace webrtc diff --git a/chromium/third_party/widevine/cdm/widevine_cdm_common.h b/chromium/third_party/widevine/cdm/widevine_cdm_common.h index 49ace0422a9..928edb0d1ff 100644 --- a/chromium/third_party/widevine/cdm/widevine_cdm_common.h +++ b/chromium/third_party/widevine/cdm/widevine_cdm_common.h @@ -64,7 +64,7 @@ const char kCdmSupportedCodecVp9[] = "vp9.0"; const char kCdmSupportedCodecAvc1[] = "avc1"; #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) -#if defined(OS_MACOSX) || defined(OS_WIN) +#if (defined(OS_MACOSX) || defined(OS_WIN)) && !defined(TOOLKIT_QT) // CDM is installed by the component installer instead of the Chrome installer. #define WIDEVINE_CDM_IS_COMPONENT #endif // defined(OS_MACOSX) || defined(OS_WIN) diff --git a/chromium/third_party/zlib/BUILD.gn b/chromium/third_party/zlib/BUILD.gn index 11f57effb5a..8592b0dca71 100644 --- a/chromium/third_party/zlib/BUILD.gn +++ b/chromium/third_party/zlib/BUILD.gn @@ -2,6 +2,13 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/shim_headers.gni") + +declare_args() { + use_system_zlib = false + use_system_minizip = false +} + if (current_cpu == "arm" || current_cpu == "arm64") { import("//build/config/arm.gni") } @@ -85,7 +92,7 @@ config("zlib_warnings") { } } -static_library("zlib") { +static_library("bundled_zlib") { if (!is_win) { # Don't stomp on "libzlib" on other platforms. output_name = "chrome_zlib" @@ -167,6 +174,31 @@ static_library("zlib") { ] } +shim_headers("zlib_shim") { + root_path = "." + headers = [ "zlib.h" ] +} + +config("use_system_zlib") { + defines = [ "USE_SYSTEM_ZLIB=1" ] +} + +source_set("system_zlib") { + deps = [ + ":zlib_shim", + ] + libs = [ "z" ] + public_configs = [ ":use_system_zlib" ] +} + +group("zlib") { + if (use_system_zlib) { + public_deps = [ ":system_zlib" ] + } else { + public_deps = [ ":bundled_zlib" ] + } +} + config("minizip_warnings") { visibility = [ ":*" ] if (is_clang) { @@ -175,7 +207,7 @@ config("minizip_warnings") { } } -static_library("minizip") { +static_library("bundled_minizip") { sources = [ "contrib/minizip/ioapi.c", "contrib/minizip/ioapi.h", @@ -213,3 +245,56 @@ static_library("minizip") { public_configs = [ ":zlib_config" ] } + +shim_headers("minizip_shim") { + root_path = "contrib/minizip" + prefix = "minizip/" + headers = [ + "crypt.h", + "ioapi.h", + "iowin32.h", + "mztools.h", + "unzip.h", + "zip.h", + ] +} + +source_set("system_minizip") { + deps = [ + ":minizip_shim", + ] + libs = [ "minizip" ] +} + +group("minizip") { + if (use_system_minizip) { + public_deps = [ ":system_minizip" ] + } else { + public_deps = [ ":bundled_minizip" ] + } +} + +static_library("zip") { + sources = [ + "google/zip.cc", + "google/zip.h", + "google/zip_internal.cc", + "google/zip_internal.h", + "google/zip_reader.cc", + "google/zip_reader.h", + ] + deps = [ + ":minizip", + "//base", + ] +} + +static_library("compression_utils") { + sources = [ + "google/compression_utils.cc", + "google/compression_utils.h", + ] + deps = [ + ":zlib", + ] +} diff --git a/chromium/tools/gn/BUILD.gn b/chromium/tools/gn/BUILD.gn index ecd84acd60f..7948c2d393f 100644 --- a/chromium/tools/gn/BUILD.gn +++ b/chromium/tools/gn/BUILD.gn @@ -161,6 +161,8 @@ static_library("gn_lib") { "pool.h", "qt_creator_writer.cc", "qt_creator_writer.h", + "qmake_link_writer.cc", + "qmake_link_writer.h", "runtime_deps.cc", "runtime_deps.h", "scheduler.cc", @@ -320,6 +322,7 @@ test("gn_unittests") { "parser_unittest.cc", "path_output_unittest.cc", "pattern_unittest.cc", + "qmake_link_writer_unittest.cc", "runtime_deps_unittest.cc", "scope_per_file_provider_unittest.cc", "scope_unittest.cc", diff --git a/chromium/tools/gn/bootstrap/bootstrap.py b/chromium/tools/gn/bootstrap/bootstrap.py index f154ed2ef3e..d27e4e7b1e0 100755 --- a/chromium/tools/gn/bootstrap/bootstrap.py +++ b/chromium/tools/gn/bootstrap/bootstrap.py @@ -68,6 +68,8 @@ def run_build(tempdir, options): else: build_rel = os.path.join('out', 'Release') build_root = os.path.join(SRC_ROOT, build_rel) + if options.shadow: + build_root = os.getcwd() print 'Building gn manually in a temporary directory for bootstrapping...' build_gn_with_ninja_manually(tempdir, options) @@ -79,8 +81,9 @@ def run_build(tempdir, options): out_gn += '.exe' if options.no_rebuild: - mkdir_p(build_root) - shutil.copy2(temp_gn, out_gn) + if temp_gn != out_gn: + mkdir_p(build_root) + shutil.copy2(temp_gn, out_gn) else: print 'Building gn using itself to %s...' % build_rel build_gn_with_gn(temp_gn, build_root, options) @@ -103,7 +106,7 @@ def main(argv): help='Do a debug build. Defaults to release build.') parser.add_option('-o', '--output', help='place output in PATH', metavar='PATH') - parser.add_option('-s', '--no-rebuild', action='store_true', + parser.add_option('-n', '--no-rebuild', action='store_true', help='Do not rebuild GN with GN.') parser.add_option('--no-clean', action='store_true', help='Re-used build directory instead of using new ' @@ -111,6 +114,9 @@ def main(argv): parser.add_option('--gn-gen-args', help='Args to pass to gn gen --args') parser.add_option('-v', '--verbose', action='store_true', help='Log more details') + parser.add_option('-s', '--shadow', action='store_true', + help='Use current dir as build dir') + parser.add_option('-p', '--path', help='Path to ninja binary') options, args = parser.parse_args(argv) if args: @@ -124,6 +130,9 @@ def main(argv): if not os.path.exists(build_dir): os.makedirs(build_dir) return run_build(build_dir, options) + elif options.shadow: + build_dir = os.getcwd() + return run_build(build_dir, options) else: with scoped_tempdir() as tempdir: return run_build(tempdir, options) @@ -206,6 +215,8 @@ def build_gn_with_ninja_manually(tempdir, options): write_gn_ninja(os.path.join(tempdir, 'build.ninja'), root_gen_dir, options) cmd = ['ninja', '-C', tempdir, '-w', 'dupbuild=err'] + if options.path: + cmd[0] = options.path if options.verbose: cmd.append('-v') @@ -320,9 +331,14 @@ def write_gn_ninja(path, root_gen_dir, options): ld = cxx ar = os.environ.get('AR', 'ar') - cflags = os.environ.get('CFLAGS', '').split() - cflags_cc = os.environ.get('CXXFLAGS', '').split() - ldflags = os.environ.get('LDFLAGS', '').split() + # QTBUG-64759 + # cflags = os.environ.get('CFLAGS', '').split() + # cflags_cc = os.environ.get('CXXFLAGS', '').split() + # ldflags = os.environ.get('LDFLAGS', '').split() + cflags = [] + cflags_cc = [] + ldflags = [] + include_dirs = [root_gen_dir, SRC_ROOT] libs = [] @@ -342,12 +358,16 @@ def write_gn_ninja(path, root_gen_dir, options): # logic inside //build/toolchain. cflags.extend(['-O2', '-g0']) + # Always set TOOLKIT_QT define, because use_qt GN argument is not used for the initial GN build. + cflags.extend(['-DTOOLKIT_QT']) + cflags.extend([ '-D_FILE_OFFSET_BITS=64', '-D__STDC_CONSTANT_MACROS', '-D__STDC_FORMAT_MACROS', '-pthread', '-pipe', - '-fno-exceptions' + '-fno-exceptions', + '-D__STDC_FORMAT_MACROS' ]) cflags_cc.extend(['-std=c++14', '-Wno-c++11-narrowing']) if is_aix: @@ -372,7 +392,6 @@ def write_gn_ninja(path, root_gen_dir, options): '/GR-', '/D_HAS_EXCEPTIONS=0', ]) - target_arch = windows_target_build_arch() if target_arch == 'x64': ldflags.extend(['/MACHINE:x64']) @@ -612,6 +631,12 @@ def write_gn_ninja(path, root_gen_dir, options): 'base/time/time_conversion_posix.cc', 'base/trace_event/heap_profiler_allocation_register_posix.cc', ]) + if not is_mac: + static_libraries['base']['sources'].extend([ + 'base/time/time_now_posix.cc', + 'base/time/time_exploded_posix.cc', + ]) + static_libraries['libevent'] = { 'sources': [ 'base/third_party/libevent/buffer.c', @@ -656,8 +681,6 @@ def write_gn_ninja(path, root_gen_dir, options): 'base/strings/sys_string_conversions_posix.cc', 'base/synchronization/waitable_event_posix.cc', 'base/sys_info_linux.cc', - 'base/time/time_exploded_posix.cc', - 'base/time/time_now_posix.cc', 'base/threading/platform_thread_linux.cc', ]) if is_linux: @@ -665,7 +688,7 @@ def write_gn_ninja(path, root_gen_dir, options): 'base/allocator/allocator_shim.cc', 'base/allocator/allocator_shim_default_dispatch_to_glibc.cc', ]) - libs.extend(['-lrt', '-latomic']) + libs.extend(['-lrt']) static_libraries['libevent']['include_dirs'].extend([ os.path.join(SRC_ROOT, 'base', 'third_party', 'libevent', 'linux') ]) @@ -821,9 +844,13 @@ def build_gn_with_gn(temp_gn, build_dir, options): if not options.debug: gn_gen_args += ' is_debug=false' cmd = [temp_gn, 'gen', build_dir, '--args=%s' % gn_gen_args] + if sys.executable: + cmd.append('--script-executable=%s' % sys.executable) check_call(cmd) cmd = ['ninja', '-C', build_dir, '-w', 'dupbuild=err'] + if options.path: + cmd[0] = options.path if options.verbose: cmd.append('-v') cmd.append('gn') diff --git a/chromium/tools/gn/escape.cc b/chromium/tools/gn/escape.cc index 685a100e749..35f589a9595 100644 --- a/chromium/tools/gn/escape.cc +++ b/chromium/tools/gn/escape.cc @@ -139,6 +139,47 @@ void EscapeStringToString_PosixNinjaFork(const base::StringPiece& str, } } +void EscapeStringToString_Command(const base::StringPiece& str, + const EscapeOptions& options, + std::string* dest, + bool* needed_quoting) { + if (str.find_first_of(" \"") == std::string::npos) { + // Simple case, don't quote. + dest->append(str.data(), str.size()); + } else { + if (!options.inhibit_quoting) + dest->push_back('"'); + for (size_t i = 0; i < str.size(); i++) { + // Count backslashes in case they're followed by a quote. + size_t backslash_count = 0; + while (i < str.size() && str[i] == '\\') { + i++; + backslash_count++; + } + if (i == str.size()) { + // Backslashes at end of string. Backslash-escape all of them since + // they'll be followed by a quote. + dest->append(backslash_count * 2, '\\'); + } else if (str[i] == '"') { + // 0 or more backslashes followed by a quote. Backslash-escape the + // backslashes, then backslash-escape the quote. + dest->append(backslash_count * 2 + 1, '\\'); + dest->push_back('"'); + } else { + // Non-special Windows character. Add any + // backslashes we read previously, these are literals. + dest->append(backslash_count, '\\'); + dest->push_back(str[i]); + } + } + + if (!options.inhibit_quoting) + dest->push_back('"'); + if (needed_quoting) + *needed_quoting = true; + } +} + void EscapeStringToString(const base::StringPiece& str, const EscapeOptions& options, std::string* dest, @@ -176,6 +217,9 @@ void EscapeStringToString(const base::StringPiece& str, case ESCAPE_NINJA_PREFORMATTED_COMMAND: EscapeStringToString_NinjaPreformatted(str, dest); break; + case ESCAPE_COMMAND: + EscapeStringToString_Command(str, options, dest, needed_quoting); + break; default: NOTREACHED(); } diff --git a/chromium/tools/gn/escape.h b/chromium/tools/gn/escape.h index 838de943709..c10255ff170 100644 --- a/chromium/tools/gn/escape.h +++ b/chromium/tools/gn/escape.h @@ -26,6 +26,9 @@ enum EscapingMode { // shell characters which we want to pass to the shell (like when writing // tool commands). Only Ninja "$" are escaped. ESCAPE_NINJA_PREFORMATTED_COMMAND, + + // Like ESCAPE_NINJA_COMMAND but without ninja string escaping + ESCAPE_COMMAND, }; enum EscapingPlatform { diff --git a/chromium/tools/gn/last_commit_position.py b/chromium/tools/gn/last_commit_position.py index a91f7226e17..b87fb2cf59f 100644 --- a/chromium/tools/gn/last_commit_position.py +++ b/chromium/tools/gn/last_commit_position.py @@ -60,6 +60,8 @@ def FetchCommitPosition(directory): max_lines = 2048 proc = RunGitCommand(directory, ['log']) + if proc == None: + return None for i in range(max_lines): line = proc.stdout.readline() if not line: diff --git a/chromium/tools/gn/ninja_action_target_writer.cc b/chromium/tools/gn/ninja_action_target_writer.cc index 74270a0d29a..eaf1b3d0133 100644 --- a/chromium/tools/gn/ninja_action_target_writer.cc +++ b/chromium/tools/gn/ninja_action_target_writer.cc @@ -103,7 +103,7 @@ std::string NinjaActionTargetWriter::WriteRuleDefinition() { // there will be only one invocation so we can use a simple name. std::string target_label = target_->label().GetUserVisibleName(true); std::string custom_rule_name(target_label); - base::ReplaceChars(custom_rule_name, ":/()", "_", &custom_rule_name); + base::ReplaceChars(custom_rule_name, "+:/()", "_", &custom_rule_name); custom_rule_name.append("_rule"); const SubstitutionList& args = target_->action_values().args(); diff --git a/chromium/tools/gn/ninja_action_target_writer_unittest.cc b/chromium/tools/gn/ninja_action_target_writer_unittest.cc index e73f0ab0eab..fc06d813042 100644 --- a/chromium/tools/gn/ninja_action_target_writer_unittest.cc +++ b/chromium/tools/gn/ninja_action_target_writer_unittest.cc @@ -74,6 +74,38 @@ TEST(NinjaActionTargetWriter, ActionNoSources) { EXPECT_EQ(expected, out.str()); } +TEST(NinjaActionTargetWriter, WriteRuleDefinition) { + Err err; + TestWithScope setup; + + Target target(setup.settings(), Label(SourceDir("//foo++/"), "bar")); + target.set_output_type(Target::ACTION); + target.action_values().set_script(SourceFile("//foo/script.py")); + target.action_values().outputs() = + SubstitutionList::MakeForTest("//out/Debug/foo.out"); + + target.SetToolchain(setup.toolchain()); + ASSERT_TRUE(target.OnResolved(&err)); + + setup.build_settings()->set_python_path(base::FilePath(FILE_PATH_LITERAL( + "python"))); + + std::ostringstream out; + NinjaActionTargetWriter writer(&target, out); + writer.Run(); + + const char expected[] = + "rule __foo___bar___rule\n" + " command = python ../../foo/script.py\n" + " description = ACTION //foo++:bar()\n" + " restat = 1\n" + "\n" + "build foo.out: __foo___bar___rule | ../../foo/script.py\n" + "\n" + "build obj/foo++/bar.stamp: stamp foo.out\n"; + + EXPECT_EQ(expected, out.str()); +} // Tests an action with no sources and pool TEST(NinjaActionTargetWriter, ActionNoSourcesPool) { diff --git a/chromium/tools/gn/ninja_binary_target_writer.cc b/chromium/tools/gn/ninja_binary_target_writer.cc index 9772b85a1eb..8154355f882 100644 --- a/chromium/tools/gn/ninja_binary_target_writer.cc +++ b/chromium/tools/gn/ninja_binary_target_writer.cc @@ -751,11 +751,18 @@ void NinjaBinaryTargetWriter::WriteLinkerStuff( target_, tool_, tool_->outputs(), &output_files); out_ << "build"; - path_output_.WriteFiles(out_, output_files); - out_ << ": " << rule_prefix_ - << Toolchain::ToolTypeToName( + if (!target_->create_pri_file()) { + path_output_.WriteFiles(out_, output_files); + out_ << ": " << rule_prefix_; + out_ << Toolchain::ToolTypeToName( target_->toolchain()->GetToolTypeForTargetFinalOutput(target_)); + } else { + out_ << " "; + path_output_.WriteFile(out_, OutputFile(target_->label().name() + ".stamp")); + out_ << ": " << rule_prefix_; + out_ << Toolchain::ToolTypeToName(Toolchain::TYPE_STAMP) << " |"; + } UniqueVector<OutputFile> extra_object_files; UniqueVector<const Target*> linkable_deps; @@ -811,7 +818,9 @@ void NinjaBinaryTargetWriter::WriteLinkerStuff( // Append implicit dependencies collected above. if (!implicit_deps.empty()) { - out_ << " |"; + if (!target_->create_pri_file()) { + out_ << " |"; + } path_output_.WriteFiles(out_, implicit_deps); } diff --git a/chromium/tools/gn/ninja_binary_target_writer.h b/chromium/tools/gn/ninja_binary_target_writer.h index 01887201381..145e8964975 100644 --- a/chromium/tools/gn/ninja_binary_target_writer.h +++ b/chromium/tools/gn/ninja_binary_target_writer.h @@ -153,6 +153,7 @@ class NinjaBinaryTargetWriter : public NinjaTargetWriter { std::string rule_prefix_; DISALLOW_COPY_AND_ASSIGN(NinjaBinaryTargetWriter); + friend class QMakeLinkWriter; }; #endif // TOOLS_GN_NINJA_BINARY_TARGET_WRITER_H_ diff --git a/chromium/tools/gn/ninja_target_writer.cc b/chromium/tools/gn/ninja_target_writer.cc index 2b30d651439..a4a202dcdbe 100644 --- a/chromium/tools/gn/ninja_target_writer.cc +++ b/chromium/tools/gn/ninja_target_writer.cc @@ -24,6 +24,7 @@ #include "tools/gn/substitution_writer.h" #include "tools/gn/target.h" #include "tools/gn/trace.h" +#include "tools/gn/qmake_link_writer.h" NinjaTargetWriter::NinjaTargetWriter(const Target* target, std::ostream& out) @@ -89,6 +90,17 @@ std::string NinjaTargetWriter::RunAndWriteFile(const Target* target) { needs_file_write = true; NinjaBinaryTargetWriter writer(target, rules); writer.Run(); + if(target->create_pri_file()){ + base::FilePath pri_file(settings->build_settings()->GetFullPath( + SourceFile(settings->build_settings()->build_dir().value() + + target->label().name() + ".pri"))); + std::stringstream file; + QMakeLinkWriter pri_writer(&writer,target, file); + pri_writer.Run(); + if (g_scheduler->verbose_logging()) + g_scheduler->Log("Writing", FilePathToUTF8(pri_file)); + WriteFileIfChanged(pri_file, file.str(), nullptr); + } } else { CHECK(0) << "Output type of target not handled."; } diff --git a/chromium/tools/gn/qmake_link_writer.cc b/chromium/tools/gn/qmake_link_writer.cc new file mode 100644 index 00000000000..f7036b85dca --- /dev/null +++ b/chromium/tools/gn/qmake_link_writer.cc @@ -0,0 +1,252 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "tools/gn/qmake_link_writer.h" +#include "tools/gn/deps_iterator.h" +#include "tools/gn/ninja_binary_target_writer.h" +#include "tools/gn/output_file.h" +#include "tools/gn/settings.h" +#include "tools/gn/target.h" +#include "tools/gn/config_values_extractors.h" +#include "base/logging.h" +#include "base/strings/string_util.h" + +QMakeLinkWriter::QMakeLinkWriter(const NinjaBinaryTargetWriter* writer, const Target* target, std::ostream& out) + : target_(target), + nwriter_(writer), + out_(out), + path_output_(target->settings()->build_settings()->build_dir(), + target->settings()->build_settings()->root_path_utf8(), + ESCAPE_NONE) { +} + +QMakeLinkWriter::~QMakeLinkWriter() { +} + +// Based on similar function in qt_creator_writer.cc +void CollectDeps(std::set<const Target*> &deps, const Target* target) { + for (const auto& dep : target->GetDeps(Target::DEPS_ALL)) { + const Target* dep_target = dep.ptr; + if (deps.count(dep_target)) + continue; + deps.insert(dep_target); + CollectDeps(deps, dep_target); + } +} + +void PrintSourceFile(std::ostream& out, PathOutput& path_output, const SourceFile& file) { + out << " \\\n \""; + if (file.is_source_absolute()) { + out << "$$PWD/"; + path_output.WriteFile(out, file); + } else { + out << file.value(); + } + out << "\""; +} + +void QMakeLinkWriter::Run() { + + CHECK(target_->output_type() == Target::SHARED_LIBRARY) + << "QMakeLinkWriter only supports SHARED_LIBRARY"; + + std::vector<SourceFile> object_files; + std::vector<SourceFile> other_files; + std::vector<OutputFile> tool_outputs; + + const Settings* settings = target_->settings(); + object_files.reserve(target_->sources().size()); + + for (const auto& source : target_->sources()) { + Toolchain::ToolType tool_type = Toolchain::TYPE_NONE; + if (!target_->GetOutputFilesForSource(source, &tool_type, &tool_outputs)) { + if (GetSourceFileType(source) == SOURCE_DEF) + other_files.push_back(source); + continue; // No output for this source. + } + object_files.push_back(tool_outputs[0].AsSourceFile(settings->build_settings())); + } + + UniqueVector<OutputFile> extra_object_files; + UniqueVector<const Target*> linkable_deps; + UniqueVector<const Target*> non_linkable_deps; + nwriter_->GetDeps(&extra_object_files, &linkable_deps, &non_linkable_deps); + + std::set<const Target*> deps; + deps.insert(target_); + CollectDeps(deps, target_); + + // sources files. + out_ << "NINJA_SOURCES ="; + for (const auto& target : deps) { + for (const auto& file : target->sources()) { + PrintSourceFile(out_, path_output_, file); + } + } + out_ << std::endl; + + // headers files. + out_ << "NINJA_HEADERS ="; + for (const auto& target : deps) { + for (const auto& file : target->public_headers()) { + PrintSourceFile(out_, path_output_, file); + } + } + out_ << std::endl; + + std::set<std::string> defines; + for (const auto& target : deps) { + for (ConfigValuesIterator it(target); !it.done(); it.Next()) { + for (std::string define : it.cur().defines()) { + defines.insert(define); + } + } + } + out_ << "NINJA_DEFINES ="; + for (const auto& define : defines) { + out_ << " \\\n " << define; + } + out_ << std::endl; + + // object files. + out_ << "NINJA_OBJECTS ="; + for (const auto& file : object_files) { + out_ << " \\\n \"$$PWD/"; + path_output_.WriteFile(out_, file); + out_ << "\""; + } + for (const auto& file : extra_object_files) { + out_ << " \\\n \"$$PWD/"; + path_output_.WriteFile(out_, file); + out_ << "\""; + } + out_ << std::endl; + + // linker flags + out_ << "NINJA_LFLAGS ="; + EscapeOptions opts; + opts.mode = ESCAPE_COMMAND; + // First the ldflags from the target and its config. + RecursiveTargetConfigStringsToStream(target_, &ConfigValues::ldflags, + opts, out_); + out_ << std::endl; + + // archives + out_ << "NINJA_ARCHIVES ="; + + std::vector<OutputFile> solibs; + for (const Target* cur : linkable_deps) { + if (cur->dependency_output_file().value() != + cur->link_output_file().value()) { + solibs.push_back(cur->link_output_file()); + } else { + out_ << " \\\n \"$$PWD/"; + path_output_.WriteFile(out_, cur->link_output_file()); + out_ << "\""; + } + } + out_ << std::endl; + + // library dirs + const OrderedSet<SourceDir> all_lib_dirs = target_->all_lib_dirs(); + const Tool* tool = target_->toolchain()->GetToolForTargetFinalOutput(target_); + + if (!all_lib_dirs.empty()) { + out_ << "NINJA_LIB_DIRS ="; + PathOutput lib_path_output(path_output_.current_dir(), + settings->build_settings()->root_path_utf8(), + ESCAPE_COMMAND); + for (size_t i = 0; i < all_lib_dirs.size(); i++) { + out_ << " " << tool->lib_dir_switch(); + lib_path_output.WriteDir(out_, all_lib_dirs[i], + PathOutput::DIR_NO_LAST_SLASH); + } + } + out_ << std::endl; + + //libs + out_ << "NINJA_LIBS ="; + + EscapeOptions lib_escape_opts; + lib_escape_opts.mode = ESCAPE_COMMAND; + + const OrderedSet<LibFile> all_libs = target_->all_libs(); + const std::string framework_ending(".framework"); + for (size_t i = 0; i < all_libs.size(); i++) { + const LibFile& lib_file = all_libs[i]; + const std::string& lib_value = lib_file.value(); + if (lib_file.is_source_file()) { + out_ << " "; + PathOutput lib_path_output(settings->build_settings()->build_dir(), + settings->build_settings()->root_path_utf8(), + ESCAPE_COMMAND); + lib_path_output.WriteFile(out_, lib_file.source_file()); + } else if (base::EndsWith(lib_value, framework_ending, + base::CompareCase::INSENSITIVE_ASCII)) { + out_ << " -framework "; + EscapeStringToStream( + out_, lib_value.substr(0, lib_value.size() - framework_ending.size()), + lib_escape_opts); + } else { + out_ << " " << tool->lib_switch(); + EscapeStringToStream(out_, lib_value, lib_escape_opts); + } + } + out_ << std::endl; + + // solibs + if (!solibs.empty()) { + out_ << "NINJA_SOLIBS ="; + for (const auto& file : solibs) { + out_ << " \"$$PWD/"; + path_output_.WriteFile(out_, file); + out_ << "\""; + } + out_ << std::endl; + } + + //targetdeps + out_ << "NINJA_TARGETDEPS = "; + path_output_.WriteFile(out_, OutputFile("\"$$PWD/" + target_->label().name() + ".stamp\"")); + out_ << std::endl; +} diff --git a/chromium/tools/gn/qmake_link_writer.h b/chromium/tools/gn/qmake_link_writer.h new file mode 100644 index 00000000000..9415181cfa0 --- /dev/null +++ b/chromium/tools/gn/qmake_link_writer.h @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef TOOLS_GN_QMAKE_LINK_WRITER_H_ +#define TOOLS_GN_QMAKE_LINK_WRITER_H_ + +#include <iosfwd> +#include "tools/gn/path_output.h" + +class Target; +class NinjaBinaryTargetWriter; + +class QMakeLinkWriter { + + public: + QMakeLinkWriter(const NinjaBinaryTargetWriter* writer,const Target* target, std::ostream& out); + ~QMakeLinkWriter() ; + void Run(); + + private: + const Target* target_; + const NinjaBinaryTargetWriter* nwriter_; + std::ostream& out_; + PathOutput path_output_; +}; + +#endif // TOOLS_GN_QMAKE_LINK_WRITER_H_ diff --git a/chromium/tools/gn/qmake_link_writer_unittest.cc b/chromium/tools/gn/qmake_link_writer_unittest.cc new file mode 100644 index 00000000000..8883c215607 --- /dev/null +++ b/chromium/tools/gn/qmake_link_writer_unittest.cc @@ -0,0 +1,141 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "testing/gtest/include/gtest/gtest.h" +#include "tools/gn/qmake_link_writer.h" +#include "ninja_binary_target_writer.h" +#include "tools/gn/test_with_scope.h" + +TEST(QMakeLinkWriter, WriteLinkPri) { + TestWithScope setup; + Err err; + + setup.build_settings()->SetBuildDir(SourceDir("//out/Debug/")); + + + Target source_set_target(setup.settings(), Label(SourceDir("//foo1/"), "foo1")); + source_set_target.set_output_type(Target::SOURCE_SET); + source_set_target.visibility().SetPublic(); + source_set_target.sources().push_back(SourceFile("//foo1/input1.cc")); + source_set_target.sources().push_back(SourceFile("//foo1/input2.cc")); + source_set_target.SetToolchain(setup.toolchain()); + ASSERT_TRUE(source_set_target.OnResolved(&err)); + + TestTarget static_lib_target(setup, "//foo5:bar", Target::STATIC_LIBRARY); + static_lib_target.sources().push_back(SourceFile("//foo5/input1.cc")); + static_lib_target.config_values().arflags().push_back("--bar"); + static_lib_target.set_complete_static_lib(true); + ASSERT_TRUE(static_lib_target.OnResolved(&err)); + + TestTarget deps_shared_lib_target(setup, "//foo6:shlib", Target::SHARED_LIBRARY); + //this trigers solibs + deps_shared_lib_target.set_create_pri_file(true); + deps_shared_lib_target.sources().push_back(SourceFile("//foo6/input1.cc")); + + ASSERT_TRUE(deps_shared_lib_target.OnResolved(&err)); + + Target shared_lib_target(setup.settings(), Label(SourceDir("//foo2/"), "foo2")); + shared_lib_target.set_create_pri_file(true); + shared_lib_target.set_output_type(Target::SHARED_LIBRARY); + shared_lib_target.set_output_extension(std::string("so.1")); + shared_lib_target.set_output_dir(SourceDir("//out/Debug/foo/")); + shared_lib_target.sources().push_back(SourceFile("//foo2/input1.cc")); + shared_lib_target.sources().push_back(SourceFile("//foo2/input 2.cc")); + shared_lib_target.sources().push_back(SourceFile("//foo 2/input 3.cc")); + shared_lib_target.config_values().libs().push_back(LibFile(SourceFile("//foo/libfoo3.a"))); + shared_lib_target.config_values().libs().push_back(LibFile("foo4")); + shared_lib_target.config_values().lib_dirs().push_back(SourceDir("//foo/bar/")); + shared_lib_target.public_deps().push_back(LabelTargetPair(&source_set_target)); + shared_lib_target.public_deps().push_back(LabelTargetPair(&static_lib_target)); + shared_lib_target.public_deps().push_back(LabelTargetPair(&deps_shared_lib_target)); + shared_lib_target.config_values().ldflags().push_back("-fooBAR"); + shared_lib_target.config_values().ldflags().push_back("/INCREMENTAL:NO"); + shared_lib_target.SetToolchain(setup.toolchain()); + ASSERT_TRUE(shared_lib_target.OnResolved(&err)); + + std::ostringstream out1; + NinjaBinaryTargetWriter writer(&shared_lib_target, out1); + writer.Run(); + + const char expected1[] = + "defines =\n" + "include_dirs =\n" + "cflags =\n" + "cflags_cc =\n" + "root_out_dir = .\n" + "target_out_dir = obj/foo2\n" + "target_output_name = libfoo2\n" + "\n" + "build obj/foo2/libfoo2.input1.o: cxx ../../foo2/input1.cc\n" + "build obj/foo2/libfoo2.input$ 2.o: cxx ../../foo2/input$ 2.cc\n" + "build obj/foo$ 2/libfoo2.input$ 3.o: cxx ../../foo$ 2/input$ 3.cc\n" + "\n" + "build foo2.stamp: stamp | obj/foo2/libfoo2.input1.o obj/foo2/libfoo2.input$ 2.o" + " obj/foo$ 2/libfoo2.input$ 3.o" + " obj/foo1/foo1.input1.o obj/foo1/foo1.input2.o obj/foo5/libbar.a " + "shlib.stamp ../../foo/libfoo3.a || obj/foo1/foo1.stamp\n" + " ldflags = -fooBAR /INCREMENTAL$:NO -L../../foo/bar\n" + " libs = ../../foo/libfoo3.a -lfoo4\n" + " output_extension = .so.1\n" + " output_dir = foo\n" + " solibs = ./libshlib.so\n"; + + EXPECT_EQ(expected1, out1.str()); + + std::ostringstream out2; + QMakeLinkWriter pri_writer(&writer, &shared_lib_target, out2); + pri_writer.Run(); + + const char expected2[] = + "NINJA_OBJECTS = \\\n" + " \"$$PWD/obj/foo2/libfoo2.input1.o\" \\\n" + " \"$$PWD/obj/foo2/libfoo2.input 2.o\" \\\n" + " \"$$PWD/obj/foo 2/libfoo2.input 3.o\" \\\n" + " \"$$PWD/obj/foo1/foo1.input1.o\" \\\n" + " \"$$PWD/obj/foo1/foo1.input2.o\"\n" + "NINJA_LFLAGS = -fooBAR /INCREMENTAL:NO\n" + "NINJA_ARCHIVES = \\\n" + " \"$$PWD/obj/foo5/libbar.a\"\n" + "NINJA_LIB_DIRS = -L../../foo/bar\n" + "NINJA_LIBS = ../../foo/libfoo3.a -lfoo4\n" + "NINJA_SOLIBS = \"$$PWD/./libshlib.so\"\n" + "NINJA_TARGETDEPS = \"$$PWD/foo2.stamp\"\n"; + std::string out_str2 = out2.str(); + EXPECT_EQ(expected2, out_str2); +} diff --git a/chromium/tools/gn/target.cc b/chromium/tools/gn/target.cc index 7790a857e64..0bf4dae27ac 100644 --- a/chromium/tools/gn/target.cc +++ b/chromium/tools/gn/target.cc @@ -282,6 +282,7 @@ Target::Target(const Settings* settings, const Label& label) check_includes_(true), complete_static_lib_(false), testonly_(false), + create_pri_file_(false), toolchain_(nullptr) {} Target::~Target() { @@ -686,6 +687,9 @@ void Target::FillOutputFiles() { SubstitutionWriter::ApplyListToLinkerAsOutputFile( this, tool, tool->runtime_outputs(), &runtime_outputs_); } + if (create_pri_file()) { + dependency_output_file_ = OutputFile(label().name() + ".stamp"); + } break; case UNKNOWN: default: diff --git a/chromium/tools/gn/target.h b/chromium/tools/gn/target.h index 1890a535e7a..d842b85788b 100644 --- a/chromium/tools/gn/target.h +++ b/chromium/tools/gn/target.h @@ -145,6 +145,10 @@ class Target : public Item { bool testonly() const { return testonly_; } void set_testonly(bool value) { testonly_ = value; } + // Wether to only create linking information for the target instead of linking + bool create_pri_file() const { return create_pri_file_; } + void set_create_pri_file(bool value) { create_pri_file_ = value; } + OutputFile write_runtime_deps_output() const { return write_runtime_deps_output_; } @@ -346,6 +350,7 @@ class Target : public Item { bool check_includes_; bool complete_static_lib_; bool testonly_; + bool create_pri_file_; FileList inputs_; std::vector<std::string> data_; BundleData bundle_data_; diff --git a/chromium/tools/gn/target_generator.cc b/chromium/tools/gn/target_generator.cc index d75111564d7..c9579a91a34 100644 --- a/chromium/tools/gn/target_generator.cc +++ b/chromium/tools/gn/target_generator.cc @@ -54,6 +54,9 @@ void TargetGenerator::Run() { if (!FillTestonly()) return; + if (!FillCreatePriFile()) + return; + if (!FillAssertNoDeps()) return; @@ -284,6 +287,17 @@ bool TargetGenerator::FillTestonly() { return true; } +bool TargetGenerator::FillCreatePriFile() { + const Value* value = scope_->GetValue(variables::kCreatePriFile, true); + if (value) { + if (!value->VerifyTypeIs(Value::BOOLEAN, err_)) + return false; + target_->set_create_pri_file(value->boolean_value()); + } + return true; +} + + bool TargetGenerator::FillAssertNoDeps() { const Value* value = scope_->GetValue(variables::kAssertNoDeps, true); if (value) { diff --git a/chromium/tools/gn/target_generator.h b/chromium/tools/gn/target_generator.h index a3bdd58e013..93dafbda1cb 100644 --- a/chromium/tools/gn/target_generator.h +++ b/chromium/tools/gn/target_generator.h @@ -70,6 +70,7 @@ class TargetGenerator { bool FillData(); bool FillDependencies(); // Includes data dependencies. bool FillTestonly(); + bool FillCreatePriFile(); bool FillAssertNoDeps(); bool FillWriteRuntimeDeps(); diff --git a/chromium/tools/gn/variables.cc b/chromium/tools/gn/variables.cc index c8c75b82f76..9d583a329d5 100644 --- a/chromium/tools/gn/variables.cc +++ b/chromium/tools/gn/variables.cc @@ -1822,6 +1822,24 @@ Example } )"; +const char kCreatePriFile[] = "create_pri_file"; +const char kCreatePriFile_HelpShort[] = + "create_pri_file: [boolean] Declares a target that creates linking information file."; +const char kCreatePriFile_Help[] = + "create_pri_file: Declares a target that instead of liking dumps the infomation.\n" + "\n" + " Boolean. Defaults to false.\n" + "\n" + " When a target is marked \"create_pri_file = true\" and is linkable, the linking step" + " is skipped. Instead linking infomation is dumped as a pri file\n" + "\n" + "Example\n" + "\n" + " static_library(\"test_support\") {\n" + " create_pri_file = true\n" + " ...\n" + " }\n"; + const char kVisibility[] = "visibility"; const char kVisibility_HelpShort[] = "visibility: [label list] A list of labels that can depend on a target."; diff --git a/chromium/tools/gn/variables.h b/chromium/tools/gn/variables.h index 0e3891d53a9..6a3d658bcb4 100644 --- a/chromium/tools/gn/variables.h +++ b/chromium/tools/gn/variables.h @@ -295,6 +295,10 @@ extern const char kTestonly[]; extern const char kTestonly_HelpShort[]; extern const char kTestonly_Help[]; +extern const char kCreatePriFile[]; +extern const char kCreatePriFile_HelpShort[]; +extern const char kCreatePriFile_Help[]; + extern const char kVisibility[]; extern const char kVisibility_HelpShort[]; extern const char kVisibility_Help[]; diff --git a/chromium/tools/grit/grit/node/misc.py b/chromium/tools/grit/grit/node/misc.py index bd999709bdc..762df2790a9 100755 --- a/chromium/tools/grit/grit/node/misc.py +++ b/chromium/tools/grit/grit/node/misc.py @@ -49,6 +49,7 @@ def _ReadFirstIdsFromFile(filename, defines): def ReplaceVariable(matchobj): for key, value in defines.iteritems(): if matchobj.group(1) == key: + value = os.path.abspath(value) return value return '' @@ -460,6 +461,11 @@ class GritNode(base.Node): abs_filename = os.path.abspath(filename_or_stream) if abs_filename[:len(src_root_dir)] != src_root_dir: filename = os.path.basename(filename_or_stream) + # If the file is not within src_root_dir and the basename is not + # found as a key, fall back to using the absolute file name. + if not filename in first_ids: + filename = abs_filename + filename = filename.replace('\\', '/') else: filename = abs_filename[len(src_root_dir) + 1:] filename = filename.replace('\\', '/') diff --git a/chromium/tools/grit/grit/util.py b/chromium/tools/grit/grit/util.py index 93dce261007..95f3a390f28 100755 --- a/chromium/tools/grit/grit/util.py +++ b/chromium/tools/grit/grit/util.py @@ -29,6 +29,8 @@ BINARY, RAW_TEXT = range(2) # Unique constants representing data pack encodings. _, UTF8, UTF16 = range(3) +def abs(filename): + return os.path.normpath(os.path.join(os.getcwd(), filename)) def Encode(message, encoding): '''Returns a byte stream that represents |message| in the given |encoding|.''' @@ -204,7 +206,7 @@ def ReadFile(filename, encoding): conversion but without decoding to Unicode. ''' mode = 'rb' if encoding == BINARY else 'rU' - with open(filename, mode) as f: + with open(abs(filename), mode) as f: data = f.read() if encoding not in (BINARY, RAW_TEXT): data = data.decode(encoding) diff --git a/chromium/tools/gritsettings/resource_ids b/chromium/tools/gritsettings/resource_ids index b0c2f87c10e..2fd30d8d60d 100644 --- a/chromium/tools/gritsettings/resource_ids +++ b/chromium/tools/gritsettings/resource_ids @@ -126,6 +126,9 @@ "chrome/browser/resources/webapks_ui_resources.grd": { "includes": [12640], }, + "chrome/browser/resources/qt_webengine_resources.grd": { + "includes": [12650], + }, # END chrome/browser section. # START chrome/ miscellaneous section. diff --git a/chromium/tools/gyp/pylib/gyp/generator/ninja.py b/chromium/tools/gyp/pylib/gyp/generator/ninja.py index 0555a4a90d3..9a8fda04b03 100644 --- a/chromium/tools/gyp/pylib/gyp/generator/ninja.py +++ b/chromium/tools/gyp/pylib/gyp/generator/ninja.py @@ -246,6 +246,12 @@ class NinjaWriter(object): base_to_top = gyp.common.InvertRelativePath(base_dir, toplevel_dir) self.base_to_build = os.path.join(base_to_top, build_dir) + # Override relative paths and use absolute paths instead. + # It is necessary to prevent python IOError on Windows due to long + # relative paths while building QtWebEngine. + self.build_to_base = os.path.join(toplevel_dir, base_dir) + self.base_to_build = os.path.normpath(toplevel_build) + def ExpandSpecial(self, path, product_dir=None): """Expand specials like $!PRODUCT_DIR in |path|. diff --git a/chromium/tools/gyp/pylib/gyp/msvs_emulation.py b/chromium/tools/gyp/pylib/gyp/msvs_emulation.py index 6d5b5bd234e..aa06cfaf5a5 100644 --- a/chromium/tools/gyp/pylib/gyp/msvs_emulation.py +++ b/chromium/tools/gyp/pylib/gyp/msvs_emulation.py @@ -662,6 +662,7 @@ class MsvsSettings(object): ldflags.append('/NXCOMPAT') have_def_file = filter(lambda x: x.startswith('/DEF:'), ldflags) + build_dir = os.path.normpath(build_dir) manifest_flags, intermediate_manifest, manifest_files = \ self._GetLdManifestFlags(config, manifest_base_name, gyp_to_build_path, is_executable and not have_def_file, build_dir) diff --git a/chromium/tools/licenses.py b/chromium/tools/licenses.py index 10217637054..d510034f109 100755 --- a/chromium/tools/licenses.py +++ b/chromium/tools/licenses.py @@ -24,11 +24,7 @@ import subprocess import sys import tempfile -# TODO(agrieve): Move build_utils.WriteDepFile into a non-android directory. _REPOSITORY_ROOT = os.path.dirname(os.path.dirname(__file__)) -sys.path.append(os.path.join(_REPOSITORY_ROOT, 'build/android/gyp/util')) -import build_utils - # Paths from the root of the tree to directories to skip. PRUNE_PATHS = set([ @@ -544,15 +540,18 @@ def GenerateCredits( for key, val in env.items(): if escape: val = cgi.escape(val) + val = val.replace("*/", "* /") template = template.replace('{{%s}}' % key, val) return template def MetadataToTemplateEntry(metadata, entry_template): env = { 'name': metadata['Name'], + 'name-sanitized': metadata['Name'].replace(' ', '-'), 'url': metadata['URL'], 'license': open(metadata['License File'], 'rb').read(), - } + 'license-type': metadata['License'] + } return { 'name': metadata['Name'], 'content': EvaluateTemplate(entry_template, env), @@ -631,19 +630,6 @@ def GenerateCredits( else: print template_contents - if depfile: - assert output_file - # Add in build.ninja so that the target will be considered dirty whenever - # gn gen is run. Otherwise, it will fail to notice new files being added. - # This is still no perfect, as it will fail if no build files are changed, - # but a new README.chromium / LICENSE is added. This shouldn't happen in - # practice however. - license_file_list = (entry['license_file'] for entry in entries) - license_file_list = (os.path.relpath(p) for p in license_file_list) - license_file_list = sorted(set(license_file_list)) - build_utils.WriteDepfile(depfile, output_file, - license_file_list + ['build.ninja']) - return True @@ -709,7 +695,6 @@ def main(): parser.add_argument('command', choices=['help', 'scan', 'credits', 'license_file']) parser.add_argument('output_file', nargs='?') - build_utils.AddDepfileOption(parser) args = parser.parse_args() if args.command == 'scan': @@ -718,7 +703,7 @@ def main(): elif args.command == 'credits': if not GenerateCredits(args.file_template, args.entry_template, args.output_file, args.target_os, - args.gn_out_dir, args.gn_target, args.depfile): + args.gn_out_dir, args.gn_target): return 1 elif args.command == 'license_file': if not GenerateLicenseFile( diff --git a/chromium/tools/perf/BUILD.gn b/chromium/tools/perf/BUILD.gn index 55dacdd18b7..76ae25cb742 100644 --- a/chromium/tools/perf/BUILD.gn +++ b/chromium/tools/perf/BUILD.gn @@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/features.gni") + group("perf") { testonly = true deps = [ @@ -34,6 +36,11 @@ group("perf") { # For Pylib used by VR tests "//build/android/pylib/", ] + if (use_qt) { + deps -= [ + "//tools/perf/chrome_telemetry_build:telemetry_chrome_test", + ] + } } if (is_android) { diff --git a/chromium/tools/win/DebugVisualizers/BUILD.gn b/chromium/tools/win/DebugVisualizers/BUILD.gn index d85b8d3dfeb..02369103f84 100644 --- a/chromium/tools/win/DebugVisualizers/BUILD.gn +++ b/chromium/tools/win/DebugVisualizers/BUILD.gn @@ -23,20 +23,20 @@ assert(is_win) config("chrome") { # TODO(tikuta): remove this condition if lld supports /NATVIS. if (!use_lld) { - ldflags = [ "/NATVIS:" + rebase_path("chrome.natvis", root_build_dir) ] + ldflags = [ "/NATVIS:" + rebase_path(get_path_info("chrome.natvis", "abspath")) ] } } config("skia") { # TODO(tikuta): remove this condition if lld supports /NATVIS. if (!use_lld) { - ldflags = [ "/NATVIS:" + rebase_path("skia.natvis", root_build_dir) ] + ldflags = [ "/NATVIS:" + rebase_path(get_path_info("skia.natvis", "abspath")) ] } } config("webkit") { # TODO(tikuta): remove this condition if lld supports /NATVIS. if (!use_lld) { - ldflags = [ "/NATVIS:" + rebase_path("webkit.natvis", root_build_dir) ] + ldflags = [ "/NATVIS:" + rebase_path(get_path_info("webkit.natvis", "abspath")) ] } } diff --git a/chromium/ui/accessibility/BUILD.gn b/chromium/ui/accessibility/BUILD.gn index e0ebf1a3ba9..854457e9c50 100644 --- a/chromium/ui/accessibility/BUILD.gn +++ b/chromium/ui/accessibility/BUILD.gn @@ -68,10 +68,6 @@ component("accessibility") { "platform/ax_platform_node_delegate.h", "platform/ax_platform_node_mac.h", "platform/ax_platform_node_mac.mm", - "platform/ax_platform_node_win.cc", - "platform/ax_platform_node_win.h", - "platform/ax_system_caret_win.cc", - "platform/ax_system_caret_win.h", ] } @@ -87,9 +83,15 @@ component("accessibility") { "//ui/strings", ] - if (is_win) { + if (is_win && !use_qt) { public_deps += [ "//third_party/iaccessible2" ] libs = [ "oleacc.lib" ] + sources += [ + "platform/ax_platform_node_win.cc", + "platform/ax_platform_node_win.h", + "platform/ax_system_caret_win.cc", + "platform/ax_system_caret_win.h", + ] } if (is_mac) { diff --git a/chromium/ui/aura/BUILD.gn b/chromium/ui/aura/BUILD.gn index 0e1e21f435e..4989ebc7bef 100644 --- a/chromium/ui/aura/BUILD.gn +++ b/chromium/ui/aura/BUILD.gn @@ -177,6 +177,12 @@ component("aura") { "//services/ui", ] + if (use_qt) { + data_deps -= [ + "//services/ui", + ] + } + if (use_x11) { configs += [ "//build/config/linux:x11", diff --git a/chromium/ui/base/BUILD.gn b/chromium/ui/base/BUILD.gn index de79df2eaa7..ee57274c1f7 100644 --- a/chromium/ui/base/BUILD.gn +++ b/chromium/ui/base/BUILD.gn @@ -437,13 +437,14 @@ component("base") { public_deps += [ "//ui/base/x" ] configs += [ "//build/config/linux:x11" ] - if (!is_chromeos) { + if (use_xscrnsaver) { sources += [ "idle/idle_query_x11.cc", "idle/idle_query_x11.h", "idle/screensaver_window_finder_x11.cc", "idle/screensaver_window_finder_x11.h", ] + defines += [ "USE_XSCRNSAVER" ] configs += [ "//build/config/linux:xscrnsaver" ] deps += [ "//ui/gfx/x" ] } @@ -615,12 +616,12 @@ component("base") { if (use_aura) { # Aura clipboard. - if (use_x11 && is_desktop_linux) { + if (use_x11 && is_desktop_linux && !use_qt) { sources += [ "clipboard/clipboard_aurax11.cc", "clipboard/clipboard_aurax11.h", ] - } else if (!is_win) { + } else if (!is_win && !use_qt) { # This file is used for all non-X11, non-Windows aura Builds. sources += [ "clipboard/clipboard_aura.cc", @@ -640,6 +641,39 @@ component("base") { if (is_android || is_ios) { sources -= [ "device_form_factor_desktop.cc" ] } + + if (use_qt) { + if (is_linux) { + sources -= [ + "resource/resource_bundle_auralinux.cc", + ] + if (use_x11) { + sources -= [ + "dragdrop/os_exchange_data_provider_aurax11.cc", + "dragdrop/os_exchange_data_provider_aurax11.h", + ] + } + } else if (is_mac) { + sources -= [ + "clipboard/clipboard_mac.mm", + "clipboard/clipboard_mac.h", + "dragdrop/os_exchange_data_provider_mac.mm", + "dragdrop/os_exchange_data_provider_mac.h", + "resource/resource_bundle_mac.mm", + ] + } else if (is_win) { + sources -= [ + "clipboard/clipboard_util_win.cc", + "clipboard/clipboard_util_win.h", + "clipboard/clipboard_win.cc", + "clipboard/clipboard_win.h", + "dragdrop/os_exchange_data_provider_win.cc", + "dragdrop/os_exchange_data_provider_win.h", + "resource/resource_bundle_win.cc", + "resource/resource_bundle_win.h", + ] + } + } } static_library("test_support") { diff --git a/chromium/ui/base/clipboard/clipboard.h b/chromium/ui/base/clipboard/clipboard.h index 94236adca28..30a4ce7a4ca 100644 --- a/chromium/ui/base/clipboard/clipboard.h +++ b/chromium/ui/base/clipboard/clipboard.h @@ -68,6 +68,7 @@ class UI_BASE_EXPORT Clipboard : public base::ThreadChecker { // FormatType can be used in a set on some platforms. bool operator<(const FormatType& other) const; +#if !defined(TOOLKIT_QT) #if defined(OS_WIN) const FORMATETC& ToFormatEtc() const { return data_; } #elif defined(USE_AURA) || defined(OS_ANDROID) || defined(OS_FUCHSIA) @@ -78,6 +79,9 @@ class UI_BASE_EXPORT Clipboard : public base::ThreadChecker { FormatType(const FormatType& other); FormatType& operator=(const FormatType& other); #endif +#else + const std::string& ToString() const { return data_; } +#endif // !defined(TOOLKIT_QT) bool Equals(const FormatType& other) const; @@ -92,7 +96,10 @@ class UI_BASE_EXPORT Clipboard : public base::ThreadChecker { // // Note that in some cases, the accessor for the wrapped descriptor may be // public, as these format types can be used by drag and drop code as well. -#if defined(OS_WIN) +#if defined(TOOLKIT_QT) + explicit FormatType(const std::string& native_format); + std::string data_; +#elif defined(OS_WIN) explicit FormatType(UINT native_format); FormatType(UINT native_format, LONG index); FORMATETC data_; diff --git a/chromium/ui/base/dragdrop/os_exchange_data_provider_factory.cc b/chromium/ui/base/dragdrop/os_exchange_data_provider_factory.cc index bc3ecda3a1a..91f670cf6f0 100644 --- a/chromium/ui/base/dragdrop/os_exchange_data_provider_factory.cc +++ b/chromium/ui/base/dragdrop/os_exchange_data_provider_factory.cc @@ -35,6 +35,7 @@ OSExchangeDataProviderFactory::TakeFactory() { return to_return; } +#if !defined(TOOLKIT_QT) //static std::unique_ptr<OSExchangeData::Provider> OSExchangeDataProviderFactory::CreateProvider() { @@ -57,5 +58,6 @@ OSExchangeDataProviderFactory::CreateProvider() { #error "Unknown operating system" #endif } +#endif } // namespace ui diff --git a/chromium/ui/base/idle/idle_linux.cc b/chromium/ui/base/idle/idle_linux.cc index a35aca72ee9..31c89bebb92 100644 --- a/chromium/ui/base/idle/idle_linux.cc +++ b/chromium/ui/base/idle/idle_linux.cc @@ -5,7 +5,7 @@ #include "ui/base/idle/idle.h" -#if defined(USE_X11) +#if defined(USE_X11) && defined(USE_XSCRNSAVER) #include "ui/base/idle/idle_query_x11.h" #include "ui/base/idle/screensaver_window_finder_x11.h" #endif @@ -13,14 +13,14 @@ namespace ui { void CalculateIdleTime(IdleTimeCallback notify) { -#if defined(USE_X11) +#if defined(USE_X11) && defined(USE_XSCRNSAVER) IdleQueryX11 idle_query; notify.Run(idle_query.IdleTime()); #endif } bool CheckIdleStateIsLocked() { -#if defined(USE_X11) +#if defined(USE_X11) && defined(USE_XSCRNSAVER) // Usually the screensaver is used to lock the screen. return ScreensaverWindowFinder::ScreensaverWindowExists(); #else diff --git a/chromium/ui/base/l10n/l10n_util.cc b/chromium/ui/base/l10n/l10n_util.cc index c43fd7cc09e..6cf0fdb5d3b 100644 --- a/chromium/ui/base/l10n/l10n_util.cc +++ b/chromium/ui/base/l10n/l10n_util.cc @@ -244,7 +244,7 @@ bool IsLocalePartiallyPopulated(const std::string& locale_name) { return !l10n_util::IsLocaleNameTranslated("en", locale_name); } -#if !defined(OS_MACOSX) +#if !defined(OS_MACOSX) || defined(TOOLKIT_QT) bool IsLocaleAvailable(const std::string& locale) { // If locale has any illegal characters in it, we don't want to try to // load it because it may be pointing outside the locale data file directory. @@ -338,7 +338,7 @@ std::string GetLanguage(const std::string& locale) { // and generic locale fallback based on ICU/CLDR. bool CheckAndResolveLocale(const std::string& locale, std::string* resolved_locale) { -#if defined(OS_MACOSX) +#if defined(OS_MACOSX) && !defined(TOOLKIT_QT) NOTIMPLEMENTED(); return false; #else @@ -425,7 +425,7 @@ bool CheckAndResolveLocale(const std::string& locale, } std::string GetApplicationLocaleInternal(const std::string& pref_locale) { -#if defined(OS_MACOSX) +#if defined(OS_MACOSX) && !defined(TOOLKIT_QT) // Use any override (Cocoa for the browser), otherwise use the preference // passed to the function. @@ -473,7 +473,7 @@ std::string GetApplicationLocaleInternal(const std::string& pref_locale) { // On Android, query java.util.Locale for the default locale. candidates.push_back(base::android::GetDefaultLocaleString()); -#elif defined(USE_GLIB) && !defined(OS_CHROMEOS) +#elif defined(USE_GLIB) && !defined(OS_CHROMEOS) && !defined(TOOLKIT_QT) // GLib implements correct environment variable parsing with // the precedence order: LANGUAGE, LC_ALL, LC_MESSAGES and LANG. diff --git a/chromium/ui/base/resource/resource_bundle.cc b/chromium/ui/base/resource/resource_bundle.cc index 4f823477883..3c6961f535b 100644 --- a/chromium/ui/base/resource/resource_bundle.cc +++ b/chromium/ui/base/resource/resource_bundle.cc @@ -66,7 +66,7 @@ const size_t kPngChunkMetadataSize = 12; // length, type, crc32 const unsigned char kPngScaleChunkType[4] = { 'c', 's', 'C', 'l' }; const unsigned char kPngDataChunkType[4] = { 'I', 'D', 'A', 'T' }; -#if !defined(OS_MACOSX) +#if !defined(OS_MACOSX) || defined(TOOLKIT_QT) const char kPakFileExtension[] = ".pak"; #endif @@ -261,7 +261,7 @@ void ResourceBundle::LoadSecondaryLocaleDataWithPakFileRegion( secondary_locale_resources_data_ = std::move(data_pack); } -#if !defined(OS_ANDROID) +#if !defined(OS_ANDROID) && !defined(TOOLKIT_QT) bool ResourceBundle::LocaleDataPakExists(const std::string& locale) { return !GetLocaleFilePath(locale, true).empty(); } @@ -307,7 +307,7 @@ void ResourceBundle::AddDataPackFromFileRegion( } } -#if !defined(OS_MACOSX) +#if !defined(OS_MACOSX) || defined(TOOLKIT_QT) base::FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, bool test_file_exists) { if (app_locale.empty()) @@ -352,7 +352,7 @@ base::FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, } #endif -#if !defined(OS_ANDROID) +#if !defined(OS_ANDROID) && !defined(TOOLKIT_QT) std::string ResourceBundle::LoadLocaleResources( const std::string& pref_locale) { DCHECK(!locale_resources_data_.get()) << "locale.pak already loaded"; diff --git a/chromium/ui/base/webui/web_ui_util.cc b/chromium/ui/base/webui/web_ui_util.cc index 489fb7ecd62..8495e69a9d1 100644 --- a/chromium/ui/base/webui/web_ui_util.cc +++ b/chromium/ui/base/webui/web_ui_util.cc @@ -217,7 +217,7 @@ std::string GetFontFamily() { // TODO(dnicoara) Remove Ozone check when PlatformFont support is introduced // into Ozone: crbug.com/320050 -#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(USE_OZONE) +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && !defined(USE_OZONE) && !defined(TOOLKIT_QT) font_family = ui::ResourceBundle::GetSharedInstance().GetFont( ui::ResourceBundle::BaseFont).GetFontName() + ", " + font_family; #endif diff --git a/chromium/ui/base/x/x11_util.cc b/chromium/ui/base/x/x11_util.cc index dbb8cc534e3..9a5b4095694 100644 --- a/chromium/ui/base/x/x11_util.cc +++ b/chromium/ui/base/x/x11_util.cc @@ -147,6 +147,9 @@ bool SupportsEWMH() { bool GetWindowManagerName(std::string* wm_name) { DCHECK(wm_name); + if (!gfx::GetXDisplay()) + return false; + if (!SupportsEWMH()) return false; diff --git a/chromium/ui/compositor/BUILD.gn b/chromium/ui/compositor/BUILD.gn index ab7677ccddd..6dbb61d3bdd 100644 --- a/chromium/ui/compositor/BUILD.gn +++ b/chromium/ui/compositor/BUILD.gn @@ -104,6 +104,12 @@ component("compositor") { "//third_party/angle:libGLESv2", "//ui/resources", ] + if (use_qt) { + deps -= [ + "//third_party/angle:libEGL", + "//third_party/angle:libGLESv2", + ] + } } } diff --git a/chromium/ui/display/util/x11/edid_parser_x11.cc b/chromium/ui/display/util/x11/edid_parser_x11.cc index 4c5f68298ae..954e55c2442 100644 --- a/chromium/ui/display/util/x11/edid_parser_x11.cc +++ b/chromium/ui/display/util/x11/edid_parser_x11.cc @@ -29,10 +29,12 @@ bool IsRandRAvailable() { // Returns true if EDID property is successfully obtained. Otherwise returns // false and does not touch |edid|. bool GetEDIDProperty(XID output, std::vector<uint8_t>* edid) { - if (!IsRandRAvailable()) + Display* display = gfx::GetXDisplay(); + if (!display) return false; - Display* display = gfx::GetXDisplay(); + if (!IsRandRAvailable()) + return false; Atom edid_property = gfx::GetAtom(RR_PROPERTY_RANDR_EDID); diff --git a/chromium/ui/events/gesture_detection/gesture_provider.cc b/chromium/ui/events/gesture_detection/gesture_provider.cc index 39b8a2d1504..6a37bed556f 100644 --- a/chromium/ui/events/gesture_detection/gesture_provider.cc +++ b/chromium/ui/events/gesture_detection/gesture_provider.cc @@ -297,6 +297,16 @@ class GestureProvider::GestureListenerImpl : public ScaleGestureListener, const MotionEvent& secondary_pointer_down, float raw_distance_x, float raw_distance_y) override { + // Do not use gesture detection for scrolling on macOS, it is handled by real and synthesized + // wheel events received from Qt (the synthesized ones come from usage of a touchpad). + // The scroll gestures created by the gesture detector are incompatible with wheel events + // received by Qt, due to having an inverse Y coordinate and also because they overlap with + // each other, thus scrolling sometimes goes into one direction, and sometimes + // into the opposite direction. +#if defined(TOOLKIT_QT) && defined(OS_MACOSX) + return true; +#endif + float distance_x = raw_distance_x; float distance_y = raw_distance_y; if (!scroll_event_sent_ && e2.GetPointerCount() < 3) { @@ -361,6 +371,12 @@ class GestureProvider::GestureListenerImpl : public ScaleGestureListener, const MotionEvent& e2, float velocity_x, float velocity_y) override { + // Do not use gesture detection for flings on macOS. See explanation at the beginning + // of OnScroll. +#if defined(TOOLKIT_QT) && defined(OS_MACOSX) + return true; +#endif + if (snap_scroll_controller_.IsSnappingScrolls()) { if (snap_scroll_controller_.IsSnapHorizontal()) { velocity_y = 0; diff --git a/chromium/ui/events/platform/x11/x11_event_source_libevent.cc b/chromium/ui/events/platform/x11/x11_event_source_libevent.cc index 05d7f8751a5..e6236d08a90 100644 --- a/chromium/ui/events/platform/x11/x11_event_source_libevent.cc +++ b/chromium/ui/events/platform/x11/x11_event_source_libevent.cc @@ -164,6 +164,10 @@ void X11EventSourceLibevent::RemoveXEventDispatcher( } void X11EventSourceLibevent::ProcessXEvent(XEvent* xevent) { +#if defined(USE_X11) + // DispatchEvent takes ui::PlatformEvent which is XEvent* + DispatchEvent(xevent); +#else std::unique_ptr<ui::Event> translated_event = TranslateXEventToEvent(*xevent); if (translated_event) { DispatchEvent(translated_event.get()); @@ -172,6 +176,7 @@ void X11EventSourceLibevent::ProcessXEvent(XEvent* xevent) { // directly to XEventDispatchers. DispatchXEventToXEventDispatchers(xevent); } +#endif } void X11EventSourceLibevent::AddEventWatcher() { @@ -211,4 +216,10 @@ void X11EventSourceLibevent::OnFileCanWriteWithoutBlocking(int fd) { NOTREACHED(); } +#if defined(USE_X11) && !defined(TOOLKIT_QT) +std::unique_ptr<PlatformEventSource> PlatformEventSource::CreateDefault() { + return base::MakeUnique<X11EventSourceLibevent>(gfx::GetXDisplay()); +} +#endif + } // namespace ui diff --git a/chromium/ui/gfx/BUILD.gn b/chromium/ui/gfx/BUILD.gn index 862de17f123..257ef472dcc 100644 --- a/chromium/ui/gfx/BUILD.gn +++ b/chromium/ui/gfx/BUILD.gn @@ -555,7 +555,7 @@ source_set("memory_buffer_sources") { "//ui/gfx/geometry", ] - if (is_linux) { + if (is_linux && !use_qt) { sources += [ "linux/client_native_pixmap_dmabuf.cc", "linux/client_native_pixmap_dmabuf.h", diff --git a/chromium/ui/gfx/codec/jpeg_codec.cc b/chromium/ui/gfx/codec/jpeg_codec.cc index 5ff77d782b8..dff1726d81f 100644 --- a/chromium/ui/gfx/codec/jpeg_codec.cc +++ b/chromium/ui/gfx/codec/jpeg_codec.cc @@ -108,7 +108,7 @@ void InitSource(j_decompress_ptr cinfo) { // set to a positive value if TRUE is returned. A FALSE return should only // be used when I/O suspension is desired." boolean FillInputBuffer(j_decompress_ptr cinfo) { - return false; + return FALSE; } // Skip data in the buffer. Since we have all the data at once, this operation @@ -211,7 +211,7 @@ bool JPEGCodec::Decode(const unsigned char* input, size_t input_size, cinfo.client_data = &state; // fill the file metadata into our buffer - if (jpeg_read_header(&cinfo, true) != JPEG_HEADER_OK) + if (jpeg_read_header(&cinfo, TRUE) != JPEG_HEADER_OK) return false; // we want to always get RGB data out diff --git a/chromium/ui/gfx/x/x11_types.cc b/chromium/ui/gfx/x/x11_types.cc index 7540f8ae288..531190e1321 100644 --- a/chromium/ui/gfx/x/x11_types.cc +++ b/chromium/ui/gfx/x/x11_types.cc @@ -11,13 +11,21 @@ #include "build/build_config.h" #include "ui/gfx/x/x11_switches.h" +#ifdef TOOLKIT_QT +extern XDisplay* GetQtXDisplay(); +#endif + namespace gfx { XDisplay* GetXDisplay() { +#ifdef TOOLKIT_QT + return GetQtXDisplay(); +#else static XDisplay* display = NULL; if (!display) display = OpenNewXDisplay(); return display; +#endif } XDisplay* OpenNewXDisplay() { diff --git a/chromium/ui/gl/BUILD.gn b/chromium/ui/gl/BUILD.gn index 760c94378f2..df6048f1c17 100644 --- a/chromium/ui/gl/BUILD.gn +++ b/chromium/ui/gl/BUILD.gn @@ -9,14 +9,7 @@ import("//build/config/ui.gni") import("//ui/ozone/ozone.gni") import("//testing/test.gni") -declare_args() { - enable_swiftshader = (is_win || (is_linux && use_x11) || - (is_chromeos && ozone_platform_x11)) && - (target_cpu == "x86" || target_cpu == "x64") -} - -use_egl = is_win || is_android || is_linux || is_fuchsia -use_glx = use_x11 || ozone_platform_x11 +import("//ui/gl/ui_gl.gni") if (is_android) { import("//build/config/android/config.gni") @@ -303,6 +296,34 @@ component("gl") { deps += [ ":gl_jni_headers" ] } + + if (use_qt) { + if (is_win || use_x11) { + data_deps -= [ + "//third_party/angle:libEGL", + "//third_party/angle:libGLESv2", + ] + } + if (is_win) { + data_deps -= [ + "//third_party/mesa:osmesa", + ] + } + if (is_linux || is_win) { + sources -= [ + "gl_surface_egl.cc", + "gl_surface_egl.h", + ] + } + if (use_x11) { + sources -= [ + "gl_surface_egl_x11.cc", + "gl_surface_egl_x11.h", + "gl_surface_glx.cc", + "gl_surface_glx.h", + ] + } + } } static_library("gl_unittest_utils") { diff --git a/chromium/ui/gl/gl_bindings.cc b/chromium/ui/gl/gl_bindings.cc index 05c45495fa0..e055221397e 100644 --- a/chromium/ui/gl/gl_bindings.cc +++ b/chromium/ui/gl/gl_bindings.cc @@ -39,6 +39,7 @@ std::string DriverWGL::GetPlatformExtensions() { #endif #if defined(USE_EGL) +#if !defined(TOOLKIT_QT) std::string DriverEGL::GetPlatformExtensions() { EGLDisplay display = GLSurfaceEGL::GetHardwareDisplay(); if (display == EGL_NO_DISPLAY) @@ -46,6 +47,7 @@ std::string DriverEGL::GetPlatformExtensions() { const char* str = eglQueryString(display, EGL_EXTENSIONS); return str ? std::string(str) : ""; } +#endif void DriverEGL::UpdateConditionalExtensionBindings() { // For the moment, only two extensions can be conditionally disabled diff --git a/chromium/ui/gl/gl_bindings.h b/chromium/ui/gl/gl_bindings.h index 2ac6f04569e..5fdd0876c31 100644 --- a/chromium/ui/gl/gl_bindings.h +++ b/chromium/ui/gl/gl_bindings.h @@ -405,6 +405,13 @@ typedef void (*OSMESAproc)(); // Forward declare EGL types. typedef uint64_t EGLuint64CHROMIUM; +#ifndef EGL_VERSION_1_5 +typedef intptr_t EGLAttrib; +#endif +#ifndef EGL_KHR_stream +typedef void *EGLStreamKHR; +typedef uint64_t EGLuint64KHR; +#endif #include "gl_bindings_autogen_gl.h" #include "gl_bindings_autogen_osmesa.h" diff --git a/chromium/ui/gl/gl_fence.h b/chromium/ui/gl/gl_fence.h index c3788eb8535..6f98bc4e274 100644 --- a/chromium/ui/gl/gl_fence.h +++ b/chromium/ui/gl/gl_fence.h @@ -8,8 +8,34 @@ #include "base/macros.h" #include "ui/gl/gl_export.h" +typedef void *EGLDisplay; +typedef void *EGLSyncKHR; +typedef struct __GLsync *GLsync; + namespace gl { +union TransferableFence { + enum SyncType { + NoSync, + EglSync, + ArbSync + }; + SyncType type; + struct { + SyncType type; + EGLDisplay display; + EGLSyncKHR sync; + } egl; + struct { + SyncType type; + GLsync sync; + } arb; + + TransferableFence() : type(NoSync) { } + operator bool() { return type != NoSync; } + void reset() { type = NoSync; } +}; + class GL_EXPORT GLFence { public: GLFence(); @@ -18,6 +44,8 @@ class GL_EXPORT GLFence { static bool IsSupported(); static GLFence* Create(); + virtual TransferableFence Transfer() = 0; + virtual bool HasCompleted() = 0; virtual void ClientWait() = 0; diff --git a/chromium/ui/gl/gl_fence_apple.cc b/chromium/ui/gl/gl_fence_apple.cc index 0a53f493bd6..e47efd8a8a5 100644 --- a/chromium/ui/gl/gl_fence_apple.cc +++ b/chromium/ui/gl/gl_fence_apple.cc @@ -15,6 +15,10 @@ GLFenceAPPLE::GLFenceAPPLE() { glFlush(); } +TransferableFence GLFenceAPPLE::Transfer() { + return TransferableFence(); +} + bool GLFenceAPPLE::HasCompleted() { DCHECK(glIsFenceAPPLE(fence_)); return !!glTestFenceAPPLE(fence_); diff --git a/chromium/ui/gl/gl_fence_apple.h b/chromium/ui/gl/gl_fence_apple.h index 88086052d98..4918105cdca 100644 --- a/chromium/ui/gl/gl_fence_apple.h +++ b/chromium/ui/gl/gl_fence_apple.h @@ -18,6 +18,7 @@ class GL_EXPORT GLFenceAPPLE : public GLFence { ~GLFenceAPPLE() override; // GLFence implementation: + TransferableFence Transfer() override; bool HasCompleted() override; void ClientWait() override; void ServerWait() override; diff --git a/chromium/ui/gl/gl_fence_arb.cc b/chromium/ui/gl/gl_fence_arb.cc index 7bc089d8bfc..52d9394df86 100644 --- a/chromium/ui/gl/gl_fence_arb.cc +++ b/chromium/ui/gl/gl_fence_arb.cc @@ -30,6 +30,16 @@ GLFenceARB::GLFenceARB() { glFlush(); } +TransferableFence GLFenceARB::Transfer() { + TransferableFence ret; + if (sync_) { + ret.type = TransferableFence::ArbSync; + ret.arb.sync = sync_; + sync_ = 0; + } + return ret; +} + bool GLFenceARB::HasCompleted() { // Handle the case where FenceSync failed. if (!sync_) diff --git a/chromium/ui/gl/gl_fence_arb.h b/chromium/ui/gl/gl_fence_arb.h index 6b44c01143a..ca4562e7088 100644 --- a/chromium/ui/gl/gl_fence_arb.h +++ b/chromium/ui/gl/gl_fence_arb.h @@ -18,6 +18,7 @@ class GL_EXPORT GLFenceARB : public GLFence { ~GLFenceARB() override; // GLFence implementation: + TransferableFence Transfer() override; bool HasCompleted() override; void ClientWait() override; void ServerWait() override; diff --git a/chromium/ui/gl/gl_fence_egl.cc b/chromium/ui/gl/gl_fence_egl.cc index b32754bc479..dd4e0c6464c 100644 --- a/chromium/ui/gl/gl_fence_egl.cc +++ b/chromium/ui/gl/gl_fence_egl.cc @@ -27,6 +27,15 @@ GLFenceEGL::GLFenceEGL() { glFlush(); } +TransferableFence GLFenceEGL::Transfer() { + TransferableFence ret; + ret.type = TransferableFence::EglSync; + ret.egl.display = display_; + ret.egl.sync = sync_; + sync_ = EGL_NO_SYNC_KHR; + return ret; +} + bool GLFenceEGL::HasCompleted() { EGLint value = 0; if (eglGetSyncAttribKHR(display_, sync_, EGL_SYNC_STATUS_KHR, &value) != @@ -70,7 +79,8 @@ void GLFenceEGL::ServerWait() { } GLFenceEGL::~GLFenceEGL() { - eglDestroySyncKHR(display_, sync_); + if (sync_ != EGL_NO_SYNC_KHR) + eglDestroySyncKHR(display_, sync_); } } // namespace gl diff --git a/chromium/ui/gl/gl_fence_egl.h b/chromium/ui/gl/gl_fence_egl.h index b3abd7e43a9..016746c9358 100644 --- a/chromium/ui/gl/gl_fence_egl.h +++ b/chromium/ui/gl/gl_fence_egl.h @@ -20,6 +20,7 @@ class GL_EXPORT GLFenceEGL : public GLFence { ~GLFenceEGL() override; // GLFence implementation: + TransferableFence Transfer() override; bool HasCompleted() override; void ClientWait() override; void ServerWait() override; diff --git a/chromium/ui/gl/gl_fence_nv.cc b/chromium/ui/gl/gl_fence_nv.cc index 7a856c39992..431490e7d48 100644 --- a/chromium/ui/gl/gl_fence_nv.cc +++ b/chromium/ui/gl/gl_fence_nv.cc @@ -33,6 +33,10 @@ void GLFenceNV::ResetState() { glFlush(); } +TransferableFence GLFenceNV::Transfer() { + return TransferableFence(); +} + bool GLFenceNV::HasCompleted() { DCHECK(glIsFenceNV(fence_)); return !!glTestFenceNV(fence_); diff --git a/chromium/ui/gl/gl_fence_nv.h b/chromium/ui/gl/gl_fence_nv.h index 0831eeaed0a..b2c18312baf 100644 --- a/chromium/ui/gl/gl_fence_nv.h +++ b/chromium/ui/gl/gl_fence_nv.h @@ -18,6 +18,7 @@ class GL_EXPORT GLFenceNV : public GLFence { ~GLFenceNV() override; // GLFence implementation: + TransferableFence Transfer() override; bool ResetSupported() override; void ResetState() override; bool HasCompleted() override; diff --git a/chromium/ui/gl/gl_implementation.cc b/chromium/ui/gl/gl_implementation.cc index eb9285edc4f..c5c3405d894 100644 --- a/chromium/ui/gl/gl_implementation.cc +++ b/chromium/ui/gl/gl_implementation.cc @@ -31,6 +31,7 @@ const struct { GLImplementation implementation; } kGLImplementationNamePairs[] = { {kGLImplementationDesktopName, kGLImplementationDesktopGL}, + {kGLImplementationCoreProfileName, kGLImplementationDesktopGLCoreProfile}, {kGLImplementationOSMesaName, kGLImplementationOSMesaGL}, {kGLImplementationSwiftShaderName, kGLImplementationSwiftShaderGL}, #if defined(OS_MACOSX) diff --git a/chromium/ui/gl/gl_share_group.cc b/chromium/ui/gl/gl_share_group.cc index 94708c09202..2c93a983cb3 100644 --- a/chromium/ui/gl/gl_share_group.cc +++ b/chromium/ui/gl/gl_share_group.cc @@ -20,6 +20,9 @@ GLShareGroup::GLShareGroup() } void GLShareGroup::AddContext(GLContext* context) { + if (contexts_.empty()) + AboutToAddFirstContext(); + contexts_.insert(context); } diff --git a/chromium/ui/gl/gl_share_group.h b/chromium/ui/gl/gl_share_group.h index 99ce887d9e2..87961c69faa 100644 --- a/chromium/ui/gl/gl_share_group.h +++ b/chromium/ui/gl/gl_share_group.h @@ -34,7 +34,7 @@ class GL_EXPORT GLShareGroup : public base::RefCounted<GLShareGroup> { // Returns a pointer to any initialized context in the share group // or NULL if there are no initialized contexts in the share group. - GLContext* GetContext(); + virtual GLContext* GetContext(); // Sets and returns the shared GL context. Used for context virtualization. void SetSharedContext(GLSurface* compatible, GLContext* context); @@ -47,10 +47,13 @@ class GL_EXPORT GLShareGroup : public base::RefCounted<GLShareGroup> { int GetRendererID(); #endif + protected: + virtual ~GLShareGroup(); + virtual void AboutToAddFirstContext() { } + private: friend class base::RefCounted<GLShareGroup>; - ~GLShareGroup(); // References to GLContext are by raw pointer to avoid a reference count // cycle. diff --git a/chromium/ui/gl/gl_surface_wgl.cc b/chromium/ui/gl/gl_surface_wgl.cc index 65b64a161ca..75373376b33 100644 --- a/chromium/ui/gl/gl_surface_wgl.cc +++ b/chromium/ui/gl/gl_surface_wgl.cc @@ -124,7 +124,22 @@ class DisplayWGL { LOG(ERROR) << "Unable to get the pixel format for GL context."; return false; } + +#ifdef TOOLKIT_QT + // wglSetPixelFormat needs to be called instead of SetPixelFormat to allow a differently + // named software GL implementation library to set up its internal data. + // The windows gdi.dll SetPixelFormat call directly calls into the stock opengl32.dll, + // instead of opengl32sw.dll for example. + typedef BOOL (WINAPI *wglSetPixelFormatProc)(HDC, int, const PIXELFORMATDESCRIPTOR *); + wglSetPixelFormatProc wglSetPixelFormatFn = + reinterpret_cast<wglSetPixelFormatProc>( + GetGLProcAddress("wglSetPixelFormat")); + + if (!wglSetPixelFormatFn(device_context_, + +#else if (!SetPixelFormat(device_context_, +#endif pixel_format_, &kPixelFormatDescriptor)) { LOG(ERROR) << "Unable to set the pixel format for temporary GL context."; diff --git a/chromium/ui/gl/gl_switches.cc b/chromium/ui/gl/gl_switches.cc index c9097027cce..5ea1e341f3d 100644 --- a/chromium/ui/gl/gl_switches.cc +++ b/chromium/ui/gl/gl_switches.cc @@ -8,6 +8,7 @@ namespace gl { const char kGLImplementationDesktopName[] = "desktop"; +const char kGLImplementationCoreProfileName[] = "core_profile"; const char kGLImplementationOSMesaName[] = "osmesa"; const char kGLImplementationAppleName[] = "apple"; const char kGLImplementationEGLName[] = "egl"; diff --git a/chromium/ui/gl/gl_switches.h b/chromium/ui/gl/gl_switches.h index 978bd40f380..404dee8f712 100644 --- a/chromium/ui/gl/gl_switches.h +++ b/chromium/ui/gl/gl_switches.h @@ -14,6 +14,7 @@ namespace gl { // The GL implementation names that can be passed to --use-gl. GL_EXPORT extern const char kGLImplementationDesktopName[]; +GL_EXPORT extern const char kGLImplementationCoreProfileName[]; GL_EXPORT extern const char kGLImplementationOSMesaName[]; GL_EXPORT extern const char kGLImplementationAppleName[]; GL_EXPORT extern const char kGLImplementationEGLName[]; diff --git a/chromium/ui/gl/init/gl_factory_ozone.cc b/chromium/ui/gl/init/gl_factory_ozone.cc index 8b35da419dd..4f0b30aaae0 100644 --- a/chromium/ui/gl/init/gl_factory_ozone.cc +++ b/chromium/ui/gl/init/gl_factory_ozone.cc @@ -30,6 +30,7 @@ bool GetGLWindowSystemBindingInfo(GLWindowSystemBindingInfo* info) { return false; } +#if !defined(TOOLKIT_QT) scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group, GLSurface* compatible_surface, const GLContextAttribs& attribs) { @@ -104,6 +105,7 @@ scoped_refptr<GLSurface> CreateOffscreenGLSurfaceWithFormat( return nullptr; } +#endif void SetDisabledExtensionsPlatform(const std::string& disabled_extensions) { if (HasGLOzone()) { diff --git a/chromium/ui/gl/init/gl_factory_win.cc b/chromium/ui/gl/init/gl_factory_win.cc index b9f442cd4e3..87fbecfb15e 100644 --- a/chromium/ui/gl/init/gl_factory_win.cc +++ b/chromium/ui/gl/init/gl_factory_win.cc @@ -45,7 +45,7 @@ bool GetGLWindowSystemBindingInfo(GLWindowSystemBindingInfo* info) { return false; } } - +#if !defined(TOOLKIT_QT) scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group, GLSurface* compatible_surface, const GLContextAttribs& attribs) { @@ -135,6 +135,7 @@ scoped_refptr<GLSurface> CreateOffscreenGLSurfaceWithFormat( return nullptr; } } +#endif void SetDisabledExtensionsPlatform(const std::string& disabled_extensions) { GLImplementation implementation = GetGLImplementation(); diff --git a/chromium/ui/gl/init/gl_factory_x11.cc b/chromium/ui/gl/init/gl_factory_x11.cc index b55fe76b197..23d6000ecf5 100644 --- a/chromium/ui/gl/init/gl_factory_x11.cc +++ b/chromium/ui/gl/init/gl_factory_x11.cc @@ -75,6 +75,7 @@ scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group, } } +#ifndef TOOLKIT_QT scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) { TRACE_EVENT0("gpu", "gl::init::CreateViewGLSurface"); switch (GetGLImplementation()) { @@ -123,6 +124,7 @@ scoped_refptr<GLSurface> CreateOffscreenGLSurfaceWithFormat( return nullptr; } } +#endif void SetDisabledExtensionsPlatform(const std::string& disabled_extensions) { GLImplementation implementation = GetGLImplementation(); diff --git a/chromium/ui/gl/init/gl_initializer.h b/chromium/ui/gl/init/gl_initializer.h index 4f289872423..56c51d5161c 100644 --- a/chromium/ui/gl/init/gl_initializer.h +++ b/chromium/ui/gl/init/gl_initializer.h @@ -16,6 +16,10 @@ namespace init { // InitializeGLOneOffImplementation() instead. bool InitializeGLOneOffPlatform(); +#if defined(TOOLKIT_QT) +bool usingSoftwareDynamicGL(); +#endif + // Initializes a particular GL implementation. bool InitializeStaticGLBindings(GLImplementation implementation); diff --git a/chromium/ui/gl/init/gl_initializer_ozone.cc b/chromium/ui/gl/init/gl_initializer_ozone.cc index a42e220e2ba..7749343cf06 100644 --- a/chromium/ui/gl/init/gl_initializer_ozone.cc +++ b/chromium/ui/gl/init/gl_initializer_ozone.cc @@ -13,6 +13,7 @@ namespace gl { namespace init { +#if !defined(TOOLKIT_QT) bool InitializeGLOneOffPlatform() { if (HasGLOzone()) return GetGLOzone()->InitializeGLOneOffPlatform(); @@ -26,6 +27,7 @@ bool InitializeGLOneOffPlatform() { } return false; } +#endif bool InitializeStaticGLBindings(GLImplementation implementation) { // Prevent reinitialization with a different implementation. Once the gpu diff --git a/chromium/ui/gl/init/gl_initializer_win.cc b/chromium/ui/gl/init/gl_initializer_win.cc index 09d9d6f0ed8..d2a814e6f13 100644 --- a/chromium/ui/gl/init/gl_initializer_win.cc +++ b/chromium/ui/gl/init/gl_initializer_win.cc @@ -34,6 +34,14 @@ namespace { const wchar_t kD3DCompiler[] = L"D3DCompiler_47.dll"; +#if defined(NDEBUG) || !defined(TOOLKIT_QT) +const wchar_t kGLESv2Library[] = L"libglesv2.dll"; +const wchar_t kEGLLibrary[] = L"libegl.dll"; +#else +const wchar_t kGLESv2Library[] = L"libglesv2d.dll"; +const wchar_t kEGLLibrary[] = L"libegld.dll"; +#endif + bool LoadD3DXLibrary(const base::FilePath& module_path, const base::FilePath::StringType& name) { base::NativeLibrary library = @@ -111,18 +119,18 @@ bool InitializeStaticEGLInternal(GLImplementation implementation) { // the former and if there is another version of libglesv2.dll in the dll // search path, it will get loaded instead. base::NativeLibrary gles_library = - base::LoadNativeLibrary(gles_path.Append(L"libglesv2.dll"), nullptr); + base::LoadNativeLibrary(gles_path.Append(kGLESv2Library), nullptr); if (!gles_library) { - DVLOG(1) << "libglesv2.dll not found"; + DVLOG(1) << kGLESv2Library << "not found"; return false; } // When using EGL, first try eglGetProcAddress and then Windows // GetProcAddress on both the EGL and GLES2 DLLs. base::NativeLibrary egl_library = - base::LoadNativeLibrary(gles_path.Append(L"libegl.dll"), nullptr); + base::LoadNativeLibrary(gles_path.Append(kEGLLibrary), nullptr); if (!egl_library) { - DVLOG(1) << "libegl.dll not found."; + DVLOG(1) << kEGLLibrary << "not found."; base::UnloadNativeLibrary(gles_library); return false; } @@ -150,12 +158,25 @@ bool InitializeStaticEGLInternal(GLImplementation implementation) { } bool InitializeStaticWGLInternal() { +#ifdef TOOLKIT_QT + const wchar_t *libraryName = L"opengl32.dll"; + if (usingSoftwareDynamicGL()) + libraryName = L"opengl32sw.dll"; + + base::NativeLibrary library = + base::LoadNativeLibrary(base::FilePath(libraryName), nullptr); + if (!library) { + DVLOG(1) << libraryName << " not found"; + return false; + } +#else base::NativeLibrary library = base::LoadNativeLibrary(base::FilePath(L"opengl32.dll"), nullptr); if (!library) { DVLOG(1) << "opengl32.dll not found"; return false; } +#endif GLGetProcAddressProc get_proc_address = reinterpret_cast<GLGetProcAddressProc>( @@ -216,6 +237,7 @@ bool InitializeStaticWGLInternal() { } // namespace +#if !defined(TOOLKIT_QT) bool InitializeGLOneOffPlatform() { VSyncProviderWin::InitializeOneOff(); @@ -242,6 +264,7 @@ bool InitializeGLOneOffPlatform() { } return true; } +#endif bool InitializeStaticGLBindings(GLImplementation implementation) { // Prevent reinitialization with a different implementation. Once the gpu diff --git a/chromium/ui/gl/init/gl_initializer_x11.cc b/chromium/ui/gl/init/gl_initializer_x11.cc index 2392e65d612..9ad8ee64b9e 100644 --- a/chromium/ui/gl/init/gl_initializer_x11.cc +++ b/chromium/ui/gl/init/gl_initializer_x11.cc @@ -142,6 +142,7 @@ bool InitializeStaticEGLInternal(GLImplementation implementation) { } // namespace +#if !defined(TOOLKIT_QT) bool InitializeGLOneOffPlatform() { const base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); @@ -174,6 +175,7 @@ bool InitializeGLOneOffPlatform() { return true; } } +#endif bool InitializeStaticGLBindings(GLImplementation implementation) { // Prevent reinitialization with a different implementation. Once the gpu diff --git a/chromium/ui/gl/ui_gl.gni b/chromium/ui/gl/ui_gl.gni new file mode 100644 index 00000000000..8a268a5d067 --- /dev/null +++ b/chromium/ui/gl/ui_gl.gni @@ -0,0 +1,16 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/chrome_build.gni") +import("//build/config/ui.gni") +import("//ui/ozone/ozone.gni") + +declare_args() { + enable_swiftshader = (is_win || (is_linux && use_x11) || + (is_chromeos && ozone_platform_x11)) && + (target_cpu == "x86" || target_cpu == "x64") +} + +use_egl = is_win || is_android || is_linux || is_fuchsia +use_glx = use_x11 || ozone_platform_x11 diff --git a/chromium/ui/ozone/BUILD.gn b/chromium/ui/ozone/BUILD.gn index 247879c1aaf..3629f1ce61e 100644 --- a/chromium/ui/ozone/BUILD.gn +++ b/chromium/ui/ozone/BUILD.gn @@ -47,6 +47,10 @@ if (ozone_platform_x11) { ozone_platform_deps += [ "platform/x11" ] } +if (ozone_platform_external) { + ozone_platforms += [ ozone_platform ] +} + platform_list_cc_file = "$target_gen_dir/platform_list.cc" platform_list_h_file = "$target_gen_dir/platform_list.h" platform_list_txt_file = "$target_gen_dir/platform_list.txt" diff --git a/chromium/ui/ozone/ozone.gni b/chromium/ui/ozone/ozone.gni index 8e810513609..e9e67bf00bb 100644 --- a/chromium/ui/ozone/ozone.gni +++ b/chromium/ui/ozone/ozone.gni @@ -29,6 +29,7 @@ declare_args() { # Compile the 'wayland' platform. ozone_platform_wayland = false + ozone_platform_external = false if (ozone_auto_platforms) { # Use headless as the default platform unless modified below. @@ -65,5 +66,5 @@ declare_args() { assert(use_ozone || !(ozone_platform_cast || ozone_platform_gbm || ozone_platform_headless || ozone_platform_x11 || - ozone_platform_wayland), + ozone_platform_wayland || ozone_platform_external), "Must set use_ozone to select ozone platforms") diff --git a/chromium/ui/views/mus/BUILD.gn b/chromium/ui/views/mus/BUILD.gn index 8e836fda997..7c05602cc6f 100644 --- a/chromium/ui/views/mus/BUILD.gn +++ b/chromium/ui/views/mus/BUILD.gn @@ -200,6 +200,13 @@ test("views_mus_unittests") { "//services/ui/test_wm", ] + if (use_qt) { + data_deps -= [ + "//services/ui/ime/test_ime_driver", + "//services/ui/test_wm", + ] + } + if (is_win) { deps += [ "//build/win:default_exe_manifest", @@ -264,6 +271,12 @@ test("views_mus_interactive_ui_tests") { "//services/ui/test_wm", ] + if (use_qt) { + data_deps -= [ + "//services/ui/test_wm", + ] + } + if (is_win) { deps += [ "//build/win:default_exe_manifest", diff --git a/chromium/ui/views/widget/desktop_aura/desktop_screen_x11.cc b/chromium/ui/views/widget/desktop_aura/desktop_screen_x11.cc index 55ffb43ee48..b1ed42dee9d 100644 --- a/chromium/ui/views/widget/desktop_aura/desktop_screen_x11.cc +++ b/chromium/ui/views/widget/desktop_aura/desktop_screen_x11.cc @@ -44,7 +44,7 @@ namespace { // static gfx::ICCProfile GetICCProfileFromBestMonitor() { gfx::ICCProfile icc_profile; - if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless)) + if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kHeadless) || !gfx::GetXDisplay()) return icc_profile; Atom property = gfx::GetAtom("_ICC_PROFILE"); if (property != None) { diff --git a/chromium/url/origin.cc b/chromium/url/origin.cc index 0d52df0f284..384c5c75457 100644 --- a/chromium/url/origin.cc +++ b/chromium/url/origin.cc @@ -133,6 +133,9 @@ std::string Origin::Serialize() const { if (scheme() == kFileScheme) return "file://"; + if (scheme() == kQrcScheme) + return "qrc://"; + if (!suborigin_.empty()) { GURL url_with_suborigin = AddSuboriginToUrl(tuple_.GetURL(), suborigin_); return SchemeHostPort(url_with_suborigin).Serialize(); @@ -155,6 +158,9 @@ GURL Origin::GetURL() const { if (scheme() == kFileScheme) return GURL("file:///"); + if (scheme() == kQrcScheme) + return GURL("qrc://"); + GURL tuple_url(tuple_.GetURL()); if (!suborigin_.empty()) diff --git a/chromium/url/scheme_host_port.cc b/chromium/url/scheme_host_port.cc index f0f56850f4d..ea18aa832b3 100644 --- a/chromium/url/scheme_host_port.cc +++ b/chromium/url/scheme_host_port.cc @@ -23,6 +23,8 @@ namespace url { namespace { +extern const char kQrcScheme[] = "qrc"; + bool IsCanonicalHost(const base::StringPiece& host) { std::string canon_host; @@ -56,9 +58,12 @@ bool IsValidInput(const base::StringPiece& scheme, scheme.data(), Component(0, base::checked_cast<int>(scheme.length())), &scheme_type); - if (!is_standard) + if (!is_standard && scheme != kQrcScheme) return false; + if (scheme == kQrcScheme) + scheme_type = SCHEME_WITHOUT_PORT; + switch (scheme_type) { case SCHEME_WITH_PORT: // A URL with |scheme| is required to have the host and port (may be diff --git a/chromium/url/url_constants.cc b/chromium/url/url_constants.cc index 37fc82c1c45..76d4911dd94 100644 --- a/chromium/url/url_constants.cc +++ b/chromium/url/url_constants.cc @@ -27,6 +27,8 @@ const char kMailToScheme[] = "mailto"; const char kWsScheme[] = "ws"; const char kWssScheme[] = "wss"; +const char kQrcScheme[] = "qrc"; + const char kHttpSuboriginScheme[] = "http-so"; const char kHttpsSuboriginScheme[] = "https-so"; diff --git a/chromium/url/url_constants.h b/chromium/url/url_constants.h index 7e5cb53face..75f5e9c152e 100644 --- a/chromium/url/url_constants.h +++ b/chromium/url/url_constants.h @@ -33,6 +33,8 @@ URL_EXPORT extern const char kMailToScheme[]; URL_EXPORT extern const char kWsScheme[]; URL_EXPORT extern const char kWssScheme[]; +URL_EXPORT extern const char kQrcScheme[]; + // Special HTTP and HTTPS schemes for serialization of suborigins. See // https://w3c.github.io/webappsec-suborigins/. URL_EXPORT extern const char kHttpSuboriginScheme[]; diff --git a/chromium/v8/BUILD.gn b/chromium/v8/BUILD.gn index daed449c0a5..d7d559fba47 100644 --- a/chromium/v8/BUILD.gn +++ b/chromium/v8/BUILD.gn @@ -110,6 +110,10 @@ declare_args() { # Similar to the ARM hard float ABI but on MIPS. v8_use_mips_abi_hardfloat = true + # If true, doesn't compile debug symbols into v8base reducing the + # size of the binary and increasing the speed of gdb. + remove_v8base_debug_symbols = false + # Controls the threshold for on-heap/off-heap Typed Arrays. v8_typed_array_max_size_in_heap = 64 @@ -2433,6 +2437,11 @@ v8_source_set("v8_base") { sources += [ "$target_gen_dir/debug-support.cc" ] deps += [ ":postmortem-metadata" ] } + + if (remove_v8base_debug_symbols) { + v8_remove_configs += [ "//build/config/compiler:default_symbols" ] + v8_add_configs += [ "//build/config/compiler:no_symbols" ] + } } v8_component("v8_libbase") { diff --git a/ninja/configure.py b/ninja/configure.py index a4437489426..5e3bb970399 100755 --- a/ninja/configure.py +++ b/ninja/configure.py @@ -314,6 +314,8 @@ if platform.is_msvc(): '/wd4355', # Disable warnings about ignored typedef in DbgHelp.h '/wd4091', + # Disable warnings about 'noexcept' used with no exception handling mode specified + '/wd4577', '/GR-', # Disable RTTI. # Disable size_t -> int truncation warning. # We never have strings or arrays larger than 2**31. |