diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-05-16 09:59:13 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-05-20 10:28:53 +0000 |
commit | 6c11fb357ec39bf087b8b632e2b1e375aef1b38b (patch) | |
tree | c8315530db18a8ee566521c39ab8a6af4f72bc03 /chromium/headless | |
parent | 3ffaed019d0772e59d6cdb2d0d32fe4834c31f72 (diff) | |
download | qtwebengine-chromium-6c11fb357ec39bf087b8b632e2b1e375aef1b38b.tar.gz |
BASELINE: Update Chromium to 74.0.3729.159
Change-Id: I8d2497da544c275415aedd94dd25328d555de811
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/headless')
28 files changed, 99 insertions, 481 deletions
diff --git a/chromium/headless/BUILD.gn b/chromium/headless/BUILD.gn index 7450e8c1ae0..1d15a927252 100644 --- a/chromium/headless/BUILD.gn +++ b/chromium/headless/BUILD.gn @@ -10,7 +10,6 @@ import("//build/util/process_version.gni") import("//headless/headless.gni") import("//mojo/public/tools/bindings/mojom.gni") import("//printing/buildflags/buildflags.gni") -import("//services/service_manager/public/service_manifest.gni") import("//testing/test.gni") import("//third_party/closure_compiler/compile_js.gni") import("//third_party/inspector_protocol/inspector_protocol.gni") @@ -18,12 +17,9 @@ import("//tools/grit/grit_rule.gni") import("//tools/grit/repack.gni") import("//tools/v8_context_snapshot/v8_context_snapshot.gni") -config("headless_implementation") { +# For code inside the build component "headless". +config("inside_headless_component") { defines = [ "HEADLESS_IMPLEMENTATION" ] - - if (headless_use_embedded_resources) { - defines += [ "HEADLESS_USE_EMBEDDED_RESOURCES" ] - } } group("headless_lib") { @@ -226,7 +222,7 @@ if (headless_fontconfig_utils && !is_fuchsia) { "//third_party/fontconfig", ] - configs += [ ":headless_implementation" ] + configs += [ ":inside_headless_component" ] } } @@ -251,6 +247,8 @@ inspector_protocol_generate("protocol_sources") { # These are relative to $target_gen_dir. outputs = [ + "lib/browser/protocol/base_string_adapter.cc", + "lib/browser/protocol/base_string_adapter.h", "lib/browser/protocol/dp_browser.cc", "lib/browser/protocol/dp_browser.h", "lib/browser/protocol/dp_headless_experimental.cc", @@ -308,8 +306,6 @@ jumbo_component("headless") { "lib/browser/protocol/headless_handler.h", "lib/browser/protocol/page_handler.cc", "lib/browser/protocol/page_handler.h", - "lib/browser/protocol/protocol_string.cc", - "lib/browser/protocol/protocol_string.h", "lib/browser/protocol/target_handler.cc", "lib/browser/protocol/target_handler.h", "lib/headless_content_client.cc", @@ -428,7 +424,7 @@ jumbo_component("headless") { deps += [ "//components/crash/core/common:crash_key", "//components/security_state/content", - "//components/services/pdf_compositor:pdf_compositor_manifest", + "//components/services/pdf_compositor/public/cpp:manifest", "//components/services/pdf_compositor/public/interfaces", "//gin", "//third_party/blink/public:blink", @@ -476,6 +472,7 @@ jumbo_component("headless") { } if (headless_use_embedded_resources) { + defines = [ "HEADLESS_USE_EMBEDDED_RESOURCES" ] deps += [ ":embed_resources" ] sources += [ "$root_gen_dir/headless/embedded_resource_pak.cc", @@ -493,7 +490,7 @@ jumbo_component("headless") { deps += [ ":headless_fontconfig_utils" ] } - configs += [ ":headless_implementation" ] + configs += [ ":inside_headless_component" ] } # Headless renderer is a convenience library for non component builds that @@ -510,6 +507,10 @@ if (!is_component_build) { "lib/renderer/headless_content_renderer_client.h", ] + if (headless_use_embedded_resources) { + defines = [ "HEADLESS_USE_EMBEDDED_RESOURCES" ] + } + if (enable_basic_printing) { sources += [ "lib/renderer/headless_print_render_frame_helper_delegate.cc", @@ -527,8 +528,6 @@ if (!is_component_build) { if (enable_basic_printing) { deps += [ "//components/printing/renderer" ] } - - configs += [ ":headless_implementation" ] } } else { # For component builds all dependencies are already included in the headless @@ -552,7 +551,6 @@ group("headless_tests") { test("headless_unittests") { sources = [ - "lib/browser/protocol/protocol_unittest.cc", "public/domains/types_unittest.cc", "public/util/error_reporter_unittest.cc", ] @@ -573,7 +571,7 @@ test("headless_unittests") { "//base/test:run_all_unittests", "//base/test:test_support", "//components/security_state/content", - "//components/services/pdf_compositor:pdf_compositor_manifest", + "//components/services/pdf_compositor/public/cpp:manifest", "//components/services/pdf_compositor/public/interfaces", "//content/public/app:both", "//content/public/child:child", @@ -603,22 +601,13 @@ test("headless_unittests") { if (is_mac) { copy("mac_helpers") { sources = [ - "$root_out_dir/crashpad_handler", + "$root_out_dir/chrome_crashpad_handler", ] deps = [ - "//base", - "//third_party/crashpad/crashpad/handler:crashpad_handler", + "//components/crash/content/app:chrome_crashpad_handler", ] - if (is_component_build) { - sources += [ "$root_out_dir/libbase.dylib" ] - if (use_custom_libcxx) { - sources += [ "$root_out_dir/libc++.dylib" ] - deps += [ "//buildtools/third_party/libc++:libc++" ] - } - } - outputs = [ "$root_out_dir/Helpers/{{source_file_part}}", ] @@ -733,7 +722,7 @@ test("headless_browsertests") { ":headless_renderer", "//base", "//components/security_state/content", - "//components/services/pdf_compositor:pdf_compositor_manifest", + "//components/services/pdf_compositor/public/cpp:manifest", "//components/services/pdf_compositor/public/interfaces", "//content/test:test_support", "//services/network/public/mojom", @@ -777,8 +766,6 @@ if (is_win) { sources = [ "app/headless_shell.cc", "app/headless_shell.h", - "app/headless_shell_switches.cc", - "app/headless_shell_switches.h", "app/headless_shell_win.cc", "lib/browser/headless_content_browser_client.cc", "lib/browser/headless_content_browser_client.h", @@ -788,7 +775,7 @@ if (is_win) { ] deps = [ ":headless", - "//components/services/pdf_compositor:pdf_compositor_manifest", + "//components/services/pdf_compositor/public/cpp:manifest", "//components/services/pdf_compositor/public/interfaces", "//content:sandbox_helper_win", "//content/public/browser", @@ -811,8 +798,6 @@ if (is_win) { "//third_party/blink/public:blink_headers", ] } - - configs += [ ":headless_implementation" ] } # Headless library with child specific dependencies (e.g., renderer). This @@ -847,8 +832,6 @@ if (is_win) { "//third_party/blink/public:blink_headers", ] } - - configs += [ ":headless_implementation" ] } } @@ -876,7 +859,7 @@ jumbo_static_library("headless_shell_lib") { ":headless_renderer", "//components/os_crypt", "//components/security_state/content", - "//components/services/pdf_compositor:pdf_compositor_manifest", + "//components/services/pdf_compositor/public/cpp:manifest", "//components/services/pdf_compositor/public/interfaces", "//content/public/app:both", "//content/public/browser", diff --git a/chromium/headless/lib/browser/DEPS b/chromium/headless/lib/browser/DEPS index 1c3f6cafa21..ff46d427416 100644 --- a/chromium/headless/lib/browser/DEPS +++ b/chromium/headless/lib/browser/DEPS @@ -3,7 +3,7 @@ include_rules = [ "+components/printing/browser", "+components/printing/common", "+components/security_state", - "+components/services/pdf_compositor/pdf_compositor_manifest.h", + "+components/services/pdf_compositor/public/cpp", "+components/viz", "+printing", "+services/network", @@ -11,6 +11,7 @@ include_rules = [ "+storage/common/quota", "+third_party/skia/include", "+third_party/blink/public/mojom/quota", + "+third_party/blink/public/mojom/renderer_preferences.mojom.h", "+ui/aura", "+ui/compositor", "+ui/events/keycodes/dom", diff --git a/chromium/headless/lib/browser/devtools_api/domain_h.template b/chromium/headless/lib/browser/devtools_api/domain_h.template index a113383c951..a070791da8a 100644 --- a/chromium/headless/lib/browser/devtools_api/domain_h.template +++ b/chromium/headless/lib/browser/devtools_api/domain_h.template @@ -10,7 +10,7 @@ #include "base/callback.h" #include "base/observer_list.h" #include "base/values.h" -#include "headless/lib/browser/protocol/protocol_string.h" +#include "headless/lib/browser/protocol/base_string_adapter.h" {% for domain_name in domain.dependencies %} #include "headless/public/devtools/domains/types_{{domain_name | camelcase_to_hacker_style}}.h" {% endfor %} diff --git a/chromium/headless/lib/browser/devtools_api/domain_types_h.template b/chromium/headless/lib/browser/devtools_api/domain_types_h.template index 1ad48132f96..dd85de1ee41 100644 --- a/chromium/headless/lib/browser/devtools_api/domain_types_h.template +++ b/chromium/headless/lib/browser/devtools_api/domain_types_h.template @@ -9,7 +9,7 @@ #include "base/optional.h" #include "base/values.h" -#include "headless/lib/browser/protocol/protocol_string.h" +#include "headless/lib/browser/protocol/base_string_adapter.h" {% for domain_name in domain.dependencies %} #include "headless/public/devtools/internal/types_forward_declarations_{{domain_name | camelcase_to_hacker_style}}.h" {% endfor %} diff --git a/chromium/headless/lib/browser/headless_content_browser_client.cc b/chromium/headless/lib/browser/headless_content_browser_client.cc index 8bbae2f5161..92da092c280 100644 --- a/chromium/headless/lib/browser/headless_content_browser_client.cc +++ b/chromium/headless/lib/browser/headless_content_browser_client.cc @@ -8,6 +8,7 @@ #include <unordered_set> #include "base/base_switches.h" +#include "base/bind.h" #include "base/callback.h" #include "base/command_line.h" #include "base/path_service.h" @@ -175,7 +176,8 @@ void HeadlessContentBrowserClient::GetQuotaSettings( content::StoragePartition* partition, ::storage::OptionalQuotaSettingsCallback callback) { ::storage::GetNominalDynamicSettings( - partition->GetPath(), context->IsOffTheRecord(), std::move(callback)); + partition->GetPath(), context->IsOffTheRecord(), + ::storage::GetDefaultDiskInfoHelper(), std::move(callback)); } content::GeneratedCodeCacheSettings diff --git a/chromium/headless/lib/browser/headless_devtools_client_impl.cc b/chromium/headless/lib/browser/headless_devtools_client_impl.cc index 065a42d9d49..a61b18d7f37 100644 --- a/chromium/headless/lib/browser/headless_devtools_client_impl.cc +++ b/chromium/headless/lib/browser/headless_devtools_client_impl.cc @@ -77,7 +77,7 @@ HeadlessDevToolsClientImpl::HeadlessDevToolsClientImpl() HeadlessDevToolsClientImpl::~HeadlessDevToolsClientImpl() { if (parent_client_) parent_client_->sessions_.erase(session_id_); -}; +} void HeadlessDevToolsClientImpl::AttachToExternalHost( ExternalHost* external_host) { @@ -131,7 +131,8 @@ int HeadlessDevToolsClientImpl::GetNextRawDevToolsMessageId() { void HeadlessDevToolsClientImpl::SendRawDevToolsMessage( const std::string& json_message) { - std::unique_ptr<base::Value> message = base::JSONReader::Read(json_message); + std::unique_ptr<base::Value> message = + base::JSONReader::ReadDeprecated(json_message); if (!message->is_dict()) { LOG(ERROR) << "Malformed raw message"; return; @@ -153,7 +154,7 @@ void HeadlessDevToolsClientImpl::ReceiveProtocolMessage( const std::string& json_message) { // LOG(ERROR) << "[RECV] " << json_message; std::unique_ptr<base::Value> message = - base::JSONReader::Read(json_message, base::JSON_PARSE_RFC); + base::JSONReader::ReadDeprecated(json_message, base::JSON_PARSE_RFC); if (!message || !message->is_dict()) { NOTREACHED() << "Badly formed reply " << json_message; return; diff --git a/chromium/headless/lib/browser/headless_devtools_manager_delegate.cc b/chromium/headless/lib/browser/headless_devtools_manager_delegate.cc index bd611875403..fa2f1143c27 100644 --- a/chromium/headless/lib/browser/headless_devtools_manager_delegate.cc +++ b/chromium/headless/lib/browser/headless_devtools_manager_delegate.cc @@ -25,12 +25,11 @@ HeadlessDevToolsManagerDelegate::~HeadlessDevToolsManagerDelegate() = default; void HeadlessDevToolsManagerDelegate::HandleCommand( content::DevToolsAgentHost* agent_host, content::DevToolsAgentHostClient* client, - std::unique_ptr<base::DictionaryValue> command, + const std::string& method, const std::string& message, NotHandledCallback callback) { DCHECK(sessions_.find(client) != sessions_.end()); - sessions_[client]->HandleCommand(std::move(command), message, - std::move(callback)); + sessions_[client]->HandleCommand(method, message, std::move(callback)); } scoped_refptr<content::DevToolsAgentHost> diff --git a/chromium/headless/lib/browser/headless_devtools_manager_delegate.h b/chromium/headless/lib/browser/headless_devtools_manager_delegate.h index eb40d4046a5..9a43363d3f0 100644 --- a/chromium/headless/lib/browser/headless_devtools_manager_delegate.h +++ b/chromium/headless/lib/browser/headless_devtools_manager_delegate.h @@ -31,7 +31,7 @@ class HeadlessDevToolsManagerDelegate // DevToolsManagerDelegate implementation: void HandleCommand(content::DevToolsAgentHost* agent_host, content::DevToolsAgentHostClient* client, - std::unique_ptr<base::DictionaryValue> command, + const std::string& method, const std::string& message, NotHandledCallback callback) override; scoped_refptr<content::DevToolsAgentHost> CreateNewTarget( diff --git a/chromium/headless/lib/browser/headless_overlay_manifests.cc b/chromium/headless/lib/browser/headless_overlay_manifests.cc index 7aed11de170..d9320cabd20 100644 --- a/chromium/headless/lib/browser/headless_overlay_manifests.cc +++ b/chromium/headless/lib/browser/headless_overlay_manifests.cc @@ -5,7 +5,7 @@ #include "headless/lib/browser/headless_overlay_manifests.h" #include "base/no_destructor.h" -#include "components/services/pdf_compositor/pdf_compositor_manifest.h" +#include "components/services/pdf_compositor/public/cpp/manifest.h" #include "components/services/pdf_compositor/public/interfaces/pdf_compositor.mojom.h" #include "services/service_manager/public/cpp/manifest_builder.h" @@ -24,7 +24,7 @@ const service_manager::Manifest& GetHeadlessContentPackagedServicesOverlayManifest() { static base::NoDestructor<service_manager::Manifest> manifest{ service_manager::ManifestBuilder() - .PackageService(pdf_compositor::GetManifest()) + .PackageService(printing::GetPdfCompositorManifest()) .Build()}; return *manifest; diff --git a/chromium/headless/lib/browser/headless_request_context_manager.cc b/chromium/headless/lib/browser/headless_request_context_manager.cc index 8894b46d145..612a1485234 100644 --- a/chromium/headless/lib/browser/headless_request_context_manager.cc +++ b/chromium/headless/lib/browser/headless_request_context_manager.cc @@ -4,6 +4,7 @@ #include "headless/lib/browser/headless_request_context_manager.h" +#include "base/bind.h" #include "base/task/post_task.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" @@ -22,8 +23,6 @@ #include "net/http/http_auth_handler_factory.h" #include "net/http/http_auth_scheme.h" #include "net/http/http_transaction_factory.h" -#include "net/ssl/channel_id_service.h" -#include "net/ssl/default_channel_id_store.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_builder.h" #include "net/url_request/url_request_context_getter.h" @@ -403,8 +402,6 @@ HeadlessRequestContextManager::CreateNetworkContextParams() { context_params->enable_encrypted_cookies = cookie_encryption_enabled_; context_params->cookie_path = user_data_path_.Append(FILE_PATH_LITERAL("Cookies")); - context_params->channel_id_path = - user_data_path_.Append(FILE_PATH_LITERAL("Origin Bound Certs")); } base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switches::kDiskCacheDir)) { diff --git a/chromium/headless/lib/browser/headless_web_contents_impl.cc b/chromium/headless/lib/browser/headless_web_contents_impl.cc index ab33743349d..5b02bd3dc0c 100644 --- a/chromium/headless/lib/browser/headless_web_contents_impl.cc +++ b/chromium/headless/lib/browser/headless_web_contents_impl.cc @@ -30,7 +30,6 @@ #include "content/public/browser/web_contents_delegate.h" #include "content/public/common/bindings_policy.h" #include "content/public/common/origin_util.h" -#include "content/public/common/renderer_preferences.h" #include "headless/lib/browser/headless_browser_context_impl.h" #include "headless/lib/browser/headless_browser_impl.h" #include "headless/lib/browser/headless_browser_main_parts.h" @@ -38,6 +37,7 @@ #include "headless/lib/browser/protocol/headless_handler.h" #include "headless/public/internal/headless_devtools_client_impl.h" #include "printing/buildflags/buildflags.h" +#include "third_party/blink/public/mojom/renderer_preferences.mojom.h" #include "third_party/skia/include/core/SkBitmap.h" #include "ui/compositor/compositor.h" #include "ui/gfx/switches.h" diff --git a/chromium/headless/lib/browser/protocol/browser_handler.cc b/chromium/headless/lib/browser/protocol/browser_handler.cc index 026fdf62f17..cdf433e4540 100644 --- a/chromium/headless/lib/browser/protocol/browser_handler.cc +++ b/chromium/headless/lib/browser/protocol/browser_handler.cc @@ -4,6 +4,7 @@ #include "headless/lib/browser/protocol/browser_handler.h" +#include "base/bind.h" #include "base/task/post_task.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" diff --git a/chromium/headless/lib/browser/protocol/headless_devtools_session.cc b/chromium/headless/lib/browser/protocol/headless_devtools_session.cc index 0c3e3575a63..c5ec413ee11 100644 --- a/chromium/headless/lib/browser/protocol/headless_devtools_session.cc +++ b/chromium/headless/lib/browser/protocol/headless_devtools_session.cc @@ -42,28 +42,24 @@ HeadlessDevToolsSession::~HeadlessDevToolsSession() { } void HeadlessDevToolsSession::HandleCommand( - std::unique_ptr<base::DictionaryValue> command, + const std::string& method, const std::string& message, content::DevToolsManagerDelegate::NotHandledCallback callback) { - if (!browser_) { - std::move(callback).Run(std::move(command), message); + if (!browser_ || !dispatcher_->canDispatch(method)) { + std::move(callback).Run(message); return; } int call_id; - std::string method; - std::unique_ptr<protocol::Value> protocolCommand = - protocol::toProtocolValue(command.get(), 1000); - if (!dispatcher_->parseCommand(protocolCommand.get(), &call_id, &method)) { + std::string unused; + std::unique_ptr<protocol::DictionaryValue> value = + protocol::DictionaryValue::cast(protocol::StringUtil::parseMessage( + message, client_->UsesBinaryProtocol())); + if (!dispatcher_->parseCommand(value.get(), &call_id, &unused)) return; - } - if (dispatcher_->canDispatch(method)) { - pending_commands_[call_id] = - std::make_pair(std::move(callback), std::move(command)); - dispatcher_->dispatch(call_id, method, std::move(protocolCommand), message); - return; - } - std::move(callback).Run(std::move(command), message); + pending_commands_[call_id] = std::move(callback); + dispatcher_->dispatch(call_id, method, std::move(value), message); } + void HeadlessDevToolsSession::AddHandler( std::unique_ptr<protocol::DomainHandler> handler) { handler->Wire(dispatcher_.get()); @@ -74,20 +70,22 @@ void HeadlessDevToolsSession::sendProtocolResponse( int call_id, std::unique_ptr<Serializable> message) { pending_commands_.erase(call_id); - client_->DispatchProtocolMessage(agent_host_, message->serialize()); + bool binary = client_->UsesBinaryProtocol(); + client_->DispatchProtocolMessage(agent_host_, message->serialize(binary)); } void HeadlessDevToolsSession::fallThrough(int call_id, const std::string& method, const std::string& message) { - PendingCommand command = std::move(pending_commands_[call_id]); + auto callback = std::move(pending_commands_[call_id]); pending_commands_.erase(call_id); - std::move(command.first).Run(std::move(command.second), message); + std::move(callback).Run(message); } void HeadlessDevToolsSession::sendProtocolNotification( std::unique_ptr<Serializable> message) { - client_->DispatchProtocolMessage(agent_host_, message->serialize()); + bool binary = client_->UsesBinaryProtocol(); + client_->DispatchProtocolMessage(agent_host_, message->serialize(binary)); } void HeadlessDevToolsSession::flushProtocolNotifications() {} diff --git a/chromium/headless/lib/browser/protocol/headless_devtools_session.h b/chromium/headless/lib/browser/protocol/headless_devtools_session.h index 4a28551d14b..f2daa96067c 100644 --- a/chromium/headless/lib/browser/protocol/headless_devtools_session.h +++ b/chromium/headless/lib/browser/protocol/headless_devtools_session.h @@ -35,7 +35,7 @@ class HeadlessDevToolsSession : public FrontendChannel { ~HeadlessDevToolsSession() override; void HandleCommand( - std::unique_ptr<base::DictionaryValue> command, + const std::string& method, const std::string& message, content::DevToolsManagerDelegate::NotHandledCallback callback); @@ -58,10 +58,8 @@ class HeadlessDevToolsSession : public FrontendChannel { content::DevToolsAgentHostClient* const client_; std::unique_ptr<UberDispatcher> dispatcher_; base::flat_map<std::string, std::unique_ptr<DomainHandler>> handlers_; - using PendingCommand = - std::pair<content::DevToolsManagerDelegate::NotHandledCallback, - std::unique_ptr<base::DictionaryValue>>; - base::flat_map<int, PendingCommand> pending_commands_; + base::flat_map<int, content::DevToolsManagerDelegate::NotHandledCallback> + pending_commands_; DISALLOW_COPY_AND_ASSIGN(HeadlessDevToolsSession); }; diff --git a/chromium/headless/lib/browser/protocol/headless_handler.cc b/chromium/headless/lib/browser/protocol/headless_handler.cc index a7f4093ad02..fef9538776a 100644 --- a/chromium/headless/lib/browser/protocol/headless_handler.cc +++ b/chromium/headless/lib/browser/protocol/headless_handler.cc @@ -5,6 +5,7 @@ #include "headless/lib/browser/protocol/headless_handler.h" #include "base/base_switches.h" +#include "base/bind.h" #include "base/command_line.h" #include "base/lazy_instance.h" #include "cc/base/switches.h" diff --git a/chromium/headless/lib/browser/protocol/page_handler.cc b/chromium/headless/lib/browser/protocol/page_handler.cc index 6f695e27ace..10b09f789cc 100644 --- a/chromium/headless/lib/browser/protocol/page_handler.cc +++ b/chromium/headless/lib/browser/protocol/page_handler.cc @@ -4,6 +4,7 @@ #include "headless/lib/browser/protocol/page_handler.h" +#include "base/bind.h" #include "content/public/browser/web_contents.h" #include "printing/units.h" diff --git a/chromium/headless/lib/browser/protocol/protocol_string.cc b/chromium/headless/lib/browser/protocol/protocol_string.cc deleted file mode 100644 index b6b108546f8..00000000000 --- a/chromium/headless/lib/browser/protocol/protocol_string.cc +++ /dev/null @@ -1,202 +0,0 @@ -// 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 "headless/lib/browser/protocol/protocol_string.h" - -#include <utility> -#include "base/base64.h" -#include "base/json/json_reader.h" -#include "base/memory/ptr_util.h" -#include "base/strings/string16.h" -#include "base/strings/utf_string_conversions.h" -#include "base/values.h" -#include "headless/lib/browser/protocol/protocol.h" - -namespace headless { -namespace protocol { - -std::unique_ptr<Value> toProtocolValue(const base::Value* value, int depth) { - if (!value || !depth) - return nullptr; - if (value->is_none()) - return Value::null(); - if (value->is_bool()) { - bool inner; - value->GetAsBoolean(&inner); - return FundamentalValue::create(inner); - } - if (value->is_int()) { - int inner; - value->GetAsInteger(&inner); - return FundamentalValue::create(inner); - } - if (value->is_double()) { - double inner; - value->GetAsDouble(&inner); - return FundamentalValue::create(inner); - } - if (value->is_string()) { - std::string inner; - value->GetAsString(&inner); - return StringValue::create(inner); - } - if (value->is_list()) { - const base::ListValue* list = nullptr; - value->GetAsList(&list); - std::unique_ptr<ListValue> result = ListValue::create(); - for (size_t i = 0; i < list->GetSize(); i++) { - const base::Value* item = nullptr; - list->Get(i, &item); - std::unique_ptr<Value> converted = toProtocolValue(item, depth - 1); - if (converted) - result->pushValue(std::move(converted)); - } - return std::move(result); - } - if (value->is_dict()) { - const base::DictionaryValue* dictionary = nullptr; - value->GetAsDictionary(&dictionary); - std::unique_ptr<DictionaryValue> result = DictionaryValue::create(); - for (base::DictionaryValue::Iterator it(*dictionary); !it.IsAtEnd(); - it.Advance()) { - std::unique_ptr<Value> converted = - toProtocolValue(&it.value(), depth - 1); - if (converted) - result->setValue(it.key(), std::move(converted)); - } - return std::move(result); - } - return nullptr; -} - -std::unique_ptr<base::Value> toBaseValue(Value* value, int depth) { - if (!value || !depth) - return nullptr; - if (value->type() == Value::TypeNull) - return std::make_unique<base::Value>(); - if (value->type() == Value::TypeBoolean) { - bool inner; - value->asBoolean(&inner); - return base::WrapUnique(new base::Value(inner)); - } - if (value->type() == Value::TypeInteger) { - int inner; - value->asInteger(&inner); - return base::WrapUnique(new base::Value(inner)); - } - if (value->type() == Value::TypeDouble) { - double inner; - value->asDouble(&inner); - return base::WrapUnique(new base::Value(inner)); - } - if (value->type() == Value::TypeString) { - std::string inner; - value->asString(&inner); - return base::WrapUnique(new base::Value(inner)); - } - if (value->type() == Value::TypeArray) { - ListValue* list = ListValue::cast(value); - std::unique_ptr<base::ListValue> result(new base::ListValue()); - for (size_t i = 0; i < list->size(); i++) { - std::unique_ptr<base::Value> converted = - toBaseValue(list->at(i), depth - 1); - if (converted) - result->Append(std::move(converted)); - } - return std::move(result); - } - if (value->type() == Value::TypeObject) { - DictionaryValue* dict = DictionaryValue::cast(value); - std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue()); - for (size_t i = 0; i < dict->size(); i++) { - DictionaryValue::Entry entry = dict->at(i); - std::unique_ptr<base::Value> converted = - toBaseValue(entry.second, depth - 1); - if (converted) - result->SetWithoutPathExpansion(entry.first, std::move(converted)); - } - return std::move(result); - } - return nullptr; -} - -// static -std::unique_ptr<Value> StringUtil::parseJSON(const std::string& json) { - std::unique_ptr<base::Value> value = base::JSONReader::Read(json); - return toProtocolValue(value.get(), 1000); -} - -StringBuilder::StringBuilder() {} - -StringBuilder::~StringBuilder() {} - -void StringBuilder::append(const std::string& s) { - string_ += s; -} - -void StringBuilder::append(char c) { - string_ += c; -} - -void StringBuilder::append(const char* characters, size_t length) { - string_.append(characters, length); -} - -// static -void StringUtil::builderAppendQuotedString(StringBuilder& builder, - const String& str) { - builder.append('"'); - base::string16 str16 = base::UTF8ToUTF16(str); - escapeWideStringForJSON(reinterpret_cast<const uint16_t*>(&str16[0]), - str16.length(), &builder); - builder.append('"'); -} - -std::string StringBuilder::toString() { - return string_; -} - -void StringBuilder::reserveCapacity(size_t capacity) { - string_.reserve(capacity); -} - -Binary::Binary() : bytes_(new base::RefCountedBytes) {} -Binary::Binary(const Binary& binary) : bytes_(binary.bytes_) {} -Binary::Binary(scoped_refptr<base::RefCountedMemory> bytes) : bytes_(bytes) {} -Binary::~Binary() {} - -String Binary::toBase64() const { - std::string encoded; - base::Base64Encode( - base::StringPiece(reinterpret_cast<const char*>(data()), size()), - &encoded); - return encoded; -} - -// static -Binary Binary::fromBase64(const String& base64, bool* success) { - std::string decoded; - *success = base::Base64Decode(base::StringPiece(base64), &decoded); - if (*success) { - return Binary::fromString(std::move(decoded)); - } - return Binary(); -} - -// static -Binary Binary::fromRefCounted(scoped_refptr<base::RefCountedMemory> memory) { - return Binary(memory); -} - -// static -Binary Binary::fromVector(std::vector<uint8_t> data) { - return Binary(base::RefCountedBytes::TakeVector(&data)); -} - -// static -Binary Binary::fromString(std::string data) { - return Binary(base::RefCountedString::TakeString(&data)); -} -} // namespace protocol -} // namespace headless diff --git a/chromium/headless/lib/browser/protocol/protocol_string.h b/chromium/headless/lib/browser/protocol/protocol_string.h deleted file mode 100644 index 3f0bf133f36..00000000000 --- a/chromium/headless/lib/browser/protocol/protocol_string.h +++ /dev/null @@ -1,115 +0,0 @@ -// 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 HEADLESS_LIB_BROWSER_PROTOCOL_PROTOCOL_STRING_H_ -#define HEADLESS_LIB_BROWSER_PROTOCOL_PROTOCOL_STRING_H_ - -#include <memory> -#include <string> -#include <vector> - -#include "base/logging.h" -#include "base/macros.h" -#include "base/memory/ref_counted_memory.h" -#include "base/strings/string_number_conversions.h" -#include "headless/public/headless_export.h" - -namespace base { -class Value; -} - -namespace headless { -namespace protocol { - -class Value; - -using String = std::string; - -class HEADLESS_EXPORT StringBuilder { - public: - StringBuilder(); - ~StringBuilder(); - void append(const String&); - void append(char); - void append(const char*, size_t); - String toString(); - void reserveCapacity(size_t); - - private: - std::string string_; -}; - -class HEADLESS_EXPORT StringUtil { - public: - static String substring(const String& s, unsigned pos, unsigned len) { - return s.substr(pos, len); - } - static String fromInteger(int number) { return base::IntToString(number); } - static String fromDouble(double number) { - String s = base::NumberToString(number); - if (!s.empty() && s[0] == '.') - s = "0" + s; - return s; - } - static double toDouble(const char* s, size_t len, bool* ok) { - double v = 0.0; - *ok = base::StringToDouble(std::string(s, len), &v); - return *ok ? v : 0.0; - } - static size_t find(const String& s, const char* needle) { - return s.find(needle); - } - static size_t find(const String& s, const String& needle) { - return s.find(needle); - } - static const size_t kNotFound = static_cast<size_t>(-1); - static void builderAppend(StringBuilder& builder, const String& s) { - builder.append(s); - } - static void builderAppend(StringBuilder& builder, char c) { - builder.append(c); - } - static void builderAppend(StringBuilder& builder, const char* s, size_t len) { - builder.append(s, len); - } - static void builderAppendQuotedString(StringBuilder& builder, - const String& str); - static void builderReserve(StringBuilder& builder, unsigned capacity) { - builder.reserveCapacity(capacity); - } - static String builderToString(StringBuilder& builder) { - return builder.toString(); - } - - static std::unique_ptr<Value> parseJSON(const String&); -}; - -// A read-only sequence of uninterpreted bytes with reference-counted storage. -class HEADLESS_EXPORT Binary { - public: - Binary(const Binary&); - Binary(); - ~Binary(); - - const uint8_t* data() const { return bytes_->front(); } - size_t size() const { return bytes_->size(); } - - String toBase64() const; - static Binary fromBase64(const String& base64, bool* success); - static Binary fromRefCounted(scoped_refptr<base::RefCountedMemory> memory); - static Binary fromVector(std::vector<uint8_t> data); - static Binary fromString(std::string data); - - private: - explicit Binary(scoped_refptr<base::RefCountedMemory> bytes); - scoped_refptr<base::RefCountedMemory> bytes_; -}; - -std::unique_ptr<Value> toProtocolValue(const base::Value* value, int depth); -std::unique_ptr<base::Value> toBaseValue(Value* value, int depth); - -} // namespace protocol -} // namespace headless - -#endif // HEADLESS_LIB_BROWSER_PROTOCOL_PROTOCOL_STRING_H_ diff --git a/chromium/headless/lib/browser/protocol/protocol_unittest.cc b/chromium/headless/lib/browser/protocol/protocol_unittest.cc deleted file mode 100644 index 3d5419f9e32..00000000000 --- a/chromium/headless/lib/browser/protocol/protocol_unittest.cc +++ /dev/null @@ -1,59 +0,0 @@ -// 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 "headless/lib/browser/protocol/protocol_string.h" - -#include <vector> -#include "testing/gtest/include/gtest/gtest.h" - -namespace headless { -namespace protocol { -namespace { -TEST(ProtocolBinaryTest, base64EmptyArgs) { - EXPECT_EQ(protocol::String(), Binary().toBase64()); - - bool success = false; - Binary decoded = Binary::fromBase64("", &success); - EXPECT_TRUE(success); - EXPECT_EQ( - std::vector<uint8_t>(), - std::vector<uint8_t>(decoded.data(), decoded.data() + decoded.size())); -} - -TEST(ProtocolStringTest, AllBytesBase64Roundtrip) { - std::vector<uint8_t> all_bytes; - for (int ii = 0; ii < 255; ++ii) - all_bytes.push_back(ii); - Binary binary = Binary::fromVector(all_bytes); - bool success = false; - Binary decoded = Binary::fromBase64(binary.toBase64(), &success); - EXPECT_TRUE(success); - std::vector<uint8_t> decoded_bytes(decoded.data(), - decoded.data() + decoded.size()); - EXPECT_EQ(all_bytes, decoded_bytes); -} - -TEST(ProtocolStringTest, HelloWorldBase64Roundtrip) { - const char* kMsg = "Hello, world."; - std::vector<uint8_t> msg(kMsg, kMsg + strlen(kMsg)); - EXPECT_EQ(strlen(kMsg), msg.size()); - - protocol::String encoded = Binary::fromVector(msg).toBase64(); - EXPECT_EQ("SGVsbG8sIHdvcmxkLg==", encoded); - bool success = false; - Binary decoded_binary = Binary::fromBase64(encoded, &success); - EXPECT_TRUE(success); - std::vector<uint8_t> decoded(decoded_binary.data(), - decoded_binary.data() + decoded_binary.size()); - EXPECT_EQ(msg, decoded); -} - -TEST(ProtocolBinaryTest, InvalidBase64Decode) { - bool success = true; - Binary binary = Binary::fromBase64("This is not base64.", &success); - EXPECT_FALSE(success); -} -} // namespace -} // namespace protocol -} // namespace headless diff --git a/chromium/headless/lib/headless_browser_browsertest.cc b/chromium/headless/lib/headless_browser_browsertest.cc index be59f16d850..f075aa89054 100644 --- a/chromium/headless/lib/headless_browser_browsertest.cc +++ b/chromium/headless/lib/headless_browser_browsertest.cc @@ -4,6 +4,7 @@ #include <memory> +#include "base/bind.h" #include "base/command_line.h" #include "base/files/file_enumerator.h" #include "base/files/file_util.h" diff --git a/chromium/headless/lib/headless_browser_context_browsertest.cc b/chromium/headless/lib/headless_browser_context_browsertest.cc index e2532af25e2..6509a64efea 100644 --- a/chromium/headless/lib/headless_browser_context_browsertest.cc +++ b/chromium/headless/lib/headless_browser_context_browsertest.cc @@ -4,6 +4,7 @@ #include <memory> +#include "base/bind.h" #include "base/files/scoped_temp_dir.h" #include "base/strings/stringprintf.h" #include "base/threading/thread_restrictions.h" @@ -146,7 +147,8 @@ class HeadlessBrowserContextIsolationTest std::unique_ptr<LoadObserver> load_observer_; }; -HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessBrowserContextIsolationTest); +// TODO(https://crbug.com/930356): Re-enable test. +DISABLED_HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessBrowserContextIsolationTest); IN_PROC_BROWSER_TEST_F(HeadlessBrowserTest, UserDataDir) { // We do not want to bother with posting tasks to create a temp dir. diff --git a/chromium/headless/lib/headless_content_main_delegate.cc b/chromium/headless/lib/headless_content_main_delegate.cc index 60099fa1f03..2288d967c41 100644 --- a/chromium/headless/lib/headless_content_main_delegate.cc +++ b/chromium/headless/lib/headless_content_main_delegate.cc @@ -21,7 +21,6 @@ #include "base/trace_event/trace_event.h" #include "build/build_config.h" #include "cc/base/switches.h" -#include "components/crash/content/app/breakpad_linux.h" #include "components/crash/core/common/crash_key.h" #include "components/viz/common/switches.h" #include "content/public/browser/browser_main_runner.h" @@ -48,6 +47,10 @@ #include "components/crash/content/app/crashpad.h" #endif +#if defined(OS_LINUX) +#include "components/crash/content/app/breakpad_linux.h" +#endif + #if !defined(CHROME_MULTIPLE_DLL_BROWSER) #include "headless/lib/renderer/headless_content_renderer_client.h" #endif @@ -121,7 +124,16 @@ bool HeadlessContentMainDelegate::BasicStartupComplete(int* exit_code) { command_line->AppendSwitchASCII(::switches::kOzonePlatform, "headless"); #endif - if (!command_line->HasSwitch(::switches::kUseGL)) { + if (command_line->HasSwitch(::switches::kUseGL)) { + std::string use_gl = command_line->GetSwitchValueASCII(switches::kUseGL); + if (use_gl != gl::kGLImplementationEGLName) { + // Headless uses a software output device which will cause us to fall back + // to software compositing anyway, but only after attempting and failing + // to initialize GPU compositing. We disable GPU compositing here + // explicitly to preempt this attempt. + command_line->AppendSwitch(::switches::kDisableGpuCompositing); + } + } else { if (!browser_->options()->gl_implementation.empty()) { command_line->AppendSwitchASCII(::switches::kUseGL, browser_->options()->gl_implementation); @@ -130,12 +142,6 @@ bool HeadlessContentMainDelegate::BasicStartupComplete(int* exit_code) { } } - // Headless uses a software output device which will cause us to fall back to - // software compositing anyway, but only after attempting and failing to - // initialize GPU compositing. We disable GPU compositing here explicitly to - // preempt this attempt. - command_line->AppendSwitch(::switches::kDisableGpuCompositing); - content::Profiling::ProcessStarted(); SetContentClient(&content_client_); diff --git a/chromium/headless/lib/headless_devtools_client_browsertest.cc b/chromium/headless/lib/headless_devtools_client_browsertest.cc index f335adeb66a..7519a75e3cc 100644 --- a/chromium/headless/lib/headless_devtools_client_browsertest.cc +++ b/chromium/headless/lib/headless_devtools_client_browsertest.cc @@ -5,6 +5,7 @@ #include <memory> #include "base/base_paths.h" +#include "base/bind.h" #include "base/files/file_util.h" #include "base/json/json_reader.h" #include "base/json/json_writer.h" @@ -178,7 +179,7 @@ class HeadlessDevToolsClientChangeWindowStateTest public: explicit HeadlessDevToolsClientChangeWindowStateTest( browser::WindowState state) - : state_(state){}; + : state_(state) {} void RunDevTooledTest() override { SetWindowState( @@ -213,7 +214,7 @@ class HeadlessDevToolsClientMinimizeWindowTest public: HeadlessDevToolsClientMinimizeWindowTest() : HeadlessDevToolsClientChangeWindowStateTest( - browser::WindowState::MINIMIZED){}; + browser::WindowState::MINIMIZED) {} }; HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessDevToolsClientMinimizeWindowTest); @@ -223,7 +224,7 @@ class HeadlessDevToolsClientMaximizeWindowTest public: HeadlessDevToolsClientMaximizeWindowTest() : HeadlessDevToolsClientChangeWindowStateTest( - browser::WindowState::MAXIMIZED){}; + browser::WindowState::MAXIMIZED) {} }; HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessDevToolsClientMaximizeWindowTest); @@ -233,7 +234,7 @@ class HeadlessDevToolsClientFullscreenWindowTest public: HeadlessDevToolsClientFullscreenWindowTest() : HeadlessDevToolsClientChangeWindowStateTest( - browser::WindowState::FULLSCREEN){}; + browser::WindowState::FULLSCREEN) {} }; HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessDevToolsClientFullscreenWindowTest); diff --git a/chromium/headless/lib/headless_web_contents_browsertest.cc b/chromium/headless/lib/headless_web_contents_browsertest.cc index 241477505fa..18349c06365 100644 --- a/chromium/headless/lib/headless_web_contents_browsertest.cc +++ b/chromium/headless/lib/headless_web_contents_browsertest.cc @@ -6,6 +6,7 @@ #include <string> #include <vector> +#include "base/bind.h" #include "base/command_line.h" #include "base/json/json_writer.h" #include "base/logging.h" @@ -222,9 +223,9 @@ class HeadlessWebContentsScreenshotTest HEADLESS_ASYNC_DEVTOOLED_TEST_P(HeadlessWebContentsScreenshotTest); // Instantiate test case for both software and gpu compositing modes. -INSTANTIATE_TEST_CASE_P(HeadlessWebContentsScreenshotTests, - HeadlessWebContentsScreenshotTest, - ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(HeadlessWebContentsScreenshotTests, + HeadlessWebContentsScreenshotTest, + ::testing::Bool()); // Regression test for crbug.com/832138. class HeadlessWebContentsScreenshotWindowPositionTest @@ -258,9 +259,9 @@ HEADLESS_ASYNC_DEVTOOLED_TEST_P( HeadlessWebContentsScreenshotWindowPositionTest); // Instantiate test case for both software and gpu compositing modes. -INSTANTIATE_TEST_CASE_P(HeadlessWebContentsScreenshotWindowPositionTests, - HeadlessWebContentsScreenshotWindowPositionTest, - ::testing::Bool()); +INSTANTIATE_TEST_SUITE_P(HeadlessWebContentsScreenshotWindowPositionTests, + HeadlessWebContentsScreenshotWindowPositionTest, + ::testing::Bool()); #if BUILDFLAG(ENABLE_PRINTING) class HeadlessWebContentsPDFTest : public HeadlessAsyncDevTooledBrowserTest { diff --git a/chromium/headless/lib/utility/headless_content_utility_client.cc b/chromium/headless/lib/utility/headless_content_utility_client.cc index 3ae9fb48367..d72f8b533da 100644 --- a/chromium/headless/lib/utility/headless_content_utility_client.cc +++ b/chromium/headless/lib/utility/headless_content_utility_client.cc @@ -4,6 +4,7 @@ #include "headless/lib/utility/headless_content_utility_client.h" +#include "base/bind.h" #include "base/lazy_instance.h" #include "content/public/utility/utility_thread.h" #include "printing/buildflags/buildflags.h" diff --git a/chromium/headless/protocol_config.json b/chromium/headless/protocol_config.json index b2511d389aa..2a035a04a3a 100644 --- a/chromium/headless/protocol_config.json +++ b/chromium/headless/protocol_config.json @@ -36,7 +36,7 @@ "lib": { "package": "headless/lib/browser/protocol", "output": "lib/browser/protocol", - "string_header": "headless/lib/browser/protocol/protocol_string.h", + "string_header": "headless/lib/browser/protocol/base_string_adapter.h", "export_macro": "HEADLESS_EXPORT", "export_header": "headless/public/headless_export.h" } diff --git a/chromium/headless/public/domains/types_unittest.cc b/chromium/headless/public/domains/types_unittest.cc index 40ee31c9213..f8e0819865c 100644 --- a/chromium/headless/public/domains/types_unittest.cc +++ b/chromium/headless/public/domains/types_unittest.cc @@ -26,7 +26,7 @@ TEST(TypesTest, IntegerProperty) { TEST(TypesTest, IntegerPropertyParseError) { const char json[] = "{\"entryId\": \"foo\"}"; - std::unique_ptr<base::Value> object = base::JSONReader::Read(json); + std::unique_ptr<base::Value> object = base::JSONReader::ReadDeprecated(json); ASSERT_TRUE(object); #if DCHECK_IS_ON() @@ -52,7 +52,7 @@ TEST(TypesTest, BooleanProperty) { TEST(TypesTest, BooleanPropertyParseError) { const char json[] = "{\"suppressed\": \"foo\"}"; - std::unique_ptr<base::Value> object = base::JSONReader::Read(json); + std::unique_ptr<base::Value> object = base::JSONReader::ReadDeprecated(json); ASSERT_TRUE(object); #if DCHECK_IS_ON() @@ -76,7 +76,7 @@ TEST(TypesTest, DoubleProperty) { TEST(TypesTest, DoublePropertyParseError) { const char json[] = "{\"latitude\": \"foo\"}"; - std::unique_ptr<base::Value> object = base::JSONReader::Read(json); + std::unique_ptr<base::Value> object = base::JSONReader::ReadDeprecated(json); ASSERT_TRUE(object); #if DCHECK_IS_ON() @@ -99,7 +99,7 @@ TEST(TypesTest, StringProperty) { TEST(TypesTest, StringPropertyParseError) { const char json[] = "{\"url\": false}"; - std::unique_ptr<base::Value> object = base::JSONReader::Read(json); + std::unique_ptr<base::Value> object = base::JSONReader::ReadDeprecated(json); ASSERT_TRUE(object); #if DCHECK_IS_ON() @@ -124,7 +124,7 @@ TEST(TypesTest, EnumProperty) { TEST(TypesTest, EnumPropertyParseError) { const char json[] = "{\"type\": false}"; - std::unique_ptr<base::Value> object = base::JSONReader::Read(json); + std::unique_ptr<base::Value> object = base::JSONReader::ReadDeprecated(json); ASSERT_TRUE(object); #if DCHECK_IS_ON() @@ -162,7 +162,7 @@ TEST(TypesTest, ArrayProperty) { TEST(TypesTest, ArrayPropertyParseError) { const char json[] = "{\"nodeIds\": true}"; - std::unique_ptr<base::Value> object = base::JSONReader::Read(json); + std::unique_ptr<base::Value> object = base::JSONReader::ReadDeprecated(json); ASSERT_TRUE(object); #if DCHECK_IS_ON() @@ -191,7 +191,7 @@ TEST(TypesTest, ObjectProperty) { TEST(TypesTest, ObjectPropertyParseError) { const char json[] = "{\"result\": 42}"; - std::unique_ptr<base::Value> object = base::JSONReader::Read(json); + std::unique_ptr<base::Value> object = base::JSONReader::ReadDeprecated(json); ASSERT_TRUE(object); #if DCHECK_IS_ON() diff --git a/chromium/headless/public/internal/value_conversions.h b/chromium/headless/public/internal/value_conversions.h index 9f18f32983a..126d1efd1d5 100644 --- a/chromium/headless/public/internal/value_conversions.h +++ b/chromium/headless/public/internal/value_conversions.h @@ -7,7 +7,7 @@ #include <memory> -#include "headless/lib/browser/protocol/protocol_string.h" +#include "headless/lib/browser/protocol/base_string_adapter.h" #include "headless/public/util/error_reporter.h" namespace headless { |