diff options
Diffstat (limited to 'chromium/content/child')
26 files changed, 239 insertions, 201 deletions
diff --git a/chromium/content/child/BUILD.gn b/chromium/content/child/BUILD.gn index 37cdca73cef..fbb110d2d40 100644 --- a/chromium/content/child/BUILD.gn +++ b/chromium/content/child/BUILD.gn @@ -4,8 +4,8 @@ import("//build/config/features.gni") import("//build/config/ui.gni") -import("//ppapi/features/features.gni") -import("//third_party/WebKit/public/public_features.gni") +import("//ppapi/buildflags/buildflags.gni") +import("//third_party/blink/public/public_features.gni") if (is_component_build) { link_target_type = "source_set" @@ -43,10 +43,10 @@ target(link_target_type, "child") { "child_process.h", "child_process_sandbox_support_impl_linux.cc", "child_process_sandbox_support_impl_linux.h", + "child_process_sandbox_support_impl_mac.cc", + "child_process_sandbox_support_impl_mac.h", "child_thread_impl.cc", "child_thread_impl.h", - "content_child_helpers.cc", - "content_child_helpers.h", "dwrite_font_proxy/dwrite_font_proxy_init_impl_win.cc", "dwrite_font_proxy/dwrite_font_proxy_init_impl_win.h", "dwrite_font_proxy/dwrite_font_proxy_win.cc", @@ -107,7 +107,7 @@ target(link_target_type, "child") { "//media", "//media/blink", "//mojo/common", - "//mojo/edk/system", + "//mojo/edk", "//net", "//services/device/public/cpp:device_features", "//services/device/public/cpp/power_monitor", @@ -119,12 +119,12 @@ target(link_target_type, "child") { "//services/tracing/public/cpp", "//skia", "//storage/common", - "//third_party/WebKit/public:blink_headers", - "//third_party/WebKit/public:features", - "//third_party/WebKit/public:mojo_bindings", - "//third_party/WebKit/public:resources", - "//third_party/WebKit/public:scaled_resources", - "//third_party/WebKit/public/common", + "//third_party/blink/public:blink_headers", + "//third_party/blink/public:buildflags", + "//third_party/blink/public:mojo_bindings", + "//third_party/blink/public:resources", + "//third_party/blink/public:scaled_resources", + "//third_party/blink/public/common", "//third_party/ced", "//third_party/zlib/google:compression_utils", "//ui/base", diff --git a/chromium/content/child/assert_matching_enums.cc b/chromium/content/child/assert_matching_enums.cc index 75b0cc828dc..b2b3db58b71 100644 --- a/chromium/content/child/assert_matching_enums.cc +++ b/chromium/content/child/assert_matching_enums.cc @@ -8,11 +8,11 @@ #include "base/macros.h" #include "content/public/common/screen_orientation_values.h" #include "media/base/mime_util.h" -#include "third_party/WebKit/public/platform/WebMenuSourceType.h" -#include "third_party/WebKit/public/platform/WebTextInputMode.h" -#include "third_party/WebKit/public/platform/WebTextInputType.h" -#include "third_party/WebKit/public/platform/modules/screen_orientation/WebScreenOrientationLockType.h" -#include "third_party/WebKit/public/web/WebFrameSerializerCacheControlPolicy.h" +#include "third_party/blink/public/platform/modules/screen_orientation/web_screen_orientation_lock_type.h" +#include "third_party/blink/public/platform/web_menu_source_type.h" +#include "third_party/blink/public/platform/web_text_input_mode.h" +#include "third_party/blink/public/platform/web_text_input_type.h" +#include "third_party/blink/public/web/web_frame_serializer_cache_control_policy.h" #include "ui/base/ime/text_input_mode.h" #include "ui/base/ime/text_input_type.h" #include "ui/base/ui_base_types.h" diff --git a/chromium/content/child/blink_platform_impl.cc b/chromium/content/child/blink_platform_impl.cc index d96f505fb11..aa67eb82782 100644 --- a/chromium/content/child/blink_platform_impl.cc +++ b/chromium/content/child/blink_platform_impl.cc @@ -13,7 +13,6 @@ #include "base/files/file_path.h" #include "base/location.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/memory/singleton.h" #include "base/metrics/user_metrics_action.h" #include "base/rand_util.h" @@ -33,27 +32,27 @@ #include "base/trace_event/memory_allocator_dump_guid.h" #include "base/trace_event/memory_dump_manager.h" #include "base/trace_event/trace_event.h" -#include "blink/public/resources/grit/blink_image_resources.h" -#include "blink/public/resources/grit/blink_resources.h" -#include "blink/public/resources/grit/media_controls_resources.h" #include "build/build_config.h" #include "content/app/resources/grit/content_resources.h" #include "content/app/strings/grit/content_strings.h" #include "content/child/child_thread_impl.h" -#include "content/child/content_child_helpers.h" #include "content/public/common/content_client.h" #include "content/public/common/content_features.h" +#include "content/public/common/content_switches.h" #include "content/public/common/service_manager_connection.h" #include "content/public/common/service_names.mojom.h" #include "net/base/net_errors.h" #include "services/network/public/cpp/features.h" -#include "third_party/WebKit/public/platform/WebData.h" -#include "third_party/WebKit/public/platform/WebFloatPoint.h" -#include "third_party/WebKit/public/platform/WebGestureCurve.h" -#include "third_party/WebKit/public/platform/WebSecurityOrigin.h" -#include "third_party/WebKit/public/platform/WebString.h" -#include "third_party/WebKit/public/platform/WebURL.h" -#include "third_party/WebKit/public/platform/scheduler/child/webthread_base.h" +#include "third_party/blink/public/platform/scheduler/child/webthread_base.h" +#include "third_party/blink/public/platform/web_data.h" +#include "third_party/blink/public/platform/web_float_point.h" +#include "third_party/blink/public/platform/web_gesture_curve.h" +#include "third_party/blink/public/platform/web_security_origin.h" +#include "third_party/blink/public/platform/web_string.h" +#include "third_party/blink/public/platform/web_url.h" +#include "third_party/blink/public/resources/grit/blink_image_resources.h" +#include "third_party/blink/public/resources/grit/blink_resources.h" +#include "third_party/blink/public/resources/grit/media_controls_resources.h" #include "third_party/zlib/google/compression_utils.h" #include "ui/base/layout.h" #include "ui/events/gestures/blink/web_gesture_curve_impl.h" @@ -374,24 +373,21 @@ WebString BlinkPlatformImpl::UserAgent() { std::unique_ptr<blink::WebThread> BlinkPlatformImpl::CreateThread( const blink::WebThreadCreationParams& params) { std::unique_ptr<blink::scheduler::WebThreadBase> thread = - blink::scheduler::WebThreadBase::CreateWorkerThread( - params.name, base::Thread::Options()); + blink::scheduler::WebThreadBase::CreateWorkerThread(params); thread->Init(); WaitUntilWebThreadTLSUpdate(thread.get()); return std::move(thread); } std::unique_ptr<blink::WebThread> BlinkPlatformImpl::CreateWebAudioThread() { - base::Thread::Options thread_options; - + blink::WebThreadCreationParams params(blink::WebThreadType::kWebAudioThread); // WebAudio uses a thread with |DISPLAY| priority to avoid glitch when the // system is under the high pressure. Note that the main browser thread also // runs with same priority. (see: crbug.com/734539) - thread_options.priority = base::ThreadPriority::DISPLAY; + params.thread_options.priority = base::ThreadPriority::DISPLAY; std::unique_ptr<blink::scheduler::WebThreadBase> thread = - blink::scheduler::WebThreadBase::CreateWorkerThread( - "WebAudio Rendering Thread", thread_options); + blink::scheduler::WebThreadBase::CreateWorkerThread(params); thread->Init(); WaitUntilWebThreadTLSUpdate(thread.get()); return std::move(thread); @@ -542,6 +538,8 @@ const DataResource kDataResources[] = { {"validation_bubble.css", IDR_VALIDATION_BUBBLE_CSS, ui::SCALE_FACTOR_NONE, true}, {"placeholderIcon", IDR_PLACEHOLDER_ICON, ui::SCALE_FACTOR_100P, false}, + {"brokenCanvas", IDR_BROKENCANVAS, ui::SCALE_FACTOR_100P, false}, + {"brokenCanvas@2x", IDR_BROKENCANVAS, ui::SCALE_FACTOR_200P, false}, }; class NestedMessageLoopRunnerImpl @@ -744,20 +742,18 @@ bool BlinkPlatformImpl::DatabaseSetFileSize( return false; } -size_t BlinkPlatformImpl::ActualMemoryUsageMB() { - return GetMemoryUsageKB() >> 10; -} - size_t BlinkPlatformImpl::NumberOfProcessors() { return static_cast<size_t>(base::SysInfo::NumberOfProcessors()); } size_t BlinkPlatformImpl::MaxDecodedImageBytes() { + const int kMB = 1024 * 1024; + const int kMaxNumberOfBytesPerPixel = 4; #if defined(OS_ANDROID) if (base::SysInfo::IsLowEndDevice()) { // Limit image decoded size to 3M pixels on low end devices. // 4 is maximum number of bytes per pixel. - return 3 * 1024 * 1024 * 4; + return 3 * kMB * kMaxNumberOfBytesPerPixel; } // For other devices, limit decoded image size based on the amount of physical // memory. @@ -768,7 +764,16 @@ size_t BlinkPlatformImpl::MaxDecodedImageBytes() { // common texture size. return base::SysInfo::AmountOfPhysicalMemory() / 25; #else - return kNoDecodedImageByteLimit; + size_t max_decoded_image_byte_limit = kNoDecodedImageByteLimit; + base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); + if (command_line.HasSwitch(switches::kMaxDecodedImageSizeMb)) { + if (base::StringToSizeT( + command_line.GetSwitchValueASCII(switches::kMaxDecodedImageSizeMb), + &max_decoded_image_byte_limit)) { + max_decoded_image_byte_limit *= kMB * kMaxNumberOfBytesPerPixel; + } + } + return max_decoded_image_byte_limit; #endif } diff --git a/chromium/content/child/blink_platform_impl.h b/chromium/content/child/blink_platform_impl.h index 24be82401ec..f9d13cf958a 100644 --- a/chromium/content/child/blink_platform_impl.h +++ b/chromium/content/child/blink_platform_impl.h @@ -18,10 +18,10 @@ #include "content/child/webfallbackthemeengine_impl.h" #include "content/common/content_export.h" #include "media/blink/webmediacapabilitiesclient_impl.h" -#include "third_party/WebKit/public/platform/Platform.h" -#include "third_party/WebKit/public/platform/WebGestureDevice.h" -#include "third_party/WebKit/public/platform/WebURLError.h" -#include "third_party/WebKit/public/public_features.h" +#include "third_party/blink/public/platform/platform.h" +#include "third_party/blink/public/platform/web_gesture_device.h" +#include "third_party/blink/public/platform/web_url_error.h" +#include "third_party/blink/public/public_buildflags.h" #include "ui/base/layout.h" #if BUILDFLAG(USE_DEFAULT_RENDER_THEME) @@ -71,7 +71,6 @@ class CONTENT_EXPORT BlinkPlatformImpl : public blink::Platform { const blink::WebSecurityOrigin& origin) override; bool DatabaseSetFileSize(const blink::WebString& vfs_file_name, long long size) override; - size_t ActualMemoryUsageMB() override; size_t NumberOfProcessors() override; size_t MaxDecodedImageBytes() override; diff --git a/chromium/content/child/blink_platform_impl_unittest.cc b/chromium/content/child/blink_platform_impl_unittest.cc index 872734d1ee3..6cb1152a775 100644 --- a/chromium/content/child/blink_platform_impl_unittest.cc +++ b/chromium/content/child/blink_platform_impl_unittest.cc @@ -9,8 +9,8 @@ #include "base/run_loop.h" #include "base/time/time.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/WebKit/public/platform/WebSecurityOrigin.h" -#include "third_party/WebKit/public/platform/WebString.h" +#include "third_party/blink/public/platform/web_security_origin.h" +#include "third_party/blink/public/platform/web_string.h" #include "url/origin.h" namespace content { diff --git a/chromium/content/child/browser_font_resource_trusted.cc b/chromium/content/child/browser_font_resource_trusted.cc index 64f59f578cb..fb4a65c7f5e 100644 --- a/chromium/content/child/browser_font_resource_trusted.cc +++ b/chromium/content/child/browser_font_resource_trusted.cc @@ -18,13 +18,13 @@ #include "ppapi/thunk/ppb_image_data_api.h" #include "ppapi/thunk/thunk.h" #include "skia/ext/platform_canvas.h" -#include "third_party/WebKit/public/platform/WebCanvas.h" -#include "third_party/WebKit/public/platform/WebFloatPoint.h" -#include "third_party/WebKit/public/platform/WebFloatRect.h" -#include "third_party/WebKit/public/platform/WebFont.h" -#include "third_party/WebKit/public/platform/WebFontDescription.h" -#include "third_party/WebKit/public/platform/WebRect.h" -#include "third_party/WebKit/public/platform/WebTextRun.h" +#include "third_party/blink/public/platform/web_canvas.h" +#include "third_party/blink/public/platform/web_float_point.h" +#include "third_party/blink/public/platform/web_float_rect.h" +#include "third_party/blink/public/platform/web_font.h" +#include "third_party/blink/public/platform/web_font_description.h" +#include "third_party/blink/public/platform/web_rect.h" +#include "third_party/blink/public/platform/web_text_run.h" #include "third_party/icu/source/common/unicode/ubidi.h" #include "third_party/skia/include/core/SkRect.h" diff --git a/chromium/content/child/child_process_sandbox_support_impl_linux.cc b/chromium/content/child/child_process_sandbox_support_impl_linux.cc index 308d214f099..587ddeab58e 100644 --- a/chromium/content/child/child_process_sandbox_support_impl_linux.cc +++ b/chromium/content/child/child_process_sandbox_support_impl_linux.cc @@ -17,10 +17,10 @@ #include "base/trace_event/trace_event.h" #include "content/public/common/common_sandbox_support_linux.h" #include "services/service_manager/sandbox/linux/sandbox_linux.h" -#include "third_party/WebKit/public/platform/WebFontRenderStyle.h" -#include "third_party/WebKit/public/platform/WebString.h" -#include "third_party/WebKit/public/platform/WebVector.h" -#include "third_party/WebKit/public/platform/linux/WebFallbackFont.h" +#include "third_party/blink/public/platform/linux/web_fallback_font.h" +#include "third_party/blink/public/platform/web_font_render_style.h" +#include "third_party/blink/public/platform/web_string.h" +#include "third_party/blink/public/platform/web_vector.h" namespace content { diff --git a/chromium/content/child/child_process_sandbox_support_impl_mac.cc b/chromium/content/child/child_process_sandbox_support_impl_mac.cc new file mode 100644 index 00000000000..0cd80ca28be --- /dev/null +++ b/chromium/content/child/child_process_sandbox_support_impl_mac.cc @@ -0,0 +1,45 @@ +// Copyright 2018 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 "content/child/child_process_sandbox_support_impl_mac.h" + +#include <utility> + +#include "base/mac/scoped_cftyperef.h" +#include "base/numerics/safe_conversions.h" +#include "base/strings/string16.h" +#include "base/strings/sys_string_conversions.h" +#include "content/common/mac/font_loader.h" +#include "content/public/child/child_thread.h" +#include "mojo/public/cpp/system/buffer.h" + +namespace content { + +bool LoadFont(CTFontRef font, CGFontRef* out, uint32_t* font_id) { + base::ScopedCFTypeRef<CFStringRef> name_ref(CTFontCopyPostScriptName(font)); + base::string16 font_name = SysCFStringRefToUTF16(name_ref); + float font_point_size = CTFontGetSize(font); + mojo::ScopedSharedBufferHandle font_data; + bool success = content::ChildThread::Get()->LoadFont( + font_name, font_point_size, &font_data, font_id) && + *font_id > 0 && font_data.is_valid(); + if (!success) { + DLOG(ERROR) << "Bad response from LoadFont() for " << font_name; + *out = nullptr; + *font_id = 0; + return false; + } + + uint64_t font_data_size = font_data->GetSize(); + DCHECK_GT(font_data_size, 0U); + DCHECK(base::IsValueInRangeForNumericType<uint32_t>(font_data_size)); + + // TODO(jeremy): Need to call back into the requesting process to make sure + // that the font isn't already activated, based on the font id. If it's + // already activated, don't reactivate it here - https://crbug.com/72727 . + return FontLoader::CGFontRefFromBuffer( + std::move(font_data), static_cast<uint32_t>(font_data_size), out); +} + +} // namespace content diff --git a/chromium/content/child/child_process_sandbox_support_impl_mac.h b/chromium/content/child/child_process_sandbox_support_impl_mac.h new file mode 100644 index 00000000000..53cdad1d52b --- /dev/null +++ b/chromium/content/child/child_process_sandbox_support_impl_mac.h @@ -0,0 +1,18 @@ +// Copyright 2018 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. + +#ifndef CONTENT_CHILD_CHILD_PROCESS_SANDBOX_SUPPORT_IMPL_MAC_H_ +#define CONTENT_CHILD_CHILD_PROCESS_SANDBOX_SUPPORT_IMPL_MAC_H_ + +#include <CoreText/CoreText.h> + +namespace content { + +// Load a font specified by |font| into |out| through communicating +// with browser. +bool LoadFont(CTFontRef font, CGFontRef* out, uint32_t* font_id); + +}; // namespace content + +#endif // CONTENT_CHILD_CHILD_PROCESS_SANDBOX_SUPPORT_IMPL_MAC_H_ diff --git a/chromium/content/child/child_thread_impl.cc b/chromium/content/child/child_thread_impl.cc index ecf9f7caf08..2663268bce3 100644 --- a/chromium/content/child/child_thread_impl.cc +++ b/chromium/content/child/child_thread_impl.cc @@ -17,7 +17,6 @@ #include "base/location.h" #include "base/logging.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/message_loop/message_loop.h" #include "base/message_loop/timer_slack.h" #include "base/metrics/field_trial.h" @@ -521,9 +520,15 @@ void ChildThreadImpl::Init(const Options& options) { if (!base::PowerMonitor::Get() && service_manager_connection_) { auto power_monitor_source = std::make_unique<device::PowerMonitorBroadcastSource>( - GetConnector(), GetIOTaskRunner()); + GetIOTaskRunner()); + auto* source_ptr = power_monitor_source.get(); power_monitor_.reset( new base::PowerMonitor(std::move(power_monitor_source))); + // The two-phase init is necessary to ensure that the process-wide + // PowerMonitor is set before the power monitor source receives incoming + // communication from the browser process (see https://crbug.com/821790 for + // details) + source_ptr->Init(GetConnector()); } #if defined(OS_POSIX) @@ -603,8 +608,8 @@ void ChildThreadImpl::InitTracing() { channel_->AddFilter(new tracing::ChildTraceMessageFilter( ChildProcess::current()->io_task_runner())); - chrome_trace_event_agent_ = - std::make_unique<tracing::ChromeTraceEventAgent>(GetConnector()); + chrome_trace_event_agent_ = std::make_unique<tracing::ChromeTraceEventAgent>( + GetConnector(), false /* request_clock_sync_marker_on_android */); } ChildThreadImpl::~ChildThreadImpl() { @@ -673,6 +678,22 @@ mojom::FontCacheWin* ChildThreadImpl::GetFontCacheWin() { } return font_cache_win_ptr_.get(); } +#elif defined(OS_MACOSX) +bool ChildThreadImpl::LoadFont(const base::string16& font_name, + float font_point_size, + mojo::ScopedSharedBufferHandle* out_font_data, + uint32_t* out_font_id) { + return GetFontLoaderMac()->LoadFont(font_name, font_point_size, out_font_data, + out_font_id); +} + +mojom::FontLoaderMac* ChildThreadImpl::GetFontLoaderMac() { + if (!font_loader_mac_ptr_) { + GetConnector()->BindInterface(mojom::kBrowserServiceName, + &font_loader_mac_ptr_); + } + return font_loader_mac_ptr_.get(); +} #endif void ChildThreadImpl::RecordAction(const base::UserMetricsAction& action) { @@ -737,7 +758,9 @@ void ChildThreadImpl::OnAssociatedInterfaceRequest( if (interface_name == mojom::RouteProvider::Name_) { DCHECK(!route_provider_binding_.is_bound()); route_provider_binding_.Bind( - mojom::RouteProviderAssociatedRequest(std::move(handle))); + mojom::RouteProviderAssociatedRequest(std::move(handle)), + ipc_task_runner_ ? ipc_task_runner_ + : base::ThreadTaskRunnerHandle::Get()); } else { LOG(ERROR) << "Request for unknown Channel-associated interface: " << interface_name; @@ -759,14 +782,14 @@ void ChildThreadImpl::ProcessShutdown() { base::RunLoop::QuitCurrentWhenIdleDeprecated(); } -void ChildThreadImpl::SetIPCLoggingEnabled(bool enable) { #if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED) +void ChildThreadImpl::SetIPCLoggingEnabled(bool enable) { if (enable) IPC::Logging::GetInstance()->Enable(); else IPC::Logging::GetInstance()->Disable(); -#endif // IPC_MESSAGE_LOG_ENABLED } +#endif // IPC_MESSAGE_LOG_ENABLED void ChildThreadImpl::OnChildControlRequest( mojom::ChildControlRequest request) { diff --git a/chromium/content/child/child_thread_impl.h b/chromium/content/child/child_thread_impl.h index 0d6aa96f348..523af416a39 100644 --- a/chromium/content/child/child_thread_impl.h +++ b/chromium/content/child/child_thread_impl.h @@ -24,7 +24,7 @@ #include "content/common/content_export.h" #include "content/public/child/child_thread.h" #include "ipc/ipc.mojom.h" -#include "ipc/ipc_features.h" // For BUILDFLAG(IPC_MESSAGE_LOG_ENABLED). +#include "ipc/ipc_buildflags.h" // For BUILDFLAG(IPC_MESSAGE_LOG_ENABLED). #include "ipc/ipc_platform_file.h" #include "ipc/message_router.h" #include "mojo/public/cpp/bindings/associated_binding.h" @@ -33,6 +33,8 @@ #if defined(OS_WIN) #include "content/public/common/font_cache_win.mojom.h" +#elif defined(OS_MACOSX) +#include "content/common/font_loader_mac.mojom.h" #endif namespace base { @@ -90,6 +92,11 @@ class CONTENT_EXPORT ChildThreadImpl #if defined(OS_WIN) void PreCacheFont(const LOGFONT& log_font) override; void ReleaseCachedFonts() override; +#elif defined(OS_MACOSX) + bool LoadFont(const base::string16& font_name, + float font_point_size, + mojo::ScopedSharedBufferHandle* out_font_data, + uint32_t* out_font_id) override; #endif void RecordAction(const base::UserMetricsAction& action) override; void RecordComputedAction(const std::string& action) override; @@ -150,7 +157,9 @@ class CONTENT_EXPORT ChildThreadImpl // mojom::ChildControl void ProcessShutdown() override; +#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED) void SetIPCLoggingEnabled(bool enable) override; +#endif void OnChildControlRequest(mojom::ChildControlRequest); virtual bool OnControlMessageReceived(const IPC::Message& msg); @@ -165,6 +174,10 @@ class CONTENT_EXPORT ChildThreadImpl bool IsInBrowserProcess() const; +#if defined(OS_MACOSX) + virtual mojom::FontLoaderMac* GetFontLoaderMac(); +#endif + private: class ChildThreadMessageRouter : public IPC::MessageRouter { public: @@ -216,6 +229,8 @@ class CONTENT_EXPORT ChildThreadImpl mojom::RouteProviderAssociatedPtr remote_route_provider_; #if defined(OS_WIN) mojom::FontCacheWinPtr font_cache_win_ptr_; +#elif defined(OS_MACOSX) + mojom::FontLoaderMacPtr font_loader_mac_ptr_; #endif std::unique_ptr<IPC::SyncChannel> channel_; diff --git a/chromium/content/child/content_child_helpers.cc b/chromium/content/child/content_child_helpers.cc deleted file mode 100644 index 7ddeb4d16a9..00000000000 --- a/chromium/content/child/content_child_helpers.cc +++ /dev/null @@ -1,65 +0,0 @@ -// 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. - -#include "content/child/content_child_helpers.h" - -#include <stdint.h> - -#include <memory> - -#include "base/logging.h" -#include "base/process/process_metrics.h" -#include "build/build_config.h" -#include "v8/include/v8.h" - -#if defined(OS_LINUX) -#include <malloc.h> -#endif - -namespace content { - -// TODO(primiano): get rid of this file together with --memory-metrics. -// This function is both misplaced and misnamed. If useful, this should -// be moved to base/process/process_metrics.h. Regardless the name, -// though, this provides only a partial and misleading value. -// Unfortunately some telemetry benchmark rely on it and these need to -// be refactored before getting rid of this. See crbug.com/581365 . -#if defined(OS_LINUX) || defined(OS_ANDROID) -size_t GetMemoryUsageKB() { - struct mallinfo minfo = mallinfo(); - uint64_t mem_usage = -#if defined(USE_TCMALLOC) - minfo.uordblks -#else - (minfo.hblkhd + minfo.arena) -#endif - >> 10; - - v8::HeapStatistics stat; - // TODO(svenpanne) The call below doesn't take web workers into account, this - // has to be done manually by iterating over all Isolates involved. - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - if (isolate) - isolate->GetHeapStatistics(&stat); - return mem_usage + (static_cast<uint64_t>(stat.total_heap_size()) >> 10); -} -#elif defined(OS_MACOSX) -size_t GetMemoryUsageKB() { - std::unique_ptr<base::ProcessMetrics> process_metrics( - // The default port provider is sufficient to get data for the current - // process. - base::ProcessMetrics::CreateProcessMetrics( - base::GetCurrentProcessHandle(), NULL)); - return process_metrics->GetWorkingSetSize() >> 10; -} -#else -size_t GetMemoryUsageKB() { - std::unique_ptr<base::ProcessMetrics> process_metrics( - base::ProcessMetrics::CreateProcessMetrics( - base::GetCurrentProcessHandle())); - return process_metrics->GetPagefileUsage() >> 10; -} -#endif - -} // namespace content diff --git a/chromium/content/child/content_child_helpers.h b/chromium/content/child/content_child_helpers.h deleted file mode 100644 index 33dc4ab9bf4..00000000000 --- a/chromium/content/child/content_child_helpers.h +++ /dev/null @@ -1,20 +0,0 @@ -// 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. - -#ifndef CONTENT_CHILD_CONTENT_CHILD_HELPERS_H_ -#define CONTENT_CHILD_CONTENT_CHILD_HELPERS_H_ - -#include <stddef.h> - -namespace content { - -// Returns an estimate of the memory usage of the renderer process. Different -// platforms implement this function differently, and count in different -// allocations. Results are not comparable across platforms. The estimate is -// computed inside the sandbox and thus its not always accurate. -size_t GetMemoryUsageKB(); - -} // content - -#endif // CONTENT_CHILD_CONTENT_CHILD_HELPERS_H_ diff --git a/chromium/content/child/dwrite_font_proxy/dwrite_font_proxy_init_impl_win.cc b/chromium/content/child/dwrite_font_proxy/dwrite_font_proxy_init_impl_win.cc index 7ea43bb9f56..6f8be2d2672 100644 --- a/chromium/content/child/dwrite_font_proxy/dwrite_font_proxy_init_impl_win.cc +++ b/chromium/content/child/dwrite_font_proxy/dwrite_font_proxy_init_impl_win.cc @@ -16,7 +16,7 @@ #include "content/child/font_warmup_win.h" #include "content/public/common/service_names.mojom.h" #include "skia/ext/fontmgr_default_win.h" -#include "third_party/WebKit/public/web/win/WebFontRendering.h" +#include "third_party/blink/public/web/win/web_font_rendering.h" #include "third_party/skia/include/ports/SkFontMgr.h" #include "third_party/skia/include/ports/SkTypeface_win.h" diff --git a/chromium/content/child/font_warmup_win.cc b/chromium/content/child/font_warmup_win.cc index 19350e968e1..d9e98c1f790 100644 --- a/chromium/content/child/font_warmup_win.cc +++ b/chromium/content/child/font_warmup_win.cc @@ -23,7 +23,7 @@ #include "base/win/iat_patch_function.h" #include "base/win/windows_version.h" #include "build/build_config.h" -#include "ppapi/features/features.h" +#include "ppapi/buildflags/buildflags.h" #include "skia/ext/fontmgr_default_win.h" #include "third_party/skia/include/core/SkRefCnt.h" #include "third_party/skia/include/ports/SkFontMgr.h" @@ -355,18 +355,20 @@ class GdiFontPatchDataImpl : public content::GdiFontPatchData { GdiFontPatchDataImpl::GdiFontPatchDataImpl(const base::FilePath& path) { DoSingleGdiPatch(create_compatible_dc_patch_, path, "CreateCompatibleDC", - CreateCompatibleDCPatch); + reinterpret_cast<void*>(CreateCompatibleDCPatch)); DoSingleGdiPatch(create_font_indirect_patch_, path, "CreateFontIndirectW", - CreateFontIndirectWPatch); - DoSingleGdiPatch(create_delete_dc_patch_, path, "DeleteDC", DeleteDCPatch); + reinterpret_cast<void*>(CreateFontIndirectWPatch)); + DoSingleGdiPatch(create_delete_dc_patch_, path, "DeleteDC", + reinterpret_cast<void*>(DeleteDCPatch)); DoSingleGdiPatch(create_delete_object_patch_, path, "DeleteObject", - DeleteObjectPatch); + reinterpret_cast<void*>(DeleteObjectPatch)); DoSingleGdiPatch(create_enum_font_families_patch_, path, - "EnumFontFamiliesExW", EnumFontFamiliesExWPatch); + "EnumFontFamiliesExW", + reinterpret_cast<void*>(EnumFontFamiliesExWPatch)); DoSingleGdiPatch(create_get_font_data_patch_, path, "GetFontData", - GetFontDataPatch); + reinterpret_cast<void*>(GetFontDataPatch)); DoSingleGdiPatch(create_select_object_patch_, path, "SelectObject", - SelectObjectPatch); + reinterpret_cast<void*>(SelectObjectPatch)); } } // namespace @@ -398,26 +400,29 @@ void PatchServiceManagerCalls() { is_patched = true; - DWORD patched = - g_iat_patch_open_sc_manager.Patch(L"dwrite.dll", service_provider_dll, - "OpenSCManagerW", OpenSCManagerWPatch); + DWORD patched = g_iat_patch_open_sc_manager.Patch( + L"dwrite.dll", service_provider_dll, "OpenSCManagerW", + reinterpret_cast<void*>(OpenSCManagerWPatch)); DCHECK(patched == 0); patched = g_iat_patch_close_service_handle.Patch( L"dwrite.dll", service_provider_dll, "CloseServiceHandle", - CloseServiceHandlePatch); + reinterpret_cast<void*>(CloseServiceHandlePatch)); DCHECK(patched == 0); - patched = g_iat_patch_open_service.Patch(L"dwrite.dll", service_provider_dll, - "OpenServiceW", OpenServiceWPatch); + patched = g_iat_patch_open_service.Patch( + L"dwrite.dll", service_provider_dll, "OpenServiceW", + reinterpret_cast<void*>(OpenServiceWPatch)); DCHECK(patched == 0); patched = g_iat_patch_start_service.Patch( - L"dwrite.dll", service_provider_dll, "StartServiceW", StartServiceWPatch); + L"dwrite.dll", service_provider_dll, "StartServiceW", + reinterpret_cast<void*>(StartServiceWPatch)); DCHECK(patched == 0); patched = g_iat_patch_nt_connect_port.Patch( - L"dwrite.dll", "ntdll.dll", "NtAlpcConnectPort", NtALpcConnectPortPatch); + L"dwrite.dll", "ntdll.dll", "NtAlpcConnectPort", + reinterpret_cast<void*>(NtALpcConnectPortPatch)); DCHECK(patched == 0); } diff --git a/chromium/content/child/image_decoder.cc b/chromium/content/child/image_decoder.cc index 33e5835ddd9..b4d7b3ca6d4 100644 --- a/chromium/content/child/image_decoder.cc +++ b/chromium/content/child/image_decoder.cc @@ -5,9 +5,9 @@ #include "content/child/image_decoder.h" #include "content/public/child/image_decoder_utils.h" -#include "third_party/WebKit/public/platform/WebData.h" -#include "third_party/WebKit/public/platform/WebImage.h" -#include "third_party/WebKit/public/platform/WebSize.h" +#include "third_party/blink/public/platform/web_data.h" +#include "third_party/blink/public/platform/web_image.h" +#include "third_party/blink/public/platform/web_size.h" #include "third_party/skia/include/core/SkBitmap.h" using blink::WebData; diff --git a/chromium/content/child/runtime_features.cc b/chromium/content/child/runtime_features.cc index 5835127cdbd..03a522caa66 100644 --- a/chromium/content/child/runtime_features.cc +++ b/chromium/content/child/runtime_features.cc @@ -18,7 +18,7 @@ #include "media/base/media_switches.h" #include "services/device/public/cpp/device_features.h" #include "services/network/public/cpp/features.h" -#include "third_party/WebKit/public/platform/WebRuntimeFeatures.h" +#include "third_party/blink/public/platform/web_runtime_features.h" #include "ui/gfx/switches.h" #include "ui/gl/gl_switches.h" #include "ui/native_theme/native_theme_features.h" @@ -81,10 +81,6 @@ static void SetRuntimeFeatureDefaultsForPlatform() { #if !defined(OS_MACOSX) WebRuntimeFeatures::EnableNotificationContentImage(true); #endif - -#if defined(OS_ANDROID) - WebRuntimeFeatures::EnableDoubleTapToJumpOnVideo(true); -#endif } void SetRuntimeFeaturesDefaultsAndUpdateFromArgs( @@ -130,9 +126,6 @@ void SetRuntimeFeaturesDefaultsAndUpdateFromArgs( if (command_line.HasSwitch(switches::kDisableFileSystem)) WebRuntimeFeatures::EnableFileSystem(false); - if (command_line.HasSwitch(switches::kEnableExperimentalCanvasFeatures)) - WebRuntimeFeatures::EnableExperimentalCanvasFeatures(true); - if (!command_line.HasSwitch(switches::kDisableAcceleratedJpegDecoding)) WebRuntimeFeatures::EnableDecodeToYUV(true); @@ -211,8 +204,11 @@ void SetRuntimeFeaturesDefaultsAndUpdateFromArgs( if (command_line.HasSwitch(switches::kEnableWebVR)) WebRuntimeFeatures::EnableWebVR(true); - WebRuntimeFeatures::EnableWebXR( - base::FeatureList::IsEnabled(features::kWebXr)); + if (base::FeatureList::IsEnabled(features::kWebXr)) + WebRuntimeFeatures::EnableWebXR(true); + + if (base::FeatureList::IsEnabled(features::kWebXrGamepadSupport)) + WebRuntimeFeatures::EnableWebXRGamepadSupport(true); if (command_line.HasSwitch(switches::kDisablePresentationAPI)) WebRuntimeFeatures::EnablePresentationAPI(false); @@ -254,10 +250,6 @@ void SetRuntimeFeaturesDefaultsAndUpdateFromArgs( base::FeatureList::IsEnabled( features::kFramebustingNeedsSameOriginOrUserGesture)); - WebRuntimeFeatures::EnableFeatureFromString( - "VibrateRequiresUserGesture", - base::FeatureList::IsEnabled(features::kVibrateRequiresUserGesture)); - if (command_line.HasSwitch(switches::kDisableBackgroundTimerThrottling)) WebRuntimeFeatures::EnableTimerThrottlingForBackgroundTabs(false); @@ -338,6 +330,13 @@ void SetRuntimeFeaturesDefaultsAndUpdateFromArgs( false); } + if (base::FeatureList::IsEnabled( + features::kTurnOff2DAndOpacityCompositorAnimations)) + WebRuntimeFeatures::EnableTurnOff2DAndOpacityCompositorAnimations(true); + + if (base::FeatureList::IsEnabled(features::kRasterInducingScroll)) + WebRuntimeFeatures::EnableRasterInducingScroll(true); + WebRuntimeFeatures::EnableFeatureFromString( "AllowContentInitiatedDataUrlNavigations", base::FeatureList::IsEnabled( @@ -353,9 +352,8 @@ void SetRuntimeFeaturesDefaultsAndUpdateFromArgs( WebRuntimeFeatures::EnableAutoplayMutedVideos(true); } - if (!base::FeatureList::IsEnabled(features::kWebAuth) && - !enableExperimentalWebPlatformFeatures) - WebRuntimeFeatures::EnableWebAuth(false); + WebRuntimeFeatures::EnableWebAuth( + base::FeatureList::IsEnabled(features::kWebAuth)); WebRuntimeFeatures::EnableClientPlaceholdersForServerLoFi( base::GetFieldTrialParamValue("PreviewsClientLoFi", @@ -401,6 +399,9 @@ void SetRuntimeFeaturesDefaultsAndUpdateFromArgs( if (base::FeatureList::IsEnabled(features::kKeyboardLockAPI)) WebRuntimeFeatures::EnableFeatureFromString("KeyboardLock", true); + if (base::FeatureList::IsEnabled(features::kLazyFrameLoading)) + WebRuntimeFeatures::EnableLazyFrameLoading(true); + // Enable explicitly enabled features, and then disable explicitly disabled // ones. for (const std::string& feature : @@ -421,6 +422,9 @@ void SetRuntimeFeaturesDefaultsAndUpdateFromArgs( if (base::FeatureList::IsEnabled(features::kStopLoadingInBackground)) WebRuntimeFeatures::EnableStopLoadingInBackground(true); + if (base::FeatureList::IsEnabled(features::kStopNonTimersInBackground)) + WebRuntimeFeatures::EnableStopNonTimersInBackground(true); + WebRuntimeFeatures::EnablePWAFullCodeCache( base::FeatureList::IsEnabled(features::kPWAFullCodeCache)); @@ -433,8 +437,18 @@ void SetRuntimeFeaturesDefaultsAndUpdateFromArgs( WebRuntimeFeatures::EnableCodeCacheAfterExecute( base::FeatureList::IsEnabled(features::kCodeCacheAfterExecute)); + WebRuntimeFeatures::EnableCacheInlineScriptCode( + base::FeatureList::IsEnabled(features::kCacheInlineScriptCode)); + if (base::FeatureList::IsEnabled(features::kUnifiedTouchAdjustment)) WebRuntimeFeatures::EnableUnifiedTouchAdjustment(true); + + // Make srcset on link rel=preload work with SignedHTTPExchange flag too. + if (base::FeatureList::IsEnabled(features::kSignedHTTPExchange)) + WebRuntimeFeatures::EnablePreloadImageSrcSetEnabled(true); + + WebRuntimeFeatures::EnableOffMainThreadWebSocket( + base::FeatureList::IsEnabled(features::kOffMainThreadWebSocket)); }; } // namespace content diff --git a/chromium/content/child/scoped_web_callbacks.h b/chromium/content/child/scoped_web_callbacks.h index 43a5ef3db59..725548f7784 100644 --- a/chromium/content/child/scoped_web_callbacks.h +++ b/chromium/content/child/scoped_web_callbacks.h @@ -11,7 +11,7 @@ #include "base/callback.h" #include "base/macros.h" #include "base/memory/ptr_util.h" -#include "third_party/WebKit/public/platform/WebCallbacks.h" +#include "third_party/blink/public/platform/web_callbacks.h" // A ScopedWebCallbacks is a move-only scoper which helps manage the lifetime of // a blink::WebCallbacks object. This is particularly useful when you're diff --git a/chromium/content/child/service_factory.cc b/chromium/content/child/service_factory.cc index 686d38eb61c..1c1361d759f 100644 --- a/chromium/content/child/service_factory.cc +++ b/chromium/content/child/service_factory.cc @@ -7,7 +7,6 @@ #include <utility> #include "base/bind.h" -#include "base/memory/ptr_util.h" #include "content/public/common/content_client.h" #include "services/service_manager/embedder/embedded_service_runner.h" diff --git a/chromium/content/child/webfallbackthemeengine_impl.cc b/chromium/content/child/webfallbackthemeengine_impl.cc index 1a78da27e76..5c091bc0a75 100644 --- a/chromium/content/child/webfallbackthemeengine_impl.cc +++ b/chromium/content/child/webfallbackthemeengine_impl.cc @@ -6,8 +6,8 @@ #include "base/macros.h" #include "skia/ext/platform_canvas.h" -#include "third_party/WebKit/public/platform/WebRect.h" -#include "third_party/WebKit/public/platform/WebSize.h" +#include "third_party/blink/public/platform/web_rect.h" +#include "third_party/blink/public/platform/web_size.h" #include "ui/native_theme/native_theme_base.h" using blink::WebCanvas; diff --git a/chromium/content/child/webfallbackthemeengine_impl.h b/chromium/content/child/webfallbackthemeengine_impl.h index 4960d7fd513..53f7b83c2df 100644 --- a/chromium/content/child/webfallbackthemeengine_impl.h +++ b/chromium/content/child/webfallbackthemeengine_impl.h @@ -8,7 +8,7 @@ #include <memory> #include "base/macros.h" -#include "third_party/WebKit/public/platform/WebFallbackThemeEngine.h" +#include "third_party/blink/public/platform/web_fallback_theme_engine.h" namespace content { diff --git a/chromium/content/child/webthemeengine_impl_android.cc b/chromium/content/child/webthemeengine_impl_android.cc index a1ce572eb50..a66f7fbce54 100644 --- a/chromium/content/child/webthemeengine_impl_android.cc +++ b/chromium/content/child/webthemeengine_impl_android.cc @@ -7,8 +7,8 @@ #include "base/logging.h" #include "base/sys_info.h" #include "skia/ext/platform_canvas.h" -#include "third_party/WebKit/public/platform/WebRect.h" -#include "third_party/WebKit/public/platform/WebSize.h" +#include "third_party/blink/public/platform/web_rect.h" +#include "third_party/blink/public/platform/web_size.h" #include "ui/native_theme/native_theme.h" using blink::WebCanvas; diff --git a/chromium/content/child/webthemeengine_impl_android.h b/chromium/content/child/webthemeengine_impl_android.h index 833ff9bfced..b17b2d63cdb 100644 --- a/chromium/content/child/webthemeengine_impl_android.h +++ b/chromium/content/child/webthemeengine_impl_android.h @@ -5,7 +5,7 @@ #ifndef CONTENT_CHILD_WEBTHEMEENGINE_IMPL_ANDROID_H_ #define CONTENT_CHILD_WEBTHEMEENGINE_IMPL_ANDROID_H_ -#include "third_party/WebKit/public/platform/WebThemeEngine.h" +#include "third_party/blink/public/platform/web_theme_engine.h" namespace content { diff --git a/chromium/content/child/webthemeengine_impl_default.cc b/chromium/content/child/webthemeengine_impl_default.cc index 232ff4ae9ad..6d898cc534c 100644 --- a/chromium/content/child/webthemeengine_impl_default.cc +++ b/chromium/content/child/webthemeengine_impl_default.cc @@ -6,8 +6,8 @@ #include "build/build_config.h" #include "skia/ext/platform_canvas.h" -#include "third_party/WebKit/public/platform/WebRect.h" -#include "third_party/WebKit/public/platform/WebSize.h" +#include "third_party/blink/public/platform/web_rect.h" +#include "third_party/blink/public/platform/web_size.h" #include "ui/native_theme/native_theme.h" #include "ui/native_theme/overlay_scrollbar_constants_aura.h" diff --git a/chromium/content/child/webthemeengine_impl_default.h b/chromium/content/child/webthemeengine_impl_default.h index 7de46aa3709..d3ae6ab2309 100644 --- a/chromium/content/child/webthemeengine_impl_default.h +++ b/chromium/content/child/webthemeengine_impl_default.h @@ -8,7 +8,7 @@ #include <stdint.h> #include "build/build_config.h" -#include "third_party/WebKit/public/platform/WebThemeEngine.h" +#include "third_party/blink/public/platform/web_theme_engine.h" namespace content { diff --git a/chromium/content/child/webthemeengine_impl_mac.h b/chromium/content/child/webthemeengine_impl_mac.h index f937361a26e..e63b62f4464 100644 --- a/chromium/content/child/webthemeengine_impl_mac.h +++ b/chromium/content/child/webthemeengine_impl_mac.h @@ -5,7 +5,7 @@ #ifndef CONTENT_CHILD_WEBTHEMEENGINE_IMPL_MAC_H_ #define CONTENT_CHILD_WEBTHEMEENGINE_IMPL_MAC_H_ -#include "third_party/WebKit/public/platform/WebThemeEngine.h" +#include "third_party/blink/public/platform/web_theme_engine.h" namespace content { |