diff --git a/BUILD.gn b/BUILD.gn index 0a15cbd..c198ea87 100644 --- a/BUILD.gn +++ b/BUILD.gn
@@ -69,6 +69,7 @@ "//base/util:base_util_unittests", "//chrome/installer", "//chrome/updater", + "//components/gwp_asan:gwp_asan_unittests", "//net:net_unittests", "//services:services_unittests", "//services/service_manager/public/cpp",
diff --git a/DEPS b/DEPS index fb03bc3..ef686a9b 100644 --- a/DEPS +++ b/DEPS
@@ -145,11 +145,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': 'fdd03910d6c635292d2083803c701704f5536f1f', + 'skia_revision': '17b9d1d1deaf57acd8d2abd3f84a0e3cb8a635c8', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': '33faa512cb633005dd8e13a91ca4fb12033ba376', + 'v8_revision': '7550297429f9368192c5ef4570696526e8e0b773', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. @@ -157,11 +157,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': '017c9d8ea78b0945f9034b91e85166f94a57dd9e', + 'angle_revision': 'ad77f55e018305e7faaa455583a225a26c77da13', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. - 'swiftshader_revision': 'f63c4e51101a33fbaeaaafba949830ad43f39055', + 'swiftshader_revision': '029a36c7cbfcdb5bc84d98b3dbcf22a4bd3fc586', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. @@ -809,7 +809,7 @@ # Build tools for Chrome OS. Note: This depends on third_party/pyelftools. 'src/third_party/chromite': { - 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '31899ec2ac049bf0f50f7513d44efac85910da02', + 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '4af1fe027b83e35aecf0112585e2c51e70d3da30', 'condition': 'checkout_linux', }, @@ -903,7 +903,7 @@ }, 'src/third_party/glslang/src': - Var('chromium_git') + '/external/github.com/KhronosGroup/glslang.git' + '@' + 'a0eb5efd2bad6f44a44774b884acb658f6e15229', + Var('chromium_git') + '/external/github.com/KhronosGroup/glslang.git' + '@' + '3cea2e5882e3455731a8b6657fb06db913eb3aa1', 'src/third_party/google_toolbox_for_mac/src': { 'url': Var('chromium_git') + '/external/github.com/google/google-toolbox-for-mac.git' + '@' + Var('google_toolbox_for_mac_revision'), @@ -1207,7 +1207,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + 'e52728367fa36746208b3b875007ef190873ab5a', + Var('android_git') + '/platform/external/perfetto.git' + '@' + 'b9d6775dfb5f7f24871dd3e8b4e589435e413bf6', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1375,7 +1375,7 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + 'abaae129d9a0c6e1e092067e0b105475df43352e', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '59bbd65561111fe25e8f0d481e64962598e7c87f', + Var('webrtc_git') + '/src.git' + '@' + '054e3bbbe7921b8b84213ecbbb58f68cd5712f6d', 'src/third_party/xdg-utils': { 'url': Var('chromium_git') + '/chromium/deps/xdg-utils.git' + '@' + 'd80274d5869b17b8c9067a1022e4416ee7ed5e0d',
diff --git a/android_webview/BUILD.gn b/android_webview/BUILD.gn index 4b975f9..04403fe0 100644 --- a/android_webview/BUILD.gn +++ b/android_webview/BUILD.gn
@@ -587,30 +587,28 @@ "browser/net/aw_cookie_store_wrapper.h", "browser/net/aw_http_user_agent_settings.cc", "browser/net/aw_http_user_agent_settings.h", - "browser/net/aw_network_change_notifier.cc", - "browser/net/aw_network_change_notifier.h", - "browser/net/aw_network_change_notifier_factory.cc", - "browser/net/aw_network_change_notifier_factory.h", "browser/net/aw_proxy_config_monitor.cc", "browser/net/aw_proxy_config_monitor.h", - "browser/net/aw_url_request_context_getter.cc", - "browser/net/aw_url_request_context_getter.h", - "browser/net/aw_web_resource_request.cc", - "browser/net/aw_web_resource_request.h", - "browser/net/aw_web_resource_response.cc", - "browser/net/aw_web_resource_response.h", "browser/net/init_native_callback.cc", "browser/net/init_native_callback.h", - "browser/net/input_stream_reader.cc", - "browser/net/input_stream_reader.h", "browser/network_service/android_stream_reader_url_loader.cc", "browser/network_service/android_stream_reader_url_loader.h", + "browser/network_service/aw_network_change_notifier.cc", + "browser/network_service/aw_network_change_notifier.h", + "browser/network_service/aw_network_change_notifier_factory.cc", + "browser/network_service/aw_network_change_notifier_factory.h", "browser/network_service/aw_proxying_restricted_cookie_manager.cc", "browser/network_service/aw_proxying_restricted_cookie_manager.h", "browser/network_service/aw_proxying_url_loader_factory.cc", "browser/network_service/aw_proxying_url_loader_factory.h", "browser/network_service/aw_url_loader_throttle.cc", "browser/network_service/aw_url_loader_throttle.h", + "browser/network_service/aw_web_resource_request.cc", + "browser/network_service/aw_web_resource_request.h", + "browser/network_service/aw_web_resource_response.cc", + "browser/network_service/aw_web_resource_response.h", + "browser/network_service/input_stream_reader.cc", + "browser/network_service/input_stream_reader.h", "browser/network_service/net_helpers.cc", "browser/network_service/net_helpers.h", "browser/permission/aw_permission_request.cc", @@ -867,7 +865,6 @@ "java/src/org/chromium/android_webview/OverScrollGlow.java", "java/src/org/chromium/android_webview/PopupTouchHandleDrawable.java", "java/src/org/chromium/android_webview/ResourcesContextWrapperFactory.java", - "java/src/org/chromium/android_webview/ScopedSysTraceEvent.java", "java/src/org/chromium/android_webview/ScrollAccessibilityHelper.java", "java/src/org/chromium/android_webview/SslUtil.java", "java/src/org/chromium/android_webview/VariationsSeedLoader.java", @@ -882,6 +879,7 @@ "java/src/org/chromium/android_webview/permission/AwGeolocationCallback.java", "java/src/org/chromium/android_webview/permission/AwPermissionRequest.java", "java/src/org/chromium/android_webview/policy/AwPolicyProvider.java", + "java/src/org/chromium/android_webview/ui/util/UnuploadedFilesStateLoader.java", "java/src/org/chromium/android_webview/ui/util/UploadedCrashesInfoLoader.java", "java/src/org/chromium/android_webview/ui/util/WebViewCrashLogParser.java", ]
diff --git a/android_webview/browser/android_protocol_handler.cc b/android_webview/browser/android_protocol_handler.cc index 69944450..bc3ed42 100644 --- a/android_webview/browser/android_protocol_handler.cc +++ b/android_webview/browser/android_protocol_handler.cc
@@ -19,7 +19,6 @@ #include "net/base/net_errors.h" #include "net/http/http_util.h" #include "net/url_request/url_request.h" -#include "net/url_request/url_request_interceptor.h" #include "url/gurl.h" #include "url/url_constants.h" @@ -32,77 +31,9 @@ using base::android::ScopedJavaGlobalRef; using base::android::ScopedJavaLocalRef; -namespace { - -const void* const kPreviouslyFailedKey = &kPreviouslyFailedKey; - -class AndroidRequestInterceptorBase : public net::URLRequestInterceptor { - public: - net::URLRequestJob* MaybeInterceptRequest( - net::URLRequest* request, - net::NetworkDelegate* network_delegate) const override; - - virtual bool ShouldHandleRequest(const net::URLRequest* request) const = 0; -}; - -class AssetFileRequestInterceptor : public AndroidRequestInterceptorBase { - public: - AssetFileRequestInterceptor(); - bool ShouldHandleRequest(const net::URLRequest* request) const override; -}; - -// Protocol handler for content:// scheme requests. -class ContentSchemeRequestInterceptor : public AndroidRequestInterceptorBase { - public: - ContentSchemeRequestInterceptor(); - bool ShouldHandleRequest(const net::URLRequest* request) const override; -}; - -// AndroidRequestInterceptorBase ---------------------------------------------- - -net::URLRequestJob* AndroidRequestInterceptorBase::MaybeInterceptRequest( - net::URLRequest* request, - net::NetworkDelegate* network_delegate) const { - NOTREACHED(); - return nullptr; -} - -// AssetFileRequestInterceptor ------------------------------------------------ - -AssetFileRequestInterceptor::AssetFileRequestInterceptor() {} - -bool AssetFileRequestInterceptor::ShouldHandleRequest( - const net::URLRequest* request) const { - return android_webview::IsAndroidSpecialFileUrl(request->url()); -} - -// ContentSchemeRequestInterceptor -------------------------------------------- - -ContentSchemeRequestInterceptor::ContentSchemeRequestInterceptor() {} - -bool ContentSchemeRequestInterceptor::ShouldHandleRequest( - const net::URLRequest* request) const { - return request->url().SchemeIs(url::kContentScheme); -} - -} // namespace - namespace android_webview { // static -std::unique_ptr<net::URLRequestInterceptor> -CreateContentSchemeRequestInterceptor() { - return std::make_unique<ContentSchemeRequestInterceptor>(); -} - -// static -std::unique_ptr<net::URLRequestInterceptor> -CreateAssetFileRequestInterceptor() { - return std::unique_ptr<net::URLRequestInterceptor>( - new AssetFileRequestInterceptor()); -} - -// static std::unique_ptr<InputStream> CreateInputStream(JNIEnv* env, const GURL& url) { DCHECK(url.is_valid()); DCHECK(env);
diff --git a/android_webview/browser/android_protocol_handler.h b/android_webview/browser/android_protocol_handler.h index 2587d5a..70dd222c 100644 --- a/android_webview/browser/android_protocol_handler.h +++ b/android_webview/browser/android_protocol_handler.h
@@ -10,27 +10,9 @@ class GURL; -namespace net { -class URLRequestInterceptor; -} // namespace net - namespace android_webview { class InputStream; -// These methods create interceptors for Android WebView-specific schemes: -// -// - "content:" scheme is used for accessing data from Android content -// providers, see http://developer.android.com/guide/topics/providers/ -// content-provider-basics.html#ContentURIs -std::unique_ptr<net::URLRequestInterceptor> -CreateContentSchemeRequestInterceptor(); - -// - "file:" scheme extension for accessing application assets and resources -// (file:///android_asset/ and file:///android_res/), see -// http://developer.android.com/reference/android/webkit/ -// WebSettings.html#setAllowFileAccess(boolean) -std::unique_ptr<net::URLRequestInterceptor> CreateAssetFileRequestInterceptor(); - std::unique_ptr<InputStream> CreateInputStream(JNIEnv* env, const GURL& url); bool GetInputStreamMimeType(JNIEnv* env,
diff --git a/android_webview/browser/aw_browser_context.cc b/android_webview/browser/aw_browser_context.cc index 916f5c86..d5ba06f9 100644 --- a/android_webview/browser/aw_browser_context.cc +++ b/android_webview/browser/aw_browser_context.cc
@@ -45,6 +45,7 @@ #include "components/safe_browsing/common/safe_browsing_prefs.h" #include "components/url_formatter/url_fixer.h" #include "components/user_prefs/user_prefs.h" +#include "components/variations/net/variations_http_headers.h" #include "components/visitedlink/browser/visitedlink_master.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" @@ -426,7 +427,10 @@ context_params->check_clear_text_permitted = AwContentBrowserClient::get_check_cleartext_permitted(); + // Update the cors_exempt_header_list to include internally-added headers, to + // avoid triggering CORS checks. content::UpdateCorsExemptHeader(context_params.get()); + variations::UpdateCorsExemptHeaderForVariations(context_params.get()); // Add proxy settings AwProxyConfigMonitor::GetInstance()->AddProxyToNetworkContextParams(
diff --git a/android_webview/browser/aw_browser_main_parts.cc b/android_webview/browser/aw_browser_main_parts.cc index d3875fb..5773086 100644 --- a/android_webview/browser/aw_browser_main_parts.cc +++ b/android_webview/browser/aw_browser_main_parts.cc
@@ -15,7 +15,7 @@ #include "android_webview/browser/aw_metrics_service_client.h" #include "android_webview/browser/aw_web_ui_controller_factory.h" #include "android_webview/browser/memory_metrics_logger.h" -#include "android_webview/browser/net/aw_network_change_notifier_factory.h" +#include "android_webview/browser/network_service/aw_network_change_notifier_factory.h" #include "android_webview/common/aw_descriptors.h" #include "android_webview/common/aw_paths.h" #include "android_webview/common/aw_resource.h" @@ -29,8 +29,8 @@ #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/i18n/rtl.h" -#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop_current.h" +#include "base/message_loop/message_pump_type.h" #include "base/path_service.h" #include "components/crash/content/browser/child_exit_observer_android.h" #include "components/heap_profiling/supervisor.h" @@ -77,7 +77,7 @@ DCHECK(!main_task_executor_.get()); if (!base::MessageLoopCurrent::IsSet()) { main_task_executor_ = std::make_unique<base::SingleThreadTaskExecutor>( - base::MessagePump::Type::UI); + base::MessagePumpType::UI); } browser_process_ = std::make_unique<AwBrowserProcess>(
diff --git a/android_webview/browser/aw_browser_process.cc b/android_webview/browser/aw_browser_process.cc index 223c796..f6618c1d 100644 --- a/android_webview/browser/aw_browser_process.cc +++ b/android_webview/browser/aw_browser_process.cc
@@ -10,7 +10,6 @@ #include "base/task/post_task.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" -#include "services/network/public/cpp/features.h" using content::BrowserThread; @@ -48,18 +47,13 @@ } void AwBrowserProcess::PreMainMessageLoopRun() { - if (base::FeatureList::IsEnabled(network::features::kNetworkService)) { - pref_change_registrar_.Init(local_state()); - auto auth_pref_callback = base::BindRepeating( - &AwBrowserProcess::OnAuthPrefsChanged, base::Unretained(this)); - pref_change_registrar_.Add(prefs::kAuthServerWhitelist, auth_pref_callback); - pref_change_registrar_.Add(prefs::kAuthAndroidNegotiateAccountType, - auth_pref_callback); - } + pref_change_registrar_.Init(local_state()); + auto auth_pref_callback = base::BindRepeating( + &AwBrowserProcess::OnAuthPrefsChanged, base::Unretained(this)); + pref_change_registrar_.Add(prefs::kAuthServerWhitelist, auth_pref_callback); + pref_change_registrar_.Add(prefs::kAuthAndroidNegotiateAccountType, + auth_pref_callback); - if (!base::FeatureList::IsEnabled(network::features::kNetworkService)) { - CreateURLRequestContextGetter(); - } InitSafeBrowsing(); } @@ -180,34 +174,4 @@ CreateHttpAuthDynamicParams()); } -namespace { -std::unique_ptr<net::ProxyConfigServiceAndroid> CreateProxyConfigService() { - std::unique_ptr<net::ProxyConfigServiceAndroid> config_service_android = - std::make_unique<net::ProxyConfigServiceAndroid>( - base::CreateSingleThreadTaskRunner({BrowserThread::IO}), - base::ThreadTaskRunnerHandle::Get()); - - config_service_android->set_exclude_pac_url(true); - return config_service_android; -} -} // namespace - -// Default profile reuses global URLRequestGetter -void AwBrowserProcess::CreateURLRequestContextGetter() { - DCHECK(!base::FeatureList::IsEnabled(network::features::kNetworkService)); - base::FilePath cache_path; - if (!base::PathService::Get(base::DIR_CACHE, &cache_path)) { - NOTREACHED() << "Failed to get app cache directory for Android WebView"; - } - cache_path = - cache_path.Append(FILE_PATH_LITERAL("org.chromium.android_webview")); - - url_request_context_getter_ = new AwURLRequestContextGetter( - cache_path, CreateProxyConfigService(), local_state(), new net::NetLog()); -} - -AwURLRequestContextGetter* AwBrowserProcess::GetAwURLRequestContext() { - return url_request_context_getter_.get(); -} - } // namespace android_webview
diff --git a/android_webview/browser/aw_browser_process.h b/android_webview/browser/aw_browser_process.h index d852dd17..ee4ece45 100644 --- a/android_webview/browser/aw_browser_process.h +++ b/android_webview/browser/aw_browser_process.h
@@ -9,7 +9,6 @@ #include "android_webview/browser/aw_browser_context.h" #include "android_webview/browser/aw_feature_list_creator.h" -#include "android_webview/browser/net/aw_url_request_context_getter.h" #include "android_webview/browser/safe_browsing/aw_safe_browsing_ui_manager.h" #include "android_webview/browser/safe_browsing/aw_safe_browsing_whitelist_manager.h" #include "base/feature_list.h" @@ -20,7 +19,6 @@ #include "content/public/browser/network_service_instance.h" #include "net/log/net_log.h" #include "services/network/network_service.h" -#include "services/network/public/cpp/features.h" namespace android_webview { @@ -66,8 +64,6 @@ // Constructs HttpAuthDynamicParams based on |local_state_|. network::mojom::HttpAuthDynamicParamsPtr CreateHttpAuthDynamicParams(); - AwURLRequestContextGetter* GetAwURLRequestContext(); - void PreMainMessageLoopRun(); private: @@ -76,8 +72,6 @@ void OnAuthPrefsChanged(); - void CreateURLRequestContextGetter(); - // If non-null, this object holds a pref store that will be taken by // AwBrowserProcess to create the |local_state_|. // The AwFeatureListCreator is owned by AwMainDelegate. @@ -105,8 +99,6 @@ std::unique_ptr<AwSafeBrowsingWhitelistManager> safe_browsing_whitelist_manager_; - scoped_refptr<AwURLRequestContextGetter> url_request_context_getter_; - DISALLOW_COPY_AND_ASSIGN(AwBrowserProcess); };
diff --git a/android_webview/browser/aw_content_browser_client.cc b/android_webview/browser/aw_content_browser_client.cc index ebc4a7d..41e5b5d 100644 --- a/android_webview/browser/aw_content_browser_client.cc +++ b/android_webview/browser/aw_content_browser_client.cc
@@ -30,7 +30,6 @@ #include "android_webview/browser/cookie_manager.h" #include "android_webview/browser/js_java_interaction/js_api_handler_factory.h" #include "android_webview/browser/net/aw_proxy_config_monitor.h" -#include "android_webview/browser/net/aw_url_request_context_getter.h" #include "android_webview/browser/network_service/aw_proxying_restricted_cookie_manager.h" #include "android_webview/browser/network_service/aw_proxying_url_loader_factory.h" #include "android_webview/browser/network_service/aw_url_loader_throttle.h" @@ -338,9 +337,6 @@ void AwContentBrowserClient::OnNetworkServiceCreated( network::mojom::NetworkService* network_service) { - if (!base::FeatureList::IsEnabled(network::features::kNetworkService)) - return; - network::mojom::HttpAuthStaticParamsPtr auth_static_params = network::mojom::HttpAuthStaticParams::New(); auth_static_params->supported_schemes = AwBrowserContext::GetAuthSchemes(); @@ -352,8 +348,6 @@ bool in_memory, const base::FilePath& relative_partition_path) { DCHECK(context); - if (!base::FeatureList::IsEnabled(network::features::kNetworkService)) - return nullptr; content::GetNetworkService()->ConfigureHttpAuthPrefs( AwBrowserProcess::GetInstance()->CreateHttpAuthDynamicParams()); @@ -393,8 +387,7 @@ } void AwContentBrowserClient::RenderProcessWillLaunch( - content::RenderProcessHost* host, - service_manager::mojom::ServiceRequest* service_request) { + content::RenderProcessHost* host) { // Grant content: scheme access to the whole renderer process, since we impose // per-view access checks, and access is granted by default (see // AwSettings.mAllowContentUrlAccess). @@ -755,19 +748,17 @@ service_manager::BinderRegistry* registry, blink::AssociatedInterfaceRegistry* associated_registry, content::RenderProcessHost* render_process_host) { - if (base::FeatureList::IsEnabled(network::features::kNetworkService) || - base::FeatureList::IsEnabled(safe_browsing::kCheckByURLLoaderThrottle)) { - content::ResourceContext* resource_context = - render_process_host->GetBrowserContext()->GetResourceContext(); - registry->AddInterface( - base::BindRepeating( - &safe_browsing::MojoSafeBrowsingImpl::MaybeCreate, - render_process_host->GetID(), resource_context, - base::BindRepeating( - &AwContentBrowserClient::GetSafeBrowsingUrlCheckerDelegate, - base::Unretained(this))), - base::CreateSingleThreadTaskRunner({BrowserThread::IO})); - } + content::ResourceContext* resource_context = + render_process_host->GetBrowserContext()->GetResourceContext(); + registry->AddInterface( + base::BindRepeating( + &safe_browsing::MojoSafeBrowsingImpl::MaybeCreate, + render_process_host->GetID(), resource_context, + base::BindRepeating( + &AwContentBrowserClient::GetSafeBrowsingUrlCheckerDelegate, + base::Unretained(this))), + base::CreateSingleThreadTaskRunner({BrowserThread::IO})); + #if BUILDFLAG(ENABLE_SPELLCHECK) registry->AddInterface( base::BindRepeating(&SpellCheckHostImpl::Create), @@ -913,29 +904,22 @@ ui::PageTransition page_transition, bool has_user_gesture, network::mojom::URLLoaderFactoryPtr* out_factory) { - if (base::FeatureList::IsEnabled(network::features::kNetworkService)) { - auto request = mojo::MakeRequest(out_factory); - if (content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)) { - // Manages its own lifetime. - new android_webview::AwProxyingURLLoaderFactory( - 0 /* process_id */, std::move(request), nullptr, - true /* intercept_only */); - } else { - base::PostTask( - FROM_HERE, {content::BrowserThread::IO}, - base::BindOnce( - [](network::mojom::URLLoaderFactoryRequest request) { - // Manages its own lifetime. - new android_webview::AwProxyingURLLoaderFactory( - 0 /* process_id */, std::move(request), nullptr, - true /* intercept_only */); - }, - std::move(request))); - } + auto request = mojo::MakeRequest(out_factory); + if (content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)) { + // Manages its own lifetime. + new android_webview::AwProxyingURLLoaderFactory(0 /* process_id */, + std::move(request), nullptr, + true /* intercept_only */); } else { - // The AwURLRequestJobFactory implementation should ensure this method never - // gets called when Network Service is not enabled. - NOTREACHED(); + base::PostTask(FROM_HERE, {content::BrowserThread::IO}, + base::BindOnce( + [](network::mojom::URLLoaderFactoryRequest request) { + // Manages its own lifetime. + new android_webview::AwProxyingURLLoaderFactory( + 0 /* process_id */, std::move(request), nullptr, + true /* intercept_only */); + }, + std::move(request))); } return false; }
diff --git a/android_webview/browser/aw_content_browser_client.h b/android_webview/browser/aw_content_browser_client.h index 485f5d4..5a8fd89 100644 --- a/android_webview/browser/aw_content_browser_client.h +++ b/android_webview/browser/aw_content_browser_client.h
@@ -64,9 +64,7 @@ const content::MainFunctionParams& parameters) override; content::WebContentsViewDelegate* GetWebContentsViewDelegate( content::WebContents* web_contents) override; - void RenderProcessWillLaunch( - content::RenderProcessHost* host, - service_manager::mojom::ServiceRequest* service_request) override; + void RenderProcessWillLaunch(content::RenderProcessHost* host) override; bool ShouldUseMobileFlingCurve() override; bool IsHandledURL(const GURL& url) override; bool ForceSniffingFileUrlsForHtml() override;
diff --git a/android_webview/browser/aw_contents_client_bridge.h b/android_webview/browser/aw_contents_client_bridge.h index 3eaf642..a839c8f 100644 --- a/android_webview/browser/aw_contents_client_bridge.h +++ b/android_webview/browser/aw_contents_client_bridge.h
@@ -7,7 +7,7 @@ #include <memory> -#include "android_webview/browser/net/aw_web_resource_request.h" +#include "android_webview/browser/network_service/aw_web_resource_request.h" #include "android_webview/browser/safe_browsing/aw_url_checker_delegate_impl.h" #include "base/android/jni_weak_ref.h" #include "base/android/scoped_java_ref.h"
diff --git a/android_webview/browser/aw_contents_io_thread_client.cc b/android_webview/browser/aw_contents_io_thread_client.cc index 5c118ba2..ab36f0f0 100644 --- a/android_webview/browser/aw_contents_io_thread_client.cc +++ b/android_webview/browser/aw_contents_io_thread_client.cc
@@ -9,8 +9,8 @@ #include <utility> #include "android_webview/browser/input_stream.h" -#include "android_webview/browser/net/aw_web_resource_request.h" -#include "android_webview/browser/net/aw_web_resource_response.h" +#include "android_webview/browser/network_service/aw_web_resource_request.h" +#include "android_webview/browser/network_service/aw_web_resource_response.h" #include "android_webview/common/devtools_instrumentation.h" #include "android_webview/native_jni/AwContentsBackgroundThreadClient_jni.h" #include "android_webview/native_jni/AwContentsIoThreadClient_jni.h"
diff --git a/android_webview/browser/aw_contents_statics.cc b/android_webview/browser/aw_contents_statics.cc index fc2e06f..100338f 100644 --- a/android_webview/browser/aw_contents_statics.cc +++ b/android_webview/browser/aw_contents_statics.cc
@@ -6,7 +6,6 @@ #include "android_webview/browser/aw_content_browser_client.h" #include "android_webview/browser/aw_contents.h" #include "android_webview/browser/aw_contents_io_thread_client.h" -#include "android_webview/browser/net/aw_url_request_context_getter.h" #include "android_webview/browser/safe_browsing/aw_safe_browsing_whitelist_manager.h" #include "android_webview/native_jni/AwContentsStatics_jni.h" #include "base/android/jni_array.h" @@ -125,13 +124,7 @@ void JNI_AwContentsStatics_SetCheckClearTextPermitted( JNIEnv* env, jboolean permitted) { - // Notify both the legacy and NS code paths of this setting. We do this - // because this method may be called before we initialize the FeatureList - // during AwMainDelegate::PostEarlyInitialization (which means we can't - // reliably know at this point if we're in the NetworkService or legacy code - // path). AwContentBrowserClient::set_check_cleartext_permitted(permitted); - AwURLRequestContextGetter::set_check_cleartext_permitted(permitted); } // static
diff --git a/android_webview/browser/aw_download_manager_delegate.cc b/android_webview/browser/aw_download_manager_delegate.cc index c34b320a..3bf803a3 100644 --- a/android_webview/browser/aw_download_manager_delegate.cc +++ b/android_webview/browser/aw_download_manager_delegate.cc
@@ -13,7 +13,6 @@ #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/web_contents.h" -#include "services/network/public/cpp/features.h" namespace android_webview { @@ -73,9 +72,6 @@ int64_t content_length, bool is_transient, content::WebContents* web_contents) { - if (!base::FeatureList::IsEnabled(network::features::kNetworkService)) - return false; - if (!web_contents) return false;
diff --git a/android_webview/browser/aw_feature_list_creator.cc b/android_webview/browser/aw_feature_list_creator.cc index 0c95a3a..7ebcc32 100644 --- a/android_webview/browser/aw_feature_list_creator.cc +++ b/android_webview/browser/aw_feature_list_creator.cc
@@ -14,7 +14,6 @@ #include "android_webview/browser/aw_browser_process.h" #include "android_webview/browser/aw_metrics_service_client.h" #include "android_webview/browser/aw_variations_seed_bridge.h" -#include "android_webview/browser/net/aw_url_request_context_getter.h" #include "base/base_switches.h" #include "base/bind.h" #include "base/bind_helpers.h"
diff --git a/android_webview/browser/aw_proxy_controller.cc b/android_webview/browser/aw_proxy_controller.cc index 02bc7ed..fee33f0 100644 --- a/android_webview/browser/aw_proxy_controller.cc +++ b/android_webview/browser/aw_proxy_controller.cc
@@ -5,7 +5,6 @@ #include "android_webview/browser/aw_browser_context.h" #include "android_webview/browser/aw_browser_process.h" #include "android_webview/browser/net/aw_proxy_config_monitor.h" -#include "android_webview/browser/net/aw_url_request_context_getter.h" #include "android_webview/native_jni/AwProxyController_jni.h" #include "base/android/jni_array.h" #include "base/android/jni_string.h" @@ -16,7 +15,6 @@ #include "base/message_loop/message_loop_current.h" #include "content/public/browser/browser_thread.h" #include "net/proxy_resolution/proxy_config_service_android.h" -#include "services/network/public/cpp/features.h" using base::android::AttachCurrentThread; using base::android::HasException; @@ -73,24 +71,12 @@ base::android::AppendJavaStringArrayToStringVector(env, jbypass_rules, &bypass_rules); std::string result; - if (base::FeatureList::IsEnabled(network::features::kNetworkService)) { - result = AwProxyConfigMonitor::GetInstance()->SetProxyOverride( - proxy_rules, bypass_rules, - base::BindOnce(&ProxyOverrideChanged, - ScopedJavaGlobalRef<jobject>(env, obj), - ScopedJavaGlobalRef<jobject>(env, listener), - ScopedJavaGlobalRef<jobject>(env, executor))); - } else { - result = - AwBrowserProcess::GetInstance() - ->GetAwURLRequestContext() - ->SetProxyOverride( - proxy_rules, bypass_rules, - base::BindOnce(&ProxyOverrideChanged, - ScopedJavaGlobalRef<jobject>(env, obj), - ScopedJavaGlobalRef<jobject>(env, listener), - ScopedJavaGlobalRef<jobject>(env, executor))); - } + result = AwProxyConfigMonitor::GetInstance()->SetProxyOverride( + proxy_rules, bypass_rules, + base::BindOnce(&ProxyOverrideChanged, + ScopedJavaGlobalRef<jobject>(env, obj), + ScopedJavaGlobalRef<jobject>(env, listener), + ScopedJavaGlobalRef<jobject>(env, executor))); return base::android::ConvertUTF8ToJavaString(env, result); } @@ -99,19 +85,10 @@ const JavaParamRef<jobject>& obj, const JavaParamRef<jobject>& listener, const JavaParamRef<jobject>& executor) { - if (base::FeatureList::IsEnabled(network::features::kNetworkService)) { - AwProxyConfigMonitor::GetInstance()->ClearProxyOverride(base::BindOnce( - &ProxyOverrideChanged, ScopedJavaGlobalRef<jobject>(env, obj), - ScopedJavaGlobalRef<jobject>(env, listener), - ScopedJavaGlobalRef<jobject>(env, executor))); - } else { - AwBrowserProcess::GetInstance() - ->GetAwURLRequestContext() - ->ClearProxyOverride(base::BindOnce( - &ProxyOverrideChanged, ScopedJavaGlobalRef<jobject>(env, obj), - ScopedJavaGlobalRef<jobject>(env, listener), - ScopedJavaGlobalRef<jobject>(env, executor))); - } + AwProxyConfigMonitor::GetInstance()->ClearProxyOverride(base::BindOnce( + &ProxyOverrideChanged, ScopedJavaGlobalRef<jobject>(env, obj), + ScopedJavaGlobalRef<jobject>(env, listener), + ScopedJavaGlobalRef<jobject>(env, executor))); } } // namespace android_webview
diff --git a/android_webview/browser/aw_settings.cc b/android_webview/browser/aw_settings.cc index 799ffb2..df4bc11 100644 --- a/android_webview/browser/aw_settings.cc +++ b/android_webview/browser/aw_settings.cc
@@ -25,7 +25,6 @@ #include "content/public/browser/web_contents.h" #include "content/public/common/web_preferences.h" #include "net/http/http_util.h" -#include "services/network/public/cpp/features.h" #include "third_party/blink/public/mojom/renderer_preferences.mojom.h" using base::android::ConvertJavaStringToUTF16; @@ -253,8 +252,7 @@ if (update_prefs && host) host->SyncRendererPrefs(); - if (update_prefs && - base::FeatureList::IsEnabled(network::features::kNetworkService)) { + if (update_prefs) { // make sure to update accept languages when the network service is enabled AwBrowserContext* aw_browser_context = AwBrowserContext::FromWebContents(web_contents());
diff --git a/android_webview/browser/net/aw_url_request_context_getter.cc b/android_webview/browser/net/aw_url_request_context_getter.cc deleted file mode 100644 index 3dbd1cb..0000000 --- a/android_webview/browser/net/aw_url_request_context_getter.cc +++ /dev/null
@@ -1,230 +0,0 @@ -// 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 "android_webview/browser/net/aw_url_request_context_getter.h" - -#include <memory> -#include <string> -#include <utility> -#include <vector> - -#include "android_webview/browser/aw_browser_context.h" -#include "android_webview/browser/aw_browser_process.h" -#include "android_webview/browser/aw_content_browser_client.h" -#include "android_webview/browser/aw_feature_list.h" -#include "android_webview/browser/net/aw_cookie_store_wrapper.h" -#include "android_webview/browser/net/aw_http_user_agent_settings.h" -#include "android_webview/browser/net/init_native_callback.h" -#include "android_webview/browser/network_service/net_helpers.h" -#include "android_webview/common/aw_content_client.h" -#include "base/base_paths_android.h" -#include "base/bind.h" -#include "base/command_line.h" -#include "base/feature_list.h" -#include "base/files/file_path.h" -#include "base/path_service.h" -#include "base/strings/string_number_conversions.h" -#include "base/system/sys_info.h" -#include "base/task/post_task.h" -#include "build/build_config.h" -#include "components/network_session_configurator/common/network_switches.h" -#include "components/prefs/pref_registry_simple.h" -#include "components/prefs/pref_service.h" -#include "components/version_info/version_info.h" -#include "content/public/browser/browser_task_traits.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/content_browser_client.h" -#include "content/public/browser/cookie_store_factory.h" -#include "content/public/common/content_client.h" -#include "content/public/common/content_switches.h" -#include "content/public/common/url_constants.h" -#include "net/base/cache_type.h" -#include "net/cert/cert_verifier.h" -#include "net/cookies/cookie_store.h" -#include "net/http/http_auth_filter.h" -#include "net/http/http_auth_handler_factory.h" -#include "net/http/http_auth_preferences.h" -#include "net/http/http_cache.h" -#include "net/http/http_network_session.h" -#include "net/http/http_stream_factory.h" -#include "net/log/file_net_log_observer.h" -#include "net/log/net_log_capture_mode.h" -#include "net/log/net_log_util.h" -#include "net/net_buildflags.h" -#include "net/proxy_resolution/proxy_config_service_android.h" -#include "net/proxy_resolution/proxy_resolution_service.h" -#include "net/socket/next_proto.h" -#include "net/ssl/ssl_config.h" -#include "net/ssl/ssl_config_service.h" -#include "net/url_request/data_protocol_handler.h" -#include "net/url_request/file_protocol_handler.h" -#include "net/url_request/url_request_context.h" -#include "net/url_request/url_request_context_builder.h" -#include "net/url_request/url_request_intercepting_job_factory.h" -#include "net/url_request/url_request_interceptor.h" -#include "services/network/public/cpp/features.h" -#include "services/network/public/cpp/network_switches.h" - -using base::FilePath; -using content::BrowserThread; - -namespace android_webview { - - -namespace { - -#if DCHECK_IS_ON() -bool g_created_url_request_context_builder = false; -#endif -// On apps targeting API level O or later, check cleartext is enforced. -bool g_check_cleartext_permitted = false; - -} // namespace - -AwURLRequestContextGetter::AwURLRequestContextGetter( - const base::FilePath& cache_path, - std::unique_ptr<net::ProxyConfigServiceAndroid> config_service, - PrefService* user_pref_service, - net::NetLog* net_log) - : cache_path_(cache_path), - net_log_(net_log), - proxy_config_service_(std::move(config_service)), - proxy_config_service_android_(proxy_config_service_.get()), - http_user_agent_settings_(new AwHttpUserAgentSettings()) { - // CreateSystemProxyConfigService for Android must be called on main thread. - DCHECK_CURRENTLY_ON(BrowserThread::UI); - - scoped_refptr<base::SingleThreadTaskRunner> io_thread_proxy = - base::CreateSingleThreadTaskRunner({BrowserThread::IO}); - - auth_server_allowlist_.Init( - prefs::kAuthServerWhitelist, user_pref_service, - base::BindRepeating(&AwURLRequestContextGetter::UpdateServerAllowlist, - base::Unretained(this))); - auth_server_allowlist_.MoveToSequence(io_thread_proxy); - - auth_android_negotiate_account_type_.Init( - prefs::kAuthAndroidNegotiateAccountType, user_pref_service, - base::BindRepeating( - &AwURLRequestContextGetter::UpdateAndroidAuthNegotiateAccountType, - base::Unretained(this))); - auth_android_negotiate_account_type_.MoveToSequence(io_thread_proxy); - - // For net-log, use default capture mode and no channel information. - // WebView can enable net-log only using commandline in userdebug - // devices so there is no need to complicate things here. The net_log - // file is written at an absolute path specified by the user using - // --log-net-log=<filename.json>. Note: the absolute path should be a - // subdirectory of the app's data directory, otherwise multiple WebView apps - // may write to the same file. The user should then 'adb pull' the file to - // desktop and then import it to chrome://net-internals There is no good way - // to shutdown net-log at the moment. The file will always be truncated. - const base::CommandLine& command_line = - *base::CommandLine::ForCurrentProcess(); - // Note: Netlog is handled by the Network Service when that is enabled. - if (command_line.HasSwitch(network::switches::kLogNetLog) && - !base::FeatureList::IsEnabled(network::features::kNetworkService)) { - // Assume the user gave us a path we can write to - FilePath net_log_path = - command_line.GetSwitchValuePath(network::switches::kLogNetLog); - - std::unique_ptr<base::DictionaryValue> constants_dict = - net::GetNetConstants(); - // Add a dictionary with client information - auto dict = std::make_unique<base::DictionaryValue>(); - - dict->SetString("name", version_info::GetProductName()); - dict->SetString("version", version_info::GetVersionNumber()); - dict->SetString("cl", version_info::GetLastChange()); - dict->SetString("official", version_info::IsOfficialBuild() ? "official" - : "unofficial"); - std::string os_type = base::StringPrintf( - "%s: %s (%s)", base::SysInfo::OperatingSystemName().c_str(), - base::SysInfo::OperatingSystemVersion().c_str(), - base::SysInfo::OperatingSystemArchitecture().c_str()); - dict->SetString("os_type", os_type); - - dict->SetString( - "command_line", - base::CommandLine::ForCurrentProcess()->GetCommandLineString()); - constants_dict->Set("clientInfo", std::move(dict)); - - file_net_log_observer_ = net::FileNetLogObserver::CreateUnbounded( - net_log_path, std::move(constants_dict)); - file_net_log_observer_->StartObserving(net_log_, - net::NetLogCaptureMode::kDefault); - } -} - -AwURLRequestContextGetter::~AwURLRequestContextGetter() { -} - -void AwURLRequestContextGetter::InitializeURLRequestContext() { - // network service is enabled by default, this code path is never executed. - NOTREACHED(); -} - -// static -void AwURLRequestContextGetter::set_check_cleartext_permitted(bool permitted) { -#if DCHECK_IS_ON() - DCHECK(!g_created_url_request_context_builder); -#endif - g_check_cleartext_permitted = permitted; -} - -net::URLRequestContext* AwURLRequestContextGetter::GetURLRequestContext() { - DCHECK_CURRENTLY_ON(BrowserThread::IO); - if (!url_request_context_) - InitializeURLRequestContext(); - - return url_request_context_.get(); -} - -scoped_refptr<base::SingleThreadTaskRunner> -AwURLRequestContextGetter::GetNetworkTaskRunner() const { - return base::CreateSingleThreadTaskRunner({BrowserThread::IO}); -} - -void AwURLRequestContextGetter::SetHandlersAndInterceptors( - content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors) { - std::swap(protocol_handlers_, *protocol_handlers); - request_interceptors_.swap(request_interceptors); -} - -std::unique_ptr<net::HttpAuthHandlerFactory> -AwURLRequestContextGetter::CreateAuthHandlerFactory() { - http_auth_preferences_.reset(new net::HttpAuthPreferences()); - UpdateServerAllowlist(); - UpdateAndroidAuthNegotiateAccountType(); - - return net::HttpAuthHandlerRegistryFactory::Create( - http_auth_preferences_.get(), AwBrowserContext::GetAuthSchemes()); -} - -void AwURLRequestContextGetter::UpdateServerAllowlist() { - http_auth_preferences_->SetServerAllowlist(auth_server_allowlist_.GetValue()); -} - -void AwURLRequestContextGetter::UpdateAndroidAuthNegotiateAccountType() { - http_auth_preferences_->set_auth_android_negotiate_account_type( - auth_android_negotiate_account_type_.GetValue()); -} - -std::string AwURLRequestContextGetter::SetProxyOverride( - const std::vector<net::ProxyConfigServiceAndroid::ProxyOverrideRule>& - proxy_rules, - const std::vector<std::string>& bypass_rules, - base::OnceClosure callback) { - DCHECK(proxy_config_service_android_ != nullptr); - return proxy_config_service_android_->SetProxyOverride( - proxy_rules, bypass_rules, std::move(callback)); -} - -void AwURLRequestContextGetter::ClearProxyOverride(base::OnceClosure callback) { - DCHECK(proxy_config_service_android_ != nullptr); - proxy_config_service_android_->ClearProxyOverride(std::move(callback)); -} - -} // namespace android_webview
diff --git a/android_webview/browser/net/aw_url_request_context_getter.h b/android_webview/browser/net/aw_url_request_context_getter.h deleted file mode 100644 index 486546a..0000000 --- a/android_webview/browser/net/aw_url_request_context_getter.h +++ /dev/null
@@ -1,109 +0,0 @@ -// 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. - -#ifndef ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ -#define ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_ - -#include <memory> - -#include "base/compiler_specific.h" -#include "base/files/file_path.h" -#include "base/macros.h" -#include "base/single_thread_task_runner.h" -#include "components/prefs/pref_member.h" -#include "content/public/browser/browser_context.h" -#include "net/proxy_resolution/proxy_config_service_android.h" -#include "net/url_request/url_request_context_getter.h" -#include "net/url_request/url_request_job_factory.h" - -class PrefService; - -namespace net { -class FileNetLogObserver; -class HttpAuthHandlerFactory; -class HttpAuthPreferences; -class HttpUserAgentSettings; -class NetLog; -class ProxyConfigServiceAndroid; -class ProxyConfigService; -class URLRequestContext; -} - -namespace android_webview { - -class AwURLRequestContextGetter : public net::URLRequestContextGetter { - public: - AwURLRequestContextGetter( - const base::FilePath& cache_path, - std::unique_ptr<net::ProxyConfigServiceAndroid> config_service, - PrefService* pref_service, - net::NetLog* net_log); - - static void set_check_cleartext_permitted(bool permitted); - - // net::URLRequestContextGetter implementation. - net::URLRequestContext* GetURLRequestContext() override; - scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() - const override; - - // Methods to set and clear proxy override - std::string SetProxyOverride( - const std::vector<net::ProxyConfigServiceAndroid::ProxyOverrideRule>& - proxy_rules, - const std::vector<std::string>& bypass_rules, - base::OnceClosure callback); - void ClearProxyOverride(base::OnceClosure callback); - - private: - friend class AwBrowserContext; - friend class AwURLRequestContextGetterTest; - ~AwURLRequestContextGetter() override; - - // Prior to GetURLRequestContext() being called, this is called to hand over - // the objects that GetURLRequestContext() will later install into - // |job_factory_|. This ordering is enforced by having - // AwBrowserContext::CreateRequestContext() call this method. - // This method is necessary because the passed in objects are created - // on the UI thread while |job_factory_| must be created on the IO thread. - void SetHandlersAndInterceptors( - content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors); - - void InitializeURLRequestContext(); - - // This is called to create a HttpAuthHandlerFactory that will handle - // auth challenges for the new URLRequestContext - std::unique_ptr<net::HttpAuthHandlerFactory> CreateAuthHandlerFactory(); - - // Update methods for the auth related preferences - void UpdateServerAllowlist(); - void UpdateAndroidAuthNegotiateAccountType(); - - const base::FilePath cache_path_; - - net::NetLog* net_log_; - std::unique_ptr<net::ProxyConfigServiceAndroid> proxy_config_service_; - net::ProxyConfigServiceAndroid* proxy_config_service_android_; - std::unique_ptr<net::HttpUserAgentSettings> http_user_agent_settings_; - std::unique_ptr<net::FileNetLogObserver> file_net_log_observer_; - // http_auth_preferences_ holds the preferences for the negotiate - // authenticator. - std::unique_ptr<net::HttpAuthPreferences> http_auth_preferences_; - std::unique_ptr<net::URLRequestContext> url_request_context_; - - // Store HTTP Auth-related policies in this thread. - StringPrefMember auth_android_negotiate_account_type_; - StringPrefMember auth_server_allowlist_; - - // ProtocolHandlers and interceptors are stored here between - // SetHandlersAndInterceptors() and the first GetURLRequestContext() call. - content::ProtocolHandlerMap protocol_handlers_; - content::URLRequestInterceptorScopedVector request_interceptors_; - - DISALLOW_COPY_AND_ASSIGN(AwURLRequestContextGetter); -}; - -} // namespace android_webview - -#endif // ANDROID_WEBVIEW_BROWSER_NET_AW_URL_REQUEST_CONTEXT_GETTER_H_
diff --git a/android_webview/browser/net/init_native_callback.cc b/android_webview/browser/net/init_native_callback.cc index ece1dd8..f62a311 100644 --- a/android_webview/browser/net/init_native_callback.cc +++ b/android_webview/browser/net/init_native_callback.cc
@@ -4,10 +4,8 @@ #include "android_webview/browser/net/init_native_callback.h" -#include "android_webview/browser/android_protocol_handler.h" #include "base/callback.h" #include "base/single_thread_task_runner.h" -#include "net/url_request/url_request_interceptor.h" namespace android_webview { @@ -15,14 +13,4 @@ GetCookieStoreTaskRunner()->PostTask(FROM_HERE, std::move(task)); } -std::unique_ptr<net::URLRequestInterceptor> -CreateAndroidAssetFileRequestInterceptor() { - return CreateAssetFileRequestInterceptor(); -} - -std::unique_ptr<net::URLRequestInterceptor> -CreateAndroidContentRequestInterceptor() { - return CreateContentSchemeRequestInterceptor(); -} - } // namespace android_webview
diff --git a/android_webview/browser/net/init_native_callback.h b/android_webview/browser/net/init_native_callback.h index eb3d8b9..e6c8ab11 100644 --- a/android_webview/browser/net/init_native_callback.h +++ b/android_webview/browser/net/init_native_callback.h
@@ -15,7 +15,6 @@ namespace net { class CookieStore; -class URLRequestInterceptor; } // namespace net namespace android_webview { @@ -31,14 +30,6 @@ // CookieStore's TaskRunner. net::CookieStore* GetCookieStore(); -// Called lazily when the job factory is being constructed. -std::unique_ptr<net::URLRequestInterceptor> -CreateAndroidAssetFileRequestInterceptor(); - -// Called lazily when the job factory is being constructed. -std::unique_ptr<net::URLRequestInterceptor> -CreateAndroidContentRequestInterceptor(); - } // namespace android_webview #endif // ANDROID_WEBVIEW_BROWSER_NET_INIT_NATIVE_CALLBACK_H_
diff --git a/android_webview/browser/network_service/android_stream_reader_url_loader.cc b/android_webview/browser/network_service/android_stream_reader_url_loader.cc index d3aa7e55..06905c6b 100644 --- a/android_webview/browser/network_service/android_stream_reader_url_loader.cc +++ b/android_webview/browser/network_service/android_stream_reader_url_loader.cc
@@ -6,7 +6,7 @@ #include "android_webview/browser/aw_feature_list.h" #include "android_webview/browser/input_stream.h" -#include "android_webview/browser/net/input_stream_reader.h" +#include "android_webview/browser/network_service/input_stream_reader.h" #include "base/bind.h" #include "base/callback.h" #include "base/feature_list.h"
diff --git a/android_webview/browser/network_service/android_stream_reader_url_loader.h b/android_webview/browser/network_service/android_stream_reader_url_loader.h index 1725817..35583c2f 100644 --- a/android_webview/browser/network_service/android_stream_reader_url_loader.h +++ b/android_webview/browser/network_service/android_stream_reader_url_loader.h
@@ -5,7 +5,7 @@ #ifndef ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_ANDROID_STREAM_READER_URL_LOADER_H_ #define ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_ANDROID_STREAM_READER_URL_LOADER_H_ -#include "android_webview/browser/net/aw_web_resource_response.h" +#include "android_webview/browser/network_service/aw_web_resource_response.h" #include "base/threading/thread_checker.h" #include "mojo/public/cpp/system/simple_watcher.h" #include "net/http/http_byte_range.h"
diff --git a/android_webview/browser/net/aw_network_change_notifier.cc b/android_webview/browser/network_service/aw_network_change_notifier.cc similarity index 97% rename from android_webview/browser/net/aw_network_change_notifier.cc rename to android_webview/browser/network_service/aw_network_change_notifier.cc index f91aefc..20f2125 100644 --- a/android_webview/browser/net/aw_network_change_notifier.cc +++ b/android_webview/browser/network_service/aw_network_change_notifier.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "android_webview/browser/net/aw_network_change_notifier.h" +#include "android_webview/browser/network_service/aw_network_change_notifier.h" namespace android_webview {
diff --git a/android_webview/browser/net/aw_network_change_notifier.h b/android_webview/browser/network_service/aw_network_change_notifier.h similarity index 91% rename from android_webview/browser/net/aw_network_change_notifier.h rename to android_webview/browser/network_service/aw_network_change_notifier.h index 6fc25b0..ce2c2af 100644 --- a/android_webview/browser/net/aw_network_change_notifier.h +++ b/android_webview/browser/network_service/aw_network_change_notifier.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef ANDROID_WEBVIEW_BROWSER_NET_AW_NETWORK_CHANGE_NOTIFIER_H_ -#define ANDROID_WEBVIEW_BROWSER_NET_AW_NETWORK_CHANGE_NOTIFIER_H_ +#ifndef ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_AW_NETWORK_CHANGE_NOTIFIER_H_ +#define ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_AW_NETWORK_CHANGE_NOTIFIER_H_ #include "base/compiler_specific.h" #include "base/macros.h" @@ -63,4 +63,4 @@ } // namespace android_webview -#endif // ANDROID_WEBVIEW_BROWSER_NET_AW_NETWORK_CHANGE_NOTIFIER_H_ +#endif // ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_AW_NETWORK_CHANGE_NOTIFIER_H_
diff --git a/android_webview/browser/net/aw_network_change_notifier_factory.cc b/android_webview/browser/network_service/aw_network_change_notifier_factory.cc similarity index 77% rename from android_webview/browser/net/aw_network_change_notifier_factory.cc rename to android_webview/browser/network_service/aw_network_change_notifier_factory.cc index 9821511..ac2b4f9 100644 --- a/android_webview/browser/net/aw_network_change_notifier_factory.cc +++ b/android_webview/browser/network_service/aw_network_change_notifier_factory.cc
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "android_webview/browser/net/aw_network_change_notifier_factory.h" +#include "android_webview/browser/network_service/aw_network_change_notifier_factory.h" -#include "android_webview/browser/net/aw_network_change_notifier.h" +#include "android_webview/browser/network_service/aw_network_change_notifier.h" #include "base/memory/ptr_util.h" namespace android_webview {
diff --git a/android_webview/browser/net/aw_network_change_notifier_factory.h b/android_webview/browser/network_service/aw_network_change_notifier_factory.h similarity index 81% rename from android_webview/browser/net/aw_network_change_notifier_factory.h rename to android_webview/browser/network_service/aw_network_change_notifier_factory.h index a6b02cf4..4698098 100644 --- a/android_webview/browser/net/aw_network_change_notifier_factory.h +++ b/android_webview/browser/network_service/aw_network_change_notifier_factory.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef ANDROID_WEBVIEW_BROWSER_NET_AW_NETWORK_CHANGE_NOTIFIER_FACTORY_H_ -#define ANDROID_WEBVIEW_BROWSER_NET_AW_NETWORK_CHANGE_NOTIFIER_FACTORY_H_ +#ifndef ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_AW_NETWORK_CHANGE_NOTIFIER_FACTORY_H_ +#define ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_AW_NETWORK_CHANGE_NOTIFIER_FACTORY_H_ #include <memory> @@ -40,4 +40,4 @@ } // namespace android_webview -#endif // ANDROID_WEBVIEW_BROWSER_NET_AW_NETWORK_CHANGE_NOTIFIER_FACTORY_H_ +#endif // ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_AW_NETWORK_CHANGE_NOTIFIER_FACTORY_H_
diff --git a/android_webview/browser/network_service/aw_proxying_url_loader_factory.cc b/android_webview/browser/network_service/aw_proxying_url_loader_factory.cc index 2bd36cb..f604085 100644 --- a/android_webview/browser/network_service/aw_proxying_url_loader_factory.cc +++ b/android_webview/browser/network_service/aw_proxying_url_loader_factory.cc
@@ -11,8 +11,8 @@ #include "android_webview/browser/aw_contents_io_thread_client.h" #include "android_webview/browser/aw_cookie_access_policy.h" #include "android_webview/browser/input_stream.h" -#include "android_webview/browser/net/aw_web_resource_response.h" #include "android_webview/browser/network_service/android_stream_reader_url_loader.h" +#include "android_webview/browser/network_service/aw_web_resource_response.h" #include "android_webview/browser/network_service/net_helpers.h" #include "android_webview/browser/renderer_host/auto_login_parser.h" #include "android_webview/common/url_constants.h"
diff --git a/android_webview/browser/net/aw_web_resource_request.cc b/android_webview/browser/network_service/aw_web_resource_request.cc similarity index 97% rename from android_webview/browser/net/aw_web_resource_request.cc rename to android_webview/browser/network_service/aw_web_resource_request.cc index aac972f..0052f142 100644 --- a/android_webview/browser/net/aw_web_resource_request.cc +++ b/android_webview/browser/network_service/aw_web_resource_request.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "android_webview/browser/net/aw_web_resource_request.h" +#include "android_webview/browser/network_service/aw_web_resource_request.h" #include "content/public/common/resource_type.h" #include "net/http/http_request_headers.h"
diff --git a/android_webview/browser/net/aw_web_resource_request.h b/android_webview/browser/network_service/aw_web_resource_request.h similarity index 90% rename from android_webview/browser/net/aw_web_resource_request.h rename to android_webview/browser/network_service/aw_web_resource_request.h index 3bd94f6..b094bab 100644 --- a/android_webview/browser/net/aw_web_resource_request.h +++ b/android_webview/browser/network_service/aw_web_resource_request.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef ANDROID_WEBVIEW_BROWSER_NET_AW_WEB_RESOURCE_REQUEST_H_ -#define ANDROID_WEBVIEW_BROWSER_NET_AW_WEB_RESOURCE_REQUEST_H_ +#ifndef ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_AW_WEB_RESOURCE_REQUEST_H_ +#define ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_AW_WEB_RESOURCE_REQUEST_H_ #include <string> #include <vector> @@ -67,4 +67,4 @@ } // namespace android_webview -#endif // ANDROID_WEBVIEW_BROWSER_NET_AW_WEB_RESOURCE_REQUEST_H_ +#endif // ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_AW_WEB_RESOURCE_REQUEST_H_
diff --git a/android_webview/browser/net/aw_web_resource_response.cc b/android_webview/browser/network_service/aw_web_resource_response.cc similarity index 97% rename from android_webview/browser/net/aw_web_resource_response.cc rename to android_webview/browser/network_service/aw_web_resource_response.cc index 4bc5609e..d3457e9 100644 --- a/android_webview/browser/net/aw_web_resource_response.cc +++ b/android_webview/browser/network_service/aw_web_resource_response.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "android_webview/browser/net/aw_web_resource_response.h" +#include "android_webview/browser/network_service/aw_web_resource_response.h" #include <memory>
diff --git a/android_webview/browser/net/aw_web_resource_response.h b/android_webview/browser/network_service/aw_web_resource_response.h similarity index 87% rename from android_webview/browser/net/aw_web_resource_response.h rename to android_webview/browser/network_service/aw_web_resource_response.h index 5522ad4..08386424 100644 --- a/android_webview/browser/net/aw_web_resource_response.h +++ b/android_webview/browser/network_service/aw_web_resource_response.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef ANDROID_WEBVIEW_BROWSER_NET_AW_WEB_RESOURCE_RESPONSE_H_ -#define ANDROID_WEBVIEW_BROWSER_NET_AW_WEB_RESOURCE_RESPONSE_H_ +#ifndef ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_AW_WEB_RESOURCE_RESPONSE_H_ +#define ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_AW_WEB_RESOURCE_RESPONSE_H_ #include <memory> #include <string> @@ -54,4 +54,4 @@ } // namespace android_webview -#endif // ANDROID_WEBVIEW_BROWSER_NET_AW_WEB_RESOURCE_RESPONSE_H_ +#endif // ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_AW_WEB_RESOURCE_RESPONSE_H_
diff --git a/android_webview/browser/net/input_stream_reader.cc b/android_webview/browser/network_service/input_stream_reader.cc similarity index 96% rename from android_webview/browser/net/input_stream_reader.cc rename to android_webview/browser/network_service/input_stream_reader.cc index 85f45a82..4ec0489 100644 --- a/android_webview/browser/net/input_stream_reader.cc +++ b/android_webview/browser/network_service/input_stream_reader.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "android_webview/browser/net/input_stream_reader.h" +#include "android_webview/browser/network_service/input_stream_reader.h" #include "android_webview/browser/input_stream.h" #include "content/public/browser/browser_thread.h"
diff --git a/android_webview/browser/net/input_stream_reader.h b/android_webview/browser/network_service/input_stream_reader.h similarity index 89% rename from android_webview/browser/net/input_stream_reader.h rename to android_webview/browser/network_service/input_stream_reader.h index 56df3cd..41a818da 100644 --- a/android_webview/browser/net/input_stream_reader.h +++ b/android_webview/browser/network_service/input_stream_reader.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef ANDROID_WEBVIEW_BROWSER_NET_INPUT_STREAM_READER_H_ -#define ANDROID_WEBVIEW_BROWSER_NET_INPUT_STREAM_READER_H_ +#ifndef ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_INPUT_STREAM_READER_H_ +#define ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_INPUT_STREAM_READER_H_ #include "base/macros.h" #include "base/memory/ref_counted.h" @@ -59,4 +59,4 @@ } // namespace android_webview -#endif // ANDROID_WEBVIEW_BROWSER_NET_INPUT_STREAM_READER_H_ +#endif // ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_INPUT_STREAM_READER_H_
diff --git a/android_webview/browser/net/input_stream_reader_unittest.cc b/android_webview/browser/network_service/input_stream_reader_unittest.cc similarity index 98% rename from android_webview/browser/net/input_stream_reader_unittest.cc rename to android_webview/browser/network_service/input_stream_reader_unittest.cc index 3125579..4fe855fb 100644 --- a/android_webview/browser/net/input_stream_reader_unittest.cc +++ b/android_webview/browser/network_service/input_stream_reader_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "android_webview/browser/net/input_stream_reader.h" +#include "android_webview/browser/network_service/input_stream_reader.h" #include "android_webview/browser/input_stream.h" #include "base/android/scoped_java_ref.h"
diff --git a/android_webview/browser/safe_browsing/aw_safe_browsing_ui_manager.cc b/android_webview/browser/safe_browsing/aw_safe_browsing_ui_manager.cc index 4bb7504d..e28a7bf 100644 --- a/android_webview/browser/safe_browsing/aw_safe_browsing_ui_manager.cc +++ b/android_webview/browser/safe_browsing/aw_safe_browsing_ui_manager.cc
@@ -19,7 +19,6 @@ #include "components/safe_browsing/ping_manager.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" -#include "services/network/public/cpp/features.h" #include "services/network/public/mojom/network_service.mojom.h" using content::BrowserThread;
diff --git a/android_webview/browser/safe_browsing/aw_url_checker_delegate_impl.cc b/android_webview/browser/safe_browsing/aw_url_checker_delegate_impl.cc index 99271761..22f48169 100644 --- a/android_webview/browser/safe_browsing/aw_url_checker_delegate_impl.cc +++ b/android_webview/browser/safe_browsing/aw_url_checker_delegate_impl.cc
@@ -7,7 +7,7 @@ #include "android_webview/browser/aw_browser_context.h" #include "android_webview/browser/aw_contents_client_bridge.h" #include "android_webview/browser/aw_contents_io_thread_client.h" -#include "android_webview/browser/net/aw_web_resource_request.h" +#include "android_webview/browser/network_service/aw_web_resource_request.h" #include "android_webview/browser/safe_browsing/aw_safe_browsing_ui_manager.h" #include "android_webview/browser/safe_browsing/aw_safe_browsing_whitelist_manager.h" #include "base/bind.h"
diff --git a/android_webview/java/src/org/chromium/android_webview/ScopedSysTraceEvent.java b/android_webview/java/src/org/chromium/android_webview/ScopedSysTraceEvent.java deleted file mode 100644 index 004067a..0000000 --- a/android_webview/java/src/org/chromium/android_webview/ScopedSysTraceEvent.java +++ /dev/null
@@ -1,43 +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. - -package org.chromium.android_webview; - -import android.os.Trace; - -// TODO(changwan): remove this file once downstream change lands. -/** - * An alternative to @{TraceEvent} that allows us to trace events before native - * initialization. - * - * Note that TraceEvent / EarlyTraceEvent cannot be used before native initialization since - * it directly purges to the kernel debug message but that method does not allow tracing events - * to be written *after* the event occurrence. - */ -public class ScopedSysTraceEvent implements AutoCloseable { - /** - * Factory used to support the "try with resource" construct. - * Note that currently this is the only allowed pattern. However, this requires heap allocation - * so we may consider calling Trace.beginSection() / endSection() directly if it should be used - * repeatedly. - * - * @param name Trace event name. - * @return a {@ScopedSysTraceEvent}, or null if tracing is not enabled. - */ - public static ScopedSysTraceEvent scoped(String name) { - return new ScopedSysTraceEvent(name); - } - - /** - * Constructor used to support the "try with resource" construct. - */ - private ScopedSysTraceEvent(String name) { - Trace.beginSection(name); - } - - @Override - public void close() { - Trace.endSection(); - } -}
diff --git a/android_webview/java/src/org/chromium/android_webview/ui/util/UnuploadedFilesStateLoader.java b/android_webview/java/src/org/chromium/android_webview/ui/util/UnuploadedFilesStateLoader.java new file mode 100644 index 0000000..4f4dc3d7 --- /dev/null +++ b/android_webview/java/src/org/chromium/android_webview/ui/util/UnuploadedFilesStateLoader.java
@@ -0,0 +1,62 @@ +// Copyright 2019 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. +package org.chromium.android_webview.ui.util; + +import org.chromium.components.minidump_uploader.CrashFileManager; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +/** + * Gets crashes info about unuploaded minidump files in crash directory. + * Minidump file name contains information about the upload state of the file, its local id and + * number of trials of upload for that report. + */ +public class UnuploadedFilesStateLoader extends CrashInfoLoader { + private CrashFileManager mCrashFileManager; + + /** + * @param crashDir the directory where WebView stores crash reports files. + */ + public UnuploadedFilesStateLoader(CrashFileManager crashFileManager) { + mCrashFileManager = crashFileManager; + } + + /** + * Get info about unuploaded crash reports and their state. + * Uses file suffixes to get the upload state of a crash report. For more about crash files + * suffixes see docs for {@link CrashFileManager}. + * + * @return list of crashes info. + */ + @Override + public List<CrashInfo> loadCrashesInfo() { + List<CrashInfo> crashes = new ArrayList<>(); + + for (File file : mCrashFileManager.getMinidumpsNotForcedReadyForUpload()) { + addCrashInfoIfValid(crashes, file.getName(), UploadState.PENDING); + } + + for (File file : mCrashFileManager.getMinidumpsForcedUpload()) { + addCrashInfoIfValid(crashes, file.getName(), UploadState.PENDING_USER_REQUESTED); + } + + for (File file : mCrashFileManager.getMinidumpsSkippedUpload()) { + addCrashInfoIfValid(crashes, file.getName(), UploadState.SKIPPED); + } + + return crashes; + } + + private void addCrashInfoIfValid( + List<CrashInfo> crashesList, String fileName, UploadState state) { + String localId = CrashFileManager.getCrashLocalIdFromFileName(fileName); + if (localId != null) { + CrashInfo crashInfo = new CrashInfo(localId); + crashInfo.uploadState = state; + crashesList.add(crashInfo); + } + } +}
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/ui/util/UnuploadedFilesStateLoaderTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/ui/util/UnuploadedFilesStateLoaderTest.java new file mode 100644 index 0000000..ac62392f9 --- /dev/null +++ b/android_webview/javatests/src/org/chromium/android_webview/test/ui/util/UnuploadedFilesStateLoaderTest.java
@@ -0,0 +1,118 @@ +// Copyright 2019 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. + +package org.chromium.android_webview.test.ui.util; + +import static org.chromium.android_webview.test.OnlyRunIn.ProcessMode.SINGLE_PROCESS; + +import android.support.test.filters.SmallTest; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; +import org.junit.runner.RunWith; + +import org.chromium.android_webview.test.AwJUnit4ClassRunner; +import org.chromium.android_webview.test.OnlyRunIn; +import org.chromium.android_webview.ui.util.CrashInfoLoader.CrashInfo; +import org.chromium.android_webview.ui.util.CrashInfoLoader.UploadState; +import org.chromium.android_webview.ui.util.UnuploadedFilesStateLoader; +import org.chromium.components.minidump_uploader.CrashFileManager; + +import java.io.File; +import java.io.IOException; +import java.util.List; + +/** + * Unit tests for UnuploadedFilesStateLoader. + */ +@RunWith(AwJUnit4ClassRunner.class) +@OnlyRunIn(SINGLE_PROCESS) +public class UnuploadedFilesStateLoaderTest { + private static final String LOCAL_ID = "localId1234"; + private static final String TEST_FILE_NAME = "test_file-" + LOCAL_ID; + + @Rule + public TemporaryFolder mTestCacheDir = new TemporaryFolder(); + + private File mTestCrashDir; + private CrashFileManager mCrashFileManager; + private UnuploadedFilesStateLoader mCrashInfoLoader; + + @Before + public void setup() { + mCrashFileManager = new CrashFileManager(mTestCacheDir.getRoot()); + mCrashInfoLoader = new UnuploadedFilesStateLoader(mCrashFileManager); + mTestCrashDir = mCrashFileManager.getCrashDirectory(); + mTestCrashDir.mkdirs(); + } + + @Test + @SmallTest + public void testParseEmptyDir() throws IOException { + List<CrashInfo> crashInfoList = mCrashInfoLoader.loadCrashesInfo(); + Assert.assertEquals(0, crashInfoList.size()); + } + + @Test + @SmallTest + public void testParseSkippedFiles() throws IOException { + new File(mTestCrashDir, TEST_FILE_NAME + ".skipped.try0").createNewFile(); + new File(mTestCrashDir, TEST_FILE_NAME + ".skipped5673.try1").createNewFile(); + new File(mTestCrashDir, TEST_FILE_NAME + ".skipped5678.try30").createNewFile(); + + List<CrashInfo> crashInfoList = mCrashInfoLoader.loadCrashesInfo(); + Assert.assertEquals(3, crashInfoList.size()); + + for (CrashInfo crashInfo : crashInfoList) { + Assert.assertEquals(crashInfo.localId, LOCAL_ID); + Assert.assertEquals(crashInfo.uploadState, UploadState.SKIPPED); + } + } + + @Test + @SmallTest + public void testParsePendingFiles() throws IOException { + new File(mTestCrashDir, TEST_FILE_NAME + ".dmp.try0").createNewFile(); + new File(mTestCrashDir, TEST_FILE_NAME + ".dmp5678.try1").createNewFile(); + new File(mTestCrashDir, TEST_FILE_NAME + ".dmp5678.try30").createNewFile(); + + List<CrashInfo> crashInfoList = mCrashInfoLoader.loadCrashesInfo(); + Assert.assertEquals(3, crashInfoList.size()); + + for (CrashInfo crashInfo : crashInfoList) { + Assert.assertEquals(crashInfo.localId, LOCAL_ID); + Assert.assertEquals(crashInfo.uploadState, UploadState.PENDING); + } + } + + @Test + @SmallTest + public void testParseForcedUploadFiles() throws IOException { + new File(mTestCrashDir, TEST_FILE_NAME + ".forced.try0").createNewFile(); + new File(mTestCrashDir, TEST_FILE_NAME + ".forced5678.try1").createNewFile(); + new File(mTestCrashDir, TEST_FILE_NAME + ".forced5678.try30").createNewFile(); + + List<CrashInfo> crashInfoList = mCrashInfoLoader.loadCrashesInfo(); + Assert.assertEquals(3, crashInfoList.size()); + + for (CrashInfo crashInfo : crashInfoList) { + Assert.assertEquals(crashInfo.localId, LOCAL_ID); + Assert.assertEquals(crashInfo.uploadState, UploadState.PENDING_USER_REQUESTED); + } + } + + @Test + @SmallTest + public void testParseFilesWithInvalidSuffixes() throws IOException { + new File(mTestCrashDir, TEST_FILE_NAME + ".log").createNewFile(); + new File(mTestCrashDir, TEST_FILE_NAME + ".json1232").createNewFile(); + new File(mTestCrashDir, TEST_FILE_NAME + ".log.try30").createNewFile(); + + List<CrashInfo> crashInfoList = mCrashInfoLoader.loadCrashesInfo(); + Assert.assertEquals(0, crashInfoList.size()); + } +}
diff --git a/android_webview/renderer/aw_url_loader_throttle_provider.cc b/android_webview/renderer/aw_url_loader_throttle_provider.cc index dc77047..0d69f16a 100644 --- a/android_webview/renderer/aw_url_loader_throttle_provider.cc +++ b/android_webview/renderer/aw_url_loader_throttle_provider.cc
@@ -12,7 +12,6 @@ #include "content/public/common/content_features.h" #include "content/public/common/service_names.mojom.h" #include "content/public/renderer/render_thread.h" -#include "services/network/public/cpp/features.h" #include "services/service_manager/public/cpp/connector.h" namespace android_webview { @@ -22,12 +21,9 @@ : type_(type) { DETACH_FROM_THREAD(thread_checker_); - if (base::FeatureList::IsEnabled(network::features::kNetworkService) || - base::FeatureList::IsEnabled(safe_browsing::kCheckByURLLoaderThrottle)) { - content::RenderThread::Get()->GetConnector()->BindInterface( - content::mojom::kBrowserServiceName, - mojo::MakeRequest(&safe_browsing_info_)); - } + content::RenderThread::Get()->GetConnector()->BindInterface( + content::mojom::kBrowserServiceName, + mojo::MakeRequest(&safe_browsing_info_)); } AwURLLoaderThrottleProvider::AwURLLoaderThrottleProvider( @@ -59,8 +55,6 @@ std::vector<std::unique_ptr<blink::URLLoaderThrottle>> throttles; - bool network_service_enabled = - base::FeatureList::IsEnabled(network::features::kNetworkService); // Some throttles have already been added in the browser for frame resources. // Don't add them for frame requests. bool is_frame_resource = content::IsResourceTypeFrame(resource_type); @@ -68,10 +62,7 @@ DCHECK(!is_frame_resource || type_ == content::URLLoaderThrottleProviderType::kFrame); - if ((network_service_enabled || - base::FeatureList::IsEnabled( - safe_browsing::kCheckByURLLoaderThrottle)) && - !is_frame_resource) { + if (!is_frame_resource) { if (safe_browsing_info_) safe_browsing_.Bind(std::move(safe_browsing_info_)); throttles.push_back(
diff --git a/android_webview/renderer/aw_websocket_handshake_throttle_provider.cc b/android_webview/renderer/aw_websocket_handshake_throttle_provider.cc index 13963be..ae56aa20 100644 --- a/android_webview/renderer/aw_websocket_handshake_throttle_provider.cc +++ b/android_webview/renderer/aw_websocket_handshake_throttle_provider.cc
@@ -12,7 +12,6 @@ #include "content/public/common/content_features.h" #include "content/public/common/service_names.mojom.h" #include "content/public/renderer/render_thread.h" -#include "services/network/public/cpp/features.h" #include "services/service_manager/public/cpp/connector.h" #include "third_party/blink/public/platform/websocket_handshake_throttle.h" @@ -20,8 +19,6 @@ AwWebSocketHandshakeThrottleProvider::AwWebSocketHandshakeThrottleProvider() { DETACH_FROM_THREAD(thread_checker_); - if (!base::FeatureList::IsEnabled(network::features::kNetworkService)) - return; content::RenderThread::Get()->GetConnector()->BindInterface( content::mojom::kBrowserServiceName, mojo::MakeRequest(&safe_browsing_info_)); @@ -52,8 +49,6 @@ int render_frame_id, scoped_refptr<base::SingleThreadTaskRunner> task_runner) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - if (!base::FeatureList::IsEnabled(network::features::kNetworkService)) - return nullptr; if (safe_browsing_info_) safe_browsing_.Bind(std::move(safe_browsing_info_), std::move(task_runner)); return std::make_unique<safe_browsing::WebSocketSBHandshakeThrottle>(
diff --git a/android_webview/test/BUILD.gn b/android_webview/test/BUILD.gn index e8c5340..d9f16a22 100644 --- a/android_webview/test/BUILD.gn +++ b/android_webview/test/BUILD.gn
@@ -282,6 +282,7 @@ "../javatests/src/org/chromium/android_webview/test/services/MockVariationsSeedServer.java", "../javatests/src/org/chromium/android_webview/test/services/VariationsSeedServerTest.java", "../javatests/src/org/chromium/android_webview/test/services/VisualStateCallbackTest.java", + "../javatests/src/org/chromium/android_webview/test/ui/util/UnuploadedFilesStateLoaderTest.java", "../javatests/src/org/chromium/android_webview/test/ui/util/UploadedCrashesInfoLoaderTest.java", "../javatests/src/org/chromium/android_webview/test/ui/util/WebViewCrashLogParserTest.java", "../javatests/src/org/chromium/android_webview/test/util/AwQuotaManagerBridgeTestUtil.java", @@ -375,8 +376,8 @@ "../browser/gfx/test/rendering_test.h", "../browser/input_stream_unittest.cc", "../browser/net/aw_cookie_store_wrapper_unittest.cc", - "../browser/net/input_stream_reader_unittest.cc", "../browser/network_service/android_stream_reader_url_loader_unittest.cc", + "../browser/network_service/input_stream_reader_unittest.cc", "../browser/permission/media_access_permission_request_unittest.cc", "../browser/permission/permission_request_handler_unittest.cc", "../browser/renderer_host/auto_login_parser_unittest.cc",
diff --git a/ash/accessibility/accessibility_panel_layout_manager.cc b/ash/accessibility/accessibility_panel_layout_manager.cc index 03d2462..0700a9d 100644 --- a/ash/accessibility/accessibility_panel_layout_manager.cc +++ b/ash/accessibility/accessibility_panel_layout_manager.cc
@@ -112,13 +112,6 @@ } else if (panel_state_ == AccessibilityPanelState::FULL_WIDTH) { bounds.set_x(0); bounds.set_width(root_window->bounds().width()); - - // TODO(isandrk, crbug.com/959786): Temporary fix that prevents ChromeVox - // panel from showing up in locked fullscreen mode (the panel was enabling - // an escape from locked mode crbug.com/957950). Remove once a more proper - // fix exists. - if (Shell::Get()->screen_pinning_controller()->IsPinned()) - bounds.set_height(0); } // If a fullscreen browser window is open, give the panel a height of 0
diff --git a/ash/screen_util_unittest.cc b/ash/screen_util_unittest.cc index 75464fa..6fcaf00 100644 --- a/ash/screen_util_unittest.cc +++ b/ash/screen_util_unittest.cc
@@ -6,6 +6,8 @@ #include <memory> +#include "ash/accessibility/accessibility_controller_impl.h" +#include "ash/accessibility/accessibility_panel_layout_manager.h" #include "ash/magnifier/docked_magnifier_controller_impl.h" #include "ash/root_window_controller.h" #include "ash/shelf/shelf.h" @@ -26,6 +28,33 @@ namespace ash { +namespace { + +AccessibilityPanelLayoutManager* GetLayoutManager() { + aura::Window* container = + Shell::GetContainer(Shell::GetPrimaryRootWindow(), + kShellWindowId_AccessibilityPanelContainer); + return static_cast<AccessibilityPanelLayoutManager*>( + container->layout_manager()); +} + +// Simulates Chrome creating the ChromeVoxPanel widget. +std::unique_ptr<views::Widget> CreateChromeVoxPanel() { + std::unique_ptr<views::Widget> widget = std::make_unique<views::Widget>(); + views::Widget::InitParams params( + views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); + params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; + aura::Window* root_window = Shell::GetPrimaryRootWindow(); + params.parent = Shell::GetContainer( + root_window, kShellWindowId_AccessibilityPanelContainer); + params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; + params.bounds = gfx::Rect(root_window->bounds().size()); + + widget->Init(std::move(params)); + return widget; +} +} // namespace + using ScreenUtilTest = AshTestBase; TEST_F(ScreenUtilTest, Bounds) { @@ -250,4 +279,28 @@ EXPECT_EQ(expected_bounds, window->bounds()); } +// Tests that making a window fullscreen while the chromevox is enabled won't +// create an empty bar instead of the chromevox panel, but the fullscreened +// window will take the whole screen size. +TEST_F(ScreenUtilTest, FullscreenWindowBoundsWithChromeVox) { + UpdateDisplay("1366x768"); + + // Create ChromeVox Panel + AccessibilityPanelLayoutManager* layout_manager = GetLayoutManager(); + std::unique_ptr<views::Widget> widget = CreateChromeVoxPanel(); + widget->Show(); + layout_manager->SetPanelBounds( + gfx::Rect(0, 0, 0, AccessibilityPanelLayoutManager::kDefaultPanelHeight), + AccessibilityPanelState::FULL_WIDTH); + + std::unique_ptr<aura::Window> window = CreateToplevelTestWindow( + gfx::Rect(300, 300, 200, 150), desks_util::GetActiveDeskContainerId()); + + const WMEvent event(WM_EVENT_TOGGLE_FULLSCREEN); + WindowState::Get(window.get())->OnWMEvent(&event); + + constexpr gfx::Rect kDisplayBounds{1366, 768}; + EXPECT_EQ(window->bounds(), kDisplayBounds); +} + } // namespace ash
diff --git a/ash/system/message_center/unified_message_center_view.cc b/ash/system/message_center/unified_message_center_view.cc index b7c2e152..b809674 100644 --- a/ash/system/message_center/unified_message_center_view.cc +++ b/ash/system/message_center/unified_message_center_view.cc
@@ -51,9 +51,13 @@ public: ScrollerContentsView(UnifiedMessageListView* message_list_view, views::ButtonListener* listener) { + int bottom_padding = features::IsUnifiedMessageCenterRefactorEnabled() + ? 0 + : kUnifiedNotificationCenterSpacing; + auto* contents_layout = SetLayoutManager(std::make_unique<views::BoxLayout>( views::BoxLayout::Orientation::kVertical, - gfx::Insets(0, 0, kUnifiedNotificationCenterSpacing, 0))); + gfx::Insets(0, 0, bottom_padding, 0))); contents_layout->set_cross_axis_alignment( views::BoxLayout::CrossAxisAlignment::kStretch); AddChildView(message_list_view); @@ -293,7 +297,10 @@ } void UnifiedMessageCenterView::SetMaxHeight(int max_height) { - scroller_->ClipHeightTo(0, max_height); + int max_scroller_height = max_height; + if (stacking_counter_->GetVisible()) + max_scroller_height -= kStackingNotificationCounterHeight; + scroller_->ClipHeightTo(0, max_scroller_height); } void UnifiedMessageCenterView::SetAvailableHeight(int available_height) { @@ -313,6 +320,10 @@ void UnifiedMessageCenterView::ListPreferredSizeChanged() { UpdateVisibility(); PreferredSizeChanged(); + + if (features::IsUnifiedMessageCenterRefactorEnabled()) + SetMaxHeight(available_height_); + Layout(); if (GetWidget() && !GetWidget()->IsClosed())
diff --git a/ash/wm/default_state.cc b/ash/wm/default_state.cc index ec5719b0..026940b 100644 --- a/ash/wm/default_state.cc +++ b/ash/wm/default_state.cc
@@ -584,11 +584,9 @@ if (IsMinimizedWindowStateType(previous_state_type) || window_state->IsFullscreen() || window_state->IsPinned() || - enter_animation_type() == IMMEDIATE) { + window_state->bounds_animation_type() == + WindowState::BoundsChangeAnimationType::IMMEDIATE) { window_state->SetBoundsDirect(bounds_in_parent); - // Reset the |enter_animation_type_| to DEFAULT if it is IMMEDIATE, which is - // set for non-top windows when entering clamshell mode. - set_enter_animation_type(DEFAULT); } else if (window_state->IsMaximized() || IsMaximizedOrFullscreenOrPinnedWindowStateType( previous_state_type)) {
diff --git a/ash/wm/desks/desk_mini_view.cc b/ash/wm/desks/desk_mini_view.cc index e747cf5..15e5e893 100644 --- a/ash/wm/desks/desk_mini_view.cc +++ b/ash/wm/desks/desk_mini_view.cc
@@ -222,12 +222,10 @@ return this; } -gfx::Rect DeskMiniView::GetHighlightBounds() { - // Use the target bounds instead of |GetBoundsInScreen()| because |this| may - // be animating. - gfx::Rect target_bounds = layer()->GetTargetBounds(); - ::wm::ConvertRectFromScreen(root_window_, &target_bounds); - return target_bounds; +gfx::Rect DeskMiniView::GetHighlightBoundsInScreen() { + gfx::Rect bounds_in_screen = bounds(); + views::View::ConvertRectToScreen(this->parent(), &bounds_in_screen); + return bounds_in_screen; } bool DeskMiniView::IsPointOnMiniView(const gfx::Point& screen_location) const {
diff --git a/ash/wm/desks/desk_mini_view.h b/ash/wm/desks/desk_mini_view.h index f3ebdc8..d923d0e0 100644 --- a/ash/wm/desks/desk_mini_view.h +++ b/ash/wm/desks/desk_mini_view.h
@@ -77,7 +77,7 @@ // OverviewHighlightController::OverviewHighlightableView: views::View* GetView() override; - gfx::Rect GetHighlightBounds() override; + gfx::Rect GetHighlightBoundsInScreen() override; bool IsPointOnMiniView(const gfx::Point& screen_location) const;
diff --git a/ash/wm/desks/desks_bar_view.cc b/ash/wm/desks/desks_bar_view.cc index 6eb1a1d..8d709e4 100644 --- a/ash/wm/desks/desks_bar_view.cc +++ b/ash/wm/desks/desks_bar_view.cc
@@ -53,6 +53,12 @@ return event.AsGestureEvent()->details().bounding_box(); } +OverviewHighlightController* GetHighlightController() { + auto* overview_controller = Shell::Get()->overview_controller(); + DCHECK(overview_controller->InOverviewSession()); + return overview_controller->overview_session()->highlight_controller(); +} + } // namespace // ----------------------------------------------------------------------------- @@ -268,6 +274,12 @@ DCHECK(iter != mini_views_.end()); + // Let the highlight controller know the view is destroying before it is + // removed from the collection because it needs to know the index of the mini + // view relative to other traversable views. + auto* highlight_controller = GetHighlightController(); + highlight_controller->OnViewDestroying(iter->get()); + const int begin_x = GetFirstMiniViewXOffset(); std::unique_ptr<DeskMiniView> removed_mini_view = std::move(*iter); auto partition_iter = mini_views_.erase(iter); @@ -275,12 +287,11 @@ Layout(); UpdateMiniViewsLabels(); UpdateNewDeskButtonState(); - DCHECK(Shell::Get()->overview_controller()->InOverviewSession()); - auto* highlight_controller = Shell::Get() - ->overview_controller() - ->overview_session() - ->highlight_controller(); - highlight_controller->OnViewDestroying(removed_mini_view.get()); + + // Once the remaining mini views have their bounds updated, notify the + // overview highlight controller so that it can update the focus highlight, if + // needed. + highlight_controller->OnWindowsRepositioned(removed_mini_view->root_window()); std::vector<DeskMiniView*> mini_views_before; std::vector<DeskMiniView*> mini_views_after; @@ -294,15 +305,9 @@ std::transform(partition_iter, mini_views_.end(), std::back_inserter(mini_views_after), transform_lambda); - aura::Window* root_window = removed_mini_view->root_window(); PerformRemoveDeskMiniViewAnimation(std::move(removed_mini_view), mini_views_before, mini_views_after, begin_x - GetFirstMiniViewXOffset()); - - // Once the remaining mini views have their bounds updated, notify the - // overview highlight controller so that it can update the focus highlight, if - // needed. - highlight_controller->OnWindowsRepositioned(root_window); } void DesksBarView::OnDeskActivationChanged(const Desk* activated, @@ -357,6 +362,10 @@ Layout(); + // Update the overview highlight if needed since adding a desk will shift the + // mini views from their current positions. + GetHighlightController()->OnWindowsRepositioned(root_window); + if (!animate) return;
diff --git a/ash/wm/desks/new_desk_button.cc b/ash/wm/desks/new_desk_button.cc index 72c006a..5fe9a5d 100644 --- a/ash/wm/desks/new_desk_button.cc +++ b/ash/wm/desks/new_desk_button.cc
@@ -96,8 +96,12 @@ return this; } -gfx::Rect NewDeskButton::GetHighlightBounds() { +gfx::Rect NewDeskButton::GetHighlightBoundsInScreen() { return GetBoundsInScreen(); } +gfx::RoundedCornersF NewDeskButton::GetRoundedCornersRadii() const { + return gfx::RoundedCornersF(kCornerRadius); +} + } // namespace ash
diff --git a/ash/wm/desks/new_desk_button.h b/ash/wm/desks/new_desk_button.h index 964c2fc..f2ce4e8 100644 --- a/ash/wm/desks/new_desk_button.h +++ b/ash/wm/desks/new_desk_button.h
@@ -35,7 +35,8 @@ // OverviewHighlightController::OverviewHighlightableView: views::View* GetView() override; - gfx::Rect GetHighlightBounds() override; + gfx::Rect GetHighlightBoundsInScreen() override; + gfx::RoundedCornersF GetRoundedCornersRadii() const override; private: DISALLOW_COPY_AND_ASSIGN(NewDeskButton);
diff --git a/ash/wm/overview/caption_container_view.cc b/ash/wm/overview/caption_container_view.cc index d62c668..b5df8f8 100644 --- a/ash/wm/overview/caption_container_view.cc +++ b/ash/wm/overview/caption_container_view.cc
@@ -19,7 +19,6 @@ #include "ui/views/controls/label.h" #include "ui/views/layout/box_layout.h" #include "ui/views/widget/widget.h" -#include "ui/wm/core/coordinate_conversion.h" namespace ash { namespace { @@ -256,13 +255,15 @@ return this; } -gfx::Rect CaptionContainerView::GetHighlightBounds() { +gfx::Rect CaptionContainerView::GetHighlightBoundsInScreen() { // Use the target bounds instead of |GetBoundsInScreen()| because |this| may - // be animating. + // be animating. However, the origin will be incorrect because the windows are + // always positioned above and left of the parents origin, then translated. To + // get the proper origin we use |GetBoundsInScreen()| which takes into account + // the transform (but returns the wrong height and width). auto* window = GetWidget()->GetNativeWindow(); gfx::Rect target_bounds = window->GetTargetBounds(); - target_bounds.set_origin(GetBoundsInScreen().origin()); - ::wm::ConvertRectFromScreen(window->GetRootWindow(), &target_bounds); + target_bounds.set_origin(window->GetBoundsInScreen().origin()); return target_bounds; }
diff --git a/ash/wm/overview/caption_container_view.h b/ash/wm/overview/caption_container_view.h index d82dfad..3b90001 100644 --- a/ash/wm/overview/caption_container_view.h +++ b/ash/wm/overview/caption_container_view.h
@@ -100,7 +100,7 @@ // OverviewHighlightController::OverviewHighlightableView: views::View* GetView() override; - gfx::Rect GetHighlightBounds() override; + gfx::Rect GetHighlightBoundsInScreen() override; // TODO(sammiequon): Move these to a test api. views::View* header_view() { return header_view_; }
diff --git a/ash/wm/overview/overview_highlight_controller.cc b/ash/wm/overview/overview_highlight_controller.cc index 51b00a89..30997a7 100644 --- a/ash/wm/overview/overview_highlight_controller.cc +++ b/ash/wm/overview/overview_highlight_controller.cc
@@ -21,6 +21,7 @@ #include "ui/compositor_extra/shadow.h" #include "ui/views/view.h" #include "ui/views/widget/widget.h" +#include "ui/wm/core/coordinate_conversion.h" #include "ui/wm/core/window_animations.h" #include "ui/wm/core/window_properties.h" @@ -82,7 +83,10 @@ // avoid animating two separate layers. class OverviewHighlightController::HighlightWidget : public views::Widget { public: - HighlightWidget(aura::Window* root_window, const gfx::Rect& bounds) { + HighlightWidget(aura::Window* root_window, + const gfx::Rect& bounds_in_screen, + const gfx::RoundedCornersF& rounded_corners) + : root_window_(root_window) { DCHECK(root_window->IsRootWindow()); views::Widget::InitParams params; @@ -105,6 +109,9 @@ SetOpacity(0.f); Show(); + gfx::Rect bounds = bounds_in_screen; + wm::ConvertRectFromScreen(root_window_, &bounds); + widget_window->SetBounds(bounds); widget_window->SetName("OverviewModeHighlight"); @@ -119,7 +126,7 @@ // Add rounded corner solid color layer. color_layer_ = new ui::Layer(ui::LAYER_SOLID_COLOR); color_layer_->SetColor(kHighlightColor); - color_layer_->SetRoundedCornerRadius(kHighlightCornerRadii); + color_layer_->SetRoundedCornerRadius(rounded_corners); color_layer_->SetVisible(true); color_layer_->SetBounds(gfx::Rect(bounds.size())); widget_window->layer()->Add(color_layer_); @@ -129,20 +136,30 @@ // Set the bounds of |this|, and also manually sets the bounds of the // children, because there is no masks to bounds. - void SetWidgetBounds(const gfx::Rect& bounds) { - SetBounds(bounds); - const gfx::Rect child_bounds(bounds.size()); + void SetWidgetBoundsInScreen(const gfx::Rect& bounds) { + gfx::Rect bounds_in_root = bounds; + wm::ConvertRectFromScreen(root_window_, &bounds_in_root); + SetBounds(bounds_in_root); + const gfx::Rect child_bounds(bounds_in_root.size()); shadow_layer_->SetContentBounds(child_bounds); color_layer_->SetBounds(child_bounds); } private: + aura::Window* root_window_; + ui::Shadow* shadow_layer_ = nullptr; ui::Layer* color_layer_ = nullptr; DISALLOW_COPY_AND_ASSIGN(HighlightWidget); }; +gfx::RoundedCornersF +OverviewHighlightController::OverviewHighlightableView::GetRoundedCornersRadii() + const { + return kHighlightCornerRadii; +} + // ----------------------------------------------------------------------------- // OverviewHighlightController @@ -235,14 +252,15 @@ void OverviewHighlightController::UpdateTabDragHighlight( aura::Window* root_window, - const gfx::Rect& bounds) { + const gfx::Rect& bounds_in_screen) { DCHECK(root_window); - DCHECK(!bounds.IsEmpty()); + DCHECK(!bounds_in_screen.IsEmpty()); if (tab_drag_widget_) { - tab_drag_widget_->SetWidgetBounds(bounds); + tab_drag_widget_->SetWidgetBoundsInScreen(bounds_in_screen); return; } - tab_drag_widget_ = std::make_unique<HighlightWidget>(root_window, bounds); + tab_drag_widget_ = std::make_unique<HighlightWidget>( + root_window, bounds_in_screen, kHighlightCornerRadii); tab_drag_widget_->SetOpacity(1.f); } @@ -260,7 +278,16 @@ return; DCHECK(highlighted_view_); - highlight_widget_->SetWidgetBounds(highlighted_view_->GetHighlightBounds()); + highlight_widget_->SetWidgetBoundsInScreen( + highlighted_view_->GetHighlightBoundsInScreen()); +} + +gfx::Rect OverviewHighlightController::GetHighlightBoundsInScreenForTesting() + const { + if (!highlight_widget_) + return gfx::Rect(); + + return highlight_widget_->GetNativeWindow()->GetBoundsInScreen(); } std::vector<OverviewHighlightController::OverviewHighlightableView*> @@ -276,7 +303,9 @@ // languages. for (const auto& mini_view : bar_view->mini_views()) traversable_views.push_back(mini_view.get()); - traversable_views.push_back(bar_view->new_desk_button()); + + if (bar_view->new_desk_button()->GetEnabled()) + traversable_views.push_back(bar_view->new_desk_button()); } for (auto& item : grid->window_list()) @@ -321,22 +350,23 @@ old_highlight_window->SetTransform(transform); } - gfx::Rect target_bounds = highlighted_view_->GetHighlightBounds(); + gfx::Rect target_screen_bounds = + highlighted_view_->GetHighlightBoundsInScreen(); if (!highlight_widget_) { // Offset the bounds slightly to create a slide in animation. - gfx::Rect initial_bounds = target_bounds; - initial_bounds.Offset(target_bounds.width() * (reverse ? 1 : -1), 0); + gfx::Rect initial_bounds = target_screen_bounds; + initial_bounds.Offset(target_screen_bounds.width() * (reverse ? 1 : -1), 0); highlight_widget_ = std::make_unique<HighlightWidget>( GetWindowForView(highlighted_view_->GetView())->GetRootWindow(), - initial_bounds); + initial_bounds, highlighted_view_->GetRoundedCornersRadii()); } // Move the highlight to the target. aura::Window* highlight_window = highlight_widget_->GetNativeWindow(); gfx::RectF previous_bounds = - gfx::RectF(highlight_window->GetBoundsInRootWindow()); - highlight_widget_->SetWidgetBounds(target_bounds); - gfx::RectF current_bounds = gfx::RectF(target_bounds); + gfx::RectF(highlight_window->GetBoundsInScreen()); + highlight_widget_->SetWidgetBoundsInScreen(target_screen_bounds); + gfx::RectF current_bounds = gfx::RectF(target_screen_bounds); gfx::Transform transform(previous_bounds.width() / current_bounds.width(), 0.f, 0.f, previous_bounds.height() / current_bounds.height(),
diff --git a/ash/wm/overview/overview_highlight_controller.h b/ash/wm/overview/overview_highlight_controller.h index ff08065..1e02202 100644 --- a/ash/wm/overview/overview_highlight_controller.h +++ b/ash/wm/overview/overview_highlight_controller.h
@@ -11,6 +11,7 @@ #include "base/macros.h" #include "base/optional.h" #include "ui/gfx/geometry/rect.h" +#include "ui/gfx/geometry/rounded_corners_f.h" namespace aura { class Window; @@ -40,7 +41,11 @@ virtual views::View* GetView() = 0; // Get the bounds of where the highlight should be for |this|, in screen // coordinates. - virtual gfx::Rect GetHighlightBounds() = 0; + virtual gfx::Rect GetHighlightBoundsInScreen() = 0; + + // Get the rounded corners the highlight should have when highlighting + // |this|. + virtual gfx::RoundedCornersF GetRoundedCornersRadii() const; protected: virtual ~OverviewHighlightableView() {} @@ -67,13 +72,15 @@ // Clears, creates or repositions the tab dragging highlight. void ClearTabDragHighlight(); void UpdateTabDragHighlight(aura::Window* root_window, - const gfx::Rect& bounds); + const gfx::Rect& bounds_in_screen); bool IsTabDragHighlightVisible() const; // Called when an overview grid repositions its windows. Moves the focus // highlight widget without animation. void OnWindowsRepositioned(aura::Window* root_window); + gfx::Rect GetHighlightBoundsInScreenForTesting() const; + private: class HighlightWidget; friend class DesksOverviewHighlightControllerTest;
diff --git a/ash/wm/overview/overview_highlight_controller_unittest.cc b/ash/wm/overview/overview_highlight_controller_unittest.cc index 041a1212..d1d325ed 100644 --- a/ash/wm/overview/overview_highlight_controller_unittest.cc +++ b/ash/wm/overview/overview_highlight_controller_unittest.cc
@@ -10,6 +10,7 @@ #include "ash/wm/desks/desk.h" #include "ash/wm/desks/desk_mini_view.h" #include "ash/wm/desks/desks_bar_view.h" +#include "ash/wm/desks/desks_test_util.h" #include "ash/wm/desks/new_desk_button.h" #include "ash/wm/overview/overview_controller.h" #include "ash/wm/overview/overview_grid.h" @@ -329,6 +330,17 @@ return grid->desks_bar_view(); } + // Checks to see if a view is completely covered by the overview highlight. + bool CoveredByOverviewHighlight(views::View* view) { + if (!Shell::Get()->overview_controller()->InOverviewSession()) + return false; + + gfx::Rect view_bounds = view->GetBoundsInScreen(); + return GetHighlightController() + ->GetHighlightBoundsInScreenForTesting() + .Contains(view_bounds); + } + private: base::test::ScopedFeatureList scoped_feature_list_; DISALLOW_COPY_AND_ASSIGN(DesksOverviewHighlightControllerTest); @@ -492,4 +504,93 @@ EXPECT_EQ(desk_bar_view1->mini_views()[0].get(), GetHighlightedView()); } +// Tests that the location of the overview highlight is fully covering each +// views bounds. +TEST_F(DesksOverviewHighlightControllerTest, + TabbingMultiDisplayHighlightLocation) { + UpdateDisplay("600x400,600x400,600x400"); + std::vector<aura::Window*> roots = Shell::GetAllRootWindows(); + ASSERT_EQ(3u, roots.size()); + + auto* desk_controller = DesksController::Get(); + desk_controller->NewDesk(DesksCreationRemovalSource::kButton); + ASSERT_EQ(2u, desk_controller->desks().size()); + + std::unique_ptr<aura::Window> window1(CreateTestWindow(gfx::Rect(200, 200))); + std::unique_ptr<aura::Window> window2( + CreateTestWindow(gfx::Rect(600, 0, 200, 200))); + ASSERT_EQ(roots[0], window1->GetRootWindow()); + ASSERT_EQ(roots[1], window2->GetRootWindow()); + + ToggleOverview(); + const auto* desk_bar_view1 = GetDesksBarViewForRoot(roots[0]); + EXPECT_EQ(2u, desk_bar_view1->mini_views().size()); + + SendKey(ui::VKEY_TAB); + EXPECT_TRUE( + CoveredByOverviewHighlight(desk_bar_view1->mini_views()[0].get())); + SendKey(ui::VKEY_TAB); + SendKey(ui::VKEY_TAB); + EXPECT_TRUE(CoveredByOverviewHighlight(desk_bar_view1->new_desk_button())); + SendKey(ui::VKEY_TAB); + auto* item1 = GetOverviewItemInGridWithWindow(0, window1.get()); + EXPECT_TRUE(CoveredByOverviewHighlight(item1->caption_container_view())); + + const auto* desk_bar_view2 = GetDesksBarViewForRoot(roots[1]); + SendKey(ui::VKEY_TAB); + EXPECT_TRUE( + CoveredByOverviewHighlight(desk_bar_view2->mini_views()[0].get())); + SendKey(ui::VKEY_TAB); + SendKey(ui::VKEY_TAB); + EXPECT_TRUE(CoveredByOverviewHighlight(desk_bar_view2->new_desk_button())); + SendKey(ui::VKEY_TAB); + auto* item2 = GetOverviewItemInGridWithWindow(1, window2.get()); + EXPECT_TRUE(CoveredByOverviewHighlight(item2->caption_container_view())); + + const auto* desk_bar_view3 = GetDesksBarViewForRoot(roots[2]); + SendKey(ui::VKEY_TAB); + EXPECT_TRUE( + CoveredByOverviewHighlight(desk_bar_view3->mini_views()[0].get())); + SendKey(ui::VKEY_TAB); + SendKey(ui::VKEY_TAB); + EXPECT_TRUE(CoveredByOverviewHighlight(desk_bar_view3->new_desk_button())); +} + +TEST_F(DesksOverviewHighlightControllerTest, + TabbingMDisplayHighlightLocationAfterItemRemoval) { + auto* desk_controller = DesksController::Get(); + desk_controller->NewDesk(DesksCreationRemovalSource::kButton); + ASSERT_EQ(2u, desk_controller->desks().size()); + + std::unique_ptr<views::Widget> widget3(CreateTestWidget()); + std::unique_ptr<aura::Window> window2(CreateTestWindow(gfx::Rect(200, 200))); + std::unique_ptr<views::Widget> widget1(CreateTestWidget()); + + ToggleOverview(); + const auto* desk_bar_view = + GetDesksBarViewForRoot(Shell::GetAllRootWindows()[0]); + EXPECT_EQ(2u, desk_bar_view->mini_views().size()); + + // Tests that if we delete desk2 while desk1 is highlighted, the overview + // highlight bounds still contains desk1's bounds. + SendKey(ui::VKEY_TAB); + EXPECT_TRUE(CoveredByOverviewHighlight(desk_bar_view->mini_views()[0].get())); + RemoveDesk(DesksController::Get()->desks()[1].get()); + EXPECT_TRUE(CoveredByOverviewHighlight(desk_bar_view->mini_views()[0].get())); + + // Tests that if we delete items on the right and left of item2, the overview + // highlight bounds still contains item2's bounds. + SendKey(ui::VKEY_TAB); + SendKey(ui::VKEY_TAB); + SendKey(ui::VKEY_TAB); + auto* item2 = GetOverviewItemInGridWithWindow(0, window2.get()); + EXPECT_TRUE(CoveredByOverviewHighlight(item2->caption_container_view())); + auto* item1 = GetOverviewItemInGridWithWindow(0, widget1->GetNativeWindow()); + item1->CloseWindow(); + EXPECT_TRUE(CoveredByOverviewHighlight(item2->caption_container_view())); + auto* item3 = GetOverviewItemInGridWithWindow(0, widget3->GetNativeWindow()); + item3->CloseWindow(); + EXPECT_TRUE(CoveredByOverviewHighlight(item2->caption_container_view())); +} + } // namespace ash
diff --git a/ash/wm/overview/overview_session.cc b/ash/wm/overview/overview_session.cc index 89b7b405d..993d6e6d 100644 --- a/ash/wm/overview/overview_session.cc +++ b/ash/wm/overview/overview_session.cc
@@ -818,12 +818,8 @@ switch (event->key_code()) { case ui::VKEY_BROWSER_BACK: - FALLTHROUGH; case ui::VKEY_ESCAPE: - // Cancel overview unless we're in single split mode with no overview - // windows. - if (!(IsEmpty() && shell->split_view_controller()->InSplitViewMode())) - EndOverview(); + EndOverview(); break; case ui::VKEY_UP: ++num_key_presses_;
diff --git a/ash/wm/tablet_mode/tablet_mode_window_state.cc b/ash/wm/tablet_mode/tablet_mode_window_state.cc index 1cce07a..fa8fecf 100644 --- a/ash/wm/tablet_mode/tablet_mode_window_state.cc +++ b/ash/wm/tablet_mode/tablet_mode_window_state.cc
@@ -195,8 +195,10 @@ state_type_on_attach_ = snap ? current_state_type_ : GetMaximizedOrCenteredWindowType(state); // TODO(oshima|sammiequon): consider SplitView scenario. - if (entering_tablet_mode) - set_enter_animation_type(IsTopWindow(window) ? DEFAULT : STEP_END); + WindowState::ScopedBoundsChangeAnimation bounds_animation( + window, entering_tablet_mode && !IsTopWindow(window) + ? WindowState::BoundsChangeAnimationType::STEP_END + : WindowState::BoundsChangeAnimationType::DEFAULT); old_state_.reset( state->SetStateObject(std::unique_ptr<State>(this)).release()); } @@ -211,17 +213,19 @@ // or the top window or a window showing in splitview before leaving tablet // mode, and the window has changed its state. Otherwise, restore its bounds // immediately. - EnterAnimationType animation_type = + WindowState::BoundsChangeAnimationType animation_type = was_in_overview || window_state->IsSnapped() || IsTopWindow(window_state->window()) - ? DEFAULT - : IMMEDIATE; + ? WindowState::BoundsChangeAnimationType::DEFAULT + : WindowState::BoundsChangeAnimationType::IMMEDIATE; if (old_state_->GetType() == window_state->GetStateType() && !window_state->IsNormalStateType()) { - animation_type = IMMEDIATE; + animation_type = WindowState::BoundsChangeAnimationType::IMMEDIATE; } - old_state_->set_enter_animation_type(animation_type); + // Note: When we return we will destroy ourselves with the |our_reference|. + WindowState::ScopedBoundsChangeAnimation bounds_animation( + window_state->window(), animation_type); std::unique_ptr<WindowState::State> our_reference = window_state->SetStateObject(std::move(old_state_)); } @@ -480,16 +484,14 @@ if (!window_state->window()->IsVisible() || !animated) { window_state->SetBoundsDirect(bounds_in_parent); } else { - if (enter_animation_type() == STEP_END) { + if (window_state->bounds_animation_type() == + WindowState::BoundsChangeAnimationType::STEP_END) { // Just use the normal bounds animation with ZERO tween with long enough // duration for STEP_END. The animation will be stopped when the to // window's animation ends. window_state->SetBoundsDirectAnimated(bounds_in_parent, base::TimeDelta::FromSeconds(1), gfx::Tween::ZERO); - // Reset the |enter_animation_type_| to DEFAULT it if is STEP_END, which - // is set for non-top windows when entering tablet mode. - set_enter_animation_type(DEFAULT); return; } // If we animate (to) tablet mode, we want to use the cross fade to
diff --git a/ash/wm/window_state.cc b/ash/wm/window_state.cc index 71fd0dc0..5af3cf5 100644 --- a/ash/wm/window_state.cc +++ b/ash/wm/window_state.cc
@@ -178,6 +178,31 @@ constexpr base::TimeDelta WindowState::kBoundsChangeSlideDuration; +WindowState::ScopedBoundsChangeAnimation::ScopedBoundsChangeAnimation( + aura::Window* window, + BoundsChangeAnimationType bounds_animation_type) + : window_(window) { + window_->AddObserver(this); + previous_bounds_animation_type_ = + WindowState::Get(window_)->bounds_animation_type_; + WindowState::Get(window_)->bounds_animation_type_ = bounds_animation_type; +} + +WindowState::ScopedBoundsChangeAnimation::~ScopedBoundsChangeAnimation() { + if (window_) { + WindowState::Get(window_)->bounds_animation_type_ = + previous_bounds_animation_type_; + window_->RemoveObserver(this); + window_ = nullptr; + } +} + +void WindowState::ScopedBoundsChangeAnimation::OnWindowDestroying( + aura::Window* window) { + window_->RemoveObserver(this); + window_ = nullptr; +} + WindowState::~WindowState() { // WindowState is registered as an owned property of |window_|, and window // unregisters all of its observers in its d'tor before destroying its
diff --git a/ash/wm/window_state.h b/ash/wm/window_state.h index fe439304..f6272b7 100644 --- a/ash/wm/window_state.h +++ b/ash/wm/window_state.h
@@ -58,11 +58,6 @@ // Each subclass defines its own behavior and transition for each WMEvent. class State { public: - // Animation type of updating window bounds for entering current state. - // "IMMEDIATE" means update bounds directly without animation. "STEP_END" - // means update bounds at the end of the animation. - enum EnterAnimationType { DEFAULT, IMMEDIATE, STEP_END }; - State() {} virtual ~State() {} @@ -87,16 +82,7 @@ // Called when the window is being destroyed. virtual void OnWindowDestroying(WindowState* window_state) {} - EnterAnimationType enter_animation_type() const { - return enter_animation_type_; - } - void set_enter_animation_type(EnterAnimationType type) { - enter_animation_type_ = type; - } - private: - EnterAnimationType enter_animation_type_ = DEFAULT; - DISALLOW_COPY_AND_ASSIGN(State); }; @@ -359,15 +345,41 @@ friend class DefaultState; friend class LockWindowState; friend class TabletModeWindowState; + friend class ScopedBoundsChangeAnimation; FRIEND_TEST_ALL_PREFIXES(WindowAnimationsTest, CrossFadeToBounds); FRIEND_TEST_ALL_PREFIXES(WindowAnimationsTest, CrossFadeToBoundsFromTransform); FRIEND_TEST_ALL_PREFIXES(WindowStateTest, PipWindowMaskRecreated); FRIEND_TEST_ALL_PREFIXES(WindowStateTest, PipWindowHasMaskLayer); + // Animation type of updating window bounds. "IMMEDIATE" means update bounds + // directly without animation. "STEP_END" means update bounds at the end of + // the animation. + enum class BoundsChangeAnimationType { DEFAULT, IMMEDIATE, STEP_END }; + + // A class can temporarily change the window bounds change animation type. + class ScopedBoundsChangeAnimation : public aura::WindowObserver { + public: + ScopedBoundsChangeAnimation(aura::Window* window, + BoundsChangeAnimationType animation_type); + ~ScopedBoundsChangeAnimation() override; + + // aura::WindowObserver: + void OnWindowDestroying(aura::Window* window) override; + + private: + aura::Window* window_; + BoundsChangeAnimationType previous_bounds_animation_type_; + + DISALLOW_COPY_AND_ASSIGN(ScopedBoundsChangeAnimation); + }; + explicit WindowState(aura::Window* window); WindowStateDelegate* delegate() { return delegate_.get(); } + BoundsChangeAnimationType bounds_animation_type() { + return bounds_animation_type_; + } bool HasMaximumWidthOrHeight() const; @@ -476,6 +488,10 @@ std::unique_ptr<State> current_state_; + // The animation type for the bounds change. + BoundsChangeAnimationType bounds_animation_type_ = + BoundsChangeAnimationType::DEFAULT; + DISALLOW_COPY_AND_ASSIGN(WindowState); };
diff --git a/base/BUILD.gn b/base/BUILD.gn index b459468..c99fad58 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -982,6 +982,8 @@ "trace_event/heap_profiler_event_filter.h", "trace_event/java_heap_dump_provider_android.cc", "trace_event/java_heap_dump_provider_android.h", + "trace_event/log_message.cc", + "trace_event/log_message.h", "trace_event/malloc_dump_provider.cc", "trace_event/malloc_dump_provider.h", "trace_event/memory_allocator_dump.cc",
diff --git a/base/android/java_handler_thread.cc b/base/android/java_handler_thread.cc index 2d5d011..52c0c53 100644 --- a/base/android/java_handler_thread.cc +++ b/base/android/java_handler_thread.cc
@@ -11,6 +11,7 @@ #include "base/base_jni_headers/JavaHandlerThread_jni.h" #include "base/bind.h" #include "base/message_loop/message_pump.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/synchronization/waitable_event.h" #include "base/task/sequence_manager/sequence_manager_impl.h" @@ -146,13 +147,13 @@ JavaHandlerThread::TaskEnvironment::TaskEnvironment() : sequence_manager(sequence_manager::CreateUnboundSequenceManager( sequence_manager::SequenceManager::Settings::Builder() - .SetMessagePumpType(base::MessagePump::Type::JAVA) + .SetMessagePumpType(base::MessagePumpType::JAVA) .Build())), default_task_queue(sequence_manager->CreateTaskQueue( sequence_manager::TaskQueue::Spec("default_tq"))) { // TYPE_JAVA to get the Android java style message loop. std::unique_ptr<MessagePump> message_pump = - MessagePump::Create(base::MessagePump::Type::JAVA); + MessagePump::Create(base::MessagePumpType::JAVA); pump = static_cast<MessagePumpForUI*>(message_pump.get()); // We must set SetTaskRunner before binding because the Android UI pump
diff --git a/base/android/proguard/chromium_code.flags b/base/android/proguard/chromium_code.flags index ab2821f5..19f45e867a 100644 --- a/base/android/proguard/chromium_code.flags +++ b/base/android/proguard/chromium_code.flags
@@ -49,10 +49,10 @@ # Never inline classes or methods with this annotation, but allow shrinking and # obfuscation. --keepnames,allowobfuscation @org.chromium.base.annotations.DoNotInline class ** { - *; +-keep,allowobfuscation,allowoptimization @org.chromium.base.annotations.DoNotInline class ** { + <methods>; } --keepclassmembernames,allowobfuscation class ** { +-keepclassmembers,allowobfuscation,allowoptimization class ** { @org.chromium.base.annotations.DoNotInline <methods>; }
diff --git a/base/files/file_util.h b/base/files/file_util.h index a40289e..0987b7b 100644 --- a/base/files/file_util.h +++ b/base/files/file_util.h
@@ -186,12 +186,11 @@ BASE_EXPORT bool ReadFromFD(int fd, char* buffer, size_t bytes); // Performs the same function as CreateAndOpenTemporaryFileInDir(), but returns -// the file-descriptor directly, rather than wrapping it into a FILE. Returns -// -1 on failure. -BASE_EXPORT int CreateAndOpenFdForTemporaryFileInDir(const FilePath& dir, - FilePath* path); +// the file-descriptor wrapped in a ScopedFD, rather than wrapped in a FILE. +BASE_EXPORT ScopedFD CreateAndOpenFdForTemporaryFileInDir(const FilePath& dir, + FilePath* path); -#endif // OS_POSIX || OS_FUCHSIA +#endif // defined(OS_POSIX) || defined(OS_FUCHSIA) #if defined(OS_POSIX)
diff --git a/base/files/file_util_posix.cc b/base/files/file_util_posix.cc index e3579d7..aff68083 100644 --- a/base/files/file_util_posix.cc +++ b/base/files/file_util_posix.cc
@@ -512,8 +512,8 @@ #if !defined(OS_NACL_NONSFI) -int CreateAndOpenFdForTemporaryFileInDir(const FilePath& directory, - FilePath* path) { +ScopedFD CreateAndOpenFdForTemporaryFileInDir(const FilePath& directory, + FilePath* path) { ScopedBlockingCall scoped_blocking_call( FROM_HERE, BlockingType::MAY_BLOCK); // For call to mkstemp(). @@ -522,7 +522,7 @@ // this should be OK since mkstemp just replaces characters in place char* buffer = const_cast<char*>(tmpdir_string.c_str()); - return HANDLE_EINTR(mkstemp(buffer)); + return ScopedFD(HANDLE_EINTR(mkstemp(buffer))); } #if !defined(OS_FUCHSIA) @@ -651,23 +651,21 @@ #endif // !defined(OS_MACOSX) bool CreateTemporaryFile(FilePath* path) { - ScopedBlockingCall scoped_blocking_call( - FROM_HERE, BlockingType::MAY_BLOCK); // For call to close(). + // For call to close() inside ScopedFD. + ScopedBlockingCall scoped_blocking_call(FROM_HERE, BlockingType::MAY_BLOCK); FilePath directory; if (!GetTempDir(&directory)) return false; - int fd = CreateAndOpenFdForTemporaryFileInDir(directory, path); - if (fd < 0) - return false; - close(fd); - return true; + ScopedFD fd = CreateAndOpenFdForTemporaryFileInDir(directory, path); + return fd.is_valid(); } FILE* CreateAndOpenTemporaryFileInDir(const FilePath& dir, FilePath* path) { - int fd = CreateAndOpenFdForTemporaryFileInDir(dir, path); - if (fd < 0) + ScopedFD scoped_fd = CreateAndOpenFdForTemporaryFileInDir(dir, path); + if (!scoped_fd.is_valid()) return nullptr; + int fd = scoped_fd.release(); FILE* file = fdopen(fd, "a+"); if (!file) close(fd); @@ -675,10 +673,10 @@ } bool CreateTemporaryFileInDir(const FilePath& dir, FilePath* temp_file) { - ScopedBlockingCall scoped_blocking_call( - FROM_HERE, BlockingType::MAY_BLOCK); // For call to close(). - int fd = CreateAndOpenFdForTemporaryFileInDir(dir, temp_file); - return ((fd >= 0) && !IGNORE_EINTR(close(fd))); + // For call to close() inside ScopedFD. + ScopedBlockingCall scoped_blocking_call(FROM_HERE, BlockingType::MAY_BLOCK); + ScopedFD fd = CreateAndOpenFdForTemporaryFileInDir(dir, temp_file); + return fd.is_valid(); } static bool CreateTemporaryDirInDirImpl(const FilePath& base_dir, @@ -1158,7 +1156,7 @@ bool result = false; FilePath tmp_file_path; - ScopedFD fd(CreateAndOpenFdForTemporaryFileInDir(path, &tmp_file_path)); + ScopedFD fd = CreateAndOpenFdForTemporaryFileInDir(path, &tmp_file_path); if (fd.is_valid()) { DeleteFile(tmp_file_path, false); long sysconf_result = sysconf(_SC_PAGESIZE);
diff --git a/base/logging.cc b/base/logging.cc index 4c4bfa6..17969f40 100644 --- a/base/logging.cc +++ b/base/logging.cc
@@ -10,6 +10,7 @@ #include "base/pending_task.h" #include "base/stl_util.h" #include "base/task/common/task_annotator.h" +#include "base/trace_event/trace_event.h" #include "build/build_config.h" #if defined(OS_WIN) @@ -640,6 +641,8 @@ #endif stream_ << std::endl; std::string str_newline(stream_.str()); + TRACE_LOG_MESSAGE( + file_, base::StringPiece(str_newline).substr(message_start_), line_); // Give any log message handler first dibs on the message. if (log_message_handler &&
diff --git a/base/memory/platform_shared_memory_region_posix.cc b/base/memory/platform_shared_memory_region_posix.cc index 1fe6f81e..f7ce9de 100644 --- a/base/memory/platform_shared_memory_region_posix.cc +++ b/base/memory/platform_shared_memory_region_posix.cc
@@ -267,7 +267,8 @@ } FilePath path; - File shm_file(CreateAndOpenFdForTemporaryFileInDir(directory, &path)); + ScopedFD fd = CreateAndOpenFdForTemporaryFileInDir(directory, &path); + File shm_file(fd.release()); if (!shm_file.IsValid()) { LogCreateError(
diff --git a/base/memory/shared_memory_helper.cc b/base/memory/shared_memory_helper.cc index 1df529f..af200b65 100644 --- a/base/memory/shared_memory_helper.cc +++ b/base/memory/shared_memory_helper.cc
@@ -41,8 +41,7 @@ if (!GetShmemTempDir(options.executable, &directory)) return false; - fd->reset(base::CreateAndOpenFdForTemporaryFileInDir(directory, path)); - + *fd = base::CreateAndOpenFdForTemporaryFileInDir(directory, path); if (!fd->is_valid()) return false;
diff --git a/base/message_loop/message_loop.cc b/base/message_loop/message_loop.cc index 9a47503..a8a6630 100644 --- a/base/message_loop/message_loop.cc +++ b/base/message_loop/message_loop.cc
@@ -168,7 +168,7 @@ MessageLoopForUI::MessageLoopForUI(MessagePumpType type) : MessageLoop(type) { #if defined(OS_ANDROID) - DCHECK(type == MessagePumpType::UI || type == MessagePump::Type::JAVA); + DCHECK(type == MessagePumpType::UI || type == MessagePumpType::JAVA); #else DCHECK_EQ(type, MessagePumpType::UI); #endif
diff --git a/base/message_loop/message_loop.h b/base/message_loop/message_loop.h index ed43e7f..0a62dfe5 100644 --- a/base/message_loop/message_loop.h +++ b/base/message_loop/message_loop.h
@@ -99,7 +99,7 @@ // Normally, it is not necessary to instantiate a MessageLoop. Instead, it // is typical to make use of the current thread's MessageLoop instance. - explicit MessageLoop(MessagePumpType type = MessagePump::Type::DEFAULT); + explicit MessageLoop(MessagePumpType type = MessagePumpType::DEFAULT); // Creates a MessageLoop with the supplied MessagePump, which must be // non-null. explicit MessageLoop(std::unique_ptr<MessagePump> custom_pump); @@ -231,7 +231,7 @@ // class BASE_EXPORT MessageLoopForUI : public MessageLoop { public: - explicit MessageLoopForUI(MessagePumpType type = MessagePump::Type::UI); + explicit MessageLoopForUI(MessagePumpType type = MessagePumpType::UI); #if defined(OS_IOS) // On iOS, the main message loop cannot be Run(). Instead call Attach(),
diff --git a/base/message_loop/message_pump.h b/base/message_loop/message_pump.h index db1c77e..1cb1a21 100644 --- a/base/message_loop/message_pump.h +++ b/base/message_loop/message_pump.h
@@ -19,9 +19,6 @@ class BASE_EXPORT MessagePump { public: - // DEPRECATED: Use MessagePumpType instead. - using Type = MessagePumpType; - using MessagePumpFactory = std::unique_ptr<MessagePump>(); // Uses the given base::MessagePumpFactory to override the default MessagePump // implementation for 'Type::UI'. May only be called once.
diff --git a/base/task/sequence_manager/sequence_manager.cc b/base/task/sequence_manager/sequence_manager.cc index a7fc2ff3..3ca0ae7c 100644 --- a/base/task/sequence_manager/sequence_manager.cc +++ b/base/task/sequence_manager/sequence_manager.cc
@@ -25,7 +25,7 @@ SequenceManager::Settings::Builder& SequenceManager::Settings::Builder::SetMessagePumpType( - MessagePump::Type message_loop_type_val) { + MessagePumpType message_loop_type_val) { settings_.message_loop_type = message_loop_type_val; return *this; }
diff --git a/base/task/sequence_manager/sequence_manager.h b/base/task/sequence_manager/sequence_manager.h index fa19852..cd2163d 100644 --- a/base/task/sequence_manager/sequence_manager.h +++ b/base/task/sequence_manager/sequence_manager.h
@@ -9,7 +9,7 @@ #include <utility> #include "base/macros.h" -#include "base/message_loop/message_loop.h" +#include "base/message_loop/message_pump_type.h" #include "base/message_loop/timer_slack.h" #include "base/single_thread_task_runner.h" #include "base/task/sequence_manager/task_queue_impl.h" @@ -17,6 +17,9 @@ #include "base/time/default_tick_clock.h" namespace base { + +class MessagePump; + namespace sequence_manager { class TimeDomain; @@ -80,7 +83,7 @@ // so we are making Settings move-only in preparation. Settings(Settings&& move_from) noexcept; - MessagePump::Type message_loop_type = MessagePump::Type::DEFAULT; + MessagePumpType message_loop_type = MessagePumpType::DEFAULT; bool randomised_sampling_enabled = false; const TickClock* clock = DefaultTickClock::GetInstance(); @@ -245,8 +248,8 @@ Builder(); ~Builder(); - // Sets the MessagePump::Type which is used to create a MessagePump. - Builder& SetMessagePumpType(MessagePump::Type message_loop_type); + // Sets the MessagePumpType which is used to create a MessagePump. + Builder& SetMessagePumpType(MessagePumpType message_loop_type); Builder& SetRandomisedSamplingEnabled(bool randomised_sampling_enabled);
diff --git a/base/task/sequence_manager/sequence_manager_impl.cc b/base/task/sequence_manager/sequence_manager_impl.cc index 6bfe2aa..c560af32 100644 --- a/base/task/sequence_manager/sequence_manager_impl.cc +++ b/base/task/sequence_manager/sequence_manager_impl.cc
@@ -302,8 +302,8 @@ // On Android attach to the native loop when there is one. #if defined(OS_ANDROID) - if (settings_.message_loop_type == MessagePump::Type::UI || - settings_.message_loop_type == MessagePump::Type::JAVA) { + if (settings_.message_loop_type == MessagePumpType::UI || + settings_.message_loop_type == MessagePumpType::JAVA) { controller_->AttachToMessagePump(); } #endif @@ -1035,7 +1035,7 @@ return false; } -MessagePump::Type SequenceManagerImpl::GetType() const { +MessagePumpType SequenceManagerImpl::GetType() const { return settings_.message_loop_type; } @@ -1109,7 +1109,7 @@ return controller_->GetBoundMessagePump(); } -bool SequenceManagerImpl::IsType(MessagePump::Type type) const { +bool SequenceManagerImpl::IsType(MessagePumpType type) const { return settings_.message_loop_type == type; }
diff --git a/base/task/sequence_manager/sequence_manager_impl.h b/base/task/sequence_manager/sequence_manager_impl.h index b70d128..983968b 100644 --- a/base/task/sequence_manager/sequence_manager_impl.h +++ b/base/task/sequence_manager/sequence_manager_impl.h
@@ -22,6 +22,7 @@ #include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h" #include "base/message_loop/message_loop.h" +#include "base/message_loop/message_pump_type.h" #include "base/pending_task.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" @@ -143,7 +144,7 @@ scoped_refptr<SingleThreadTaskRunner> GetTaskRunner(); bool IsBoundToCurrentThread() const; MessagePump* GetMessagePump() const; - bool IsType(MessagePump::Type type) const; + bool IsType(MessagePumpType type) const; void SetAddQueueTimeToTasks(bool enable); void SetTaskExecutionAllowed(bool allowed); bool IsTaskExecutionAllowed() const; @@ -154,7 +155,7 @@ void BindToCurrentThread(std::unique_ptr<MessagePump> pump); void DeletePendingTasks(); bool HasTasks(); - MessagePump::Type GetType() const; + MessagePumpType GetType() const; // Requests that a task to process work is scheduled. void ScheduleWork();
diff --git a/base/task/sequence_manager/sequence_manager_impl_unittest.cc b/base/task/sequence_manager/sequence_manager_impl_unittest.cc index f510364..84ba2595 100644 --- a/base/task/sequence_manager/sequence_manager_impl_unittest.cc +++ b/base/task/sequence_manager/sequence_manager_impl_unittest.cc
@@ -20,6 +20,7 @@ #include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop_current.h" #include "base/message_loop/message_pump_default.h" +#include "base/message_loop/message_pump_type.h" #include "base/optional.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" @@ -180,7 +181,7 @@ ThreadTaskRunnerHandle::Get(), mock_tick_clock(), SequenceManager::Settings::Builder() - .SetMessagePumpType(MessagePump::Type::DEFAULT) + .SetMessagePumpType(MessagePumpType::DEFAULT) .SetRandomisedSamplingEnabled(false) .SetTickClock(mock_tick_clock()) .SetAntiStarvationLogicForPrioritiesDisabled( @@ -255,7 +256,7 @@ pump_ = pump.get(); auto settings = SequenceManager::Settings::Builder() - .SetMessagePumpType(MessagePump::Type::DEFAULT) + .SetMessagePumpType(MessagePumpType::DEFAULT) .SetRandomisedSamplingEnabled(false) .SetTickClock(mock_tick_clock()) .SetAntiStarvationLogicForPrioritiesDisabled( @@ -344,7 +345,7 @@ sequence_manager_ = SequenceManagerForTest::CreateOnCurrentThread( SequenceManager::Settings::Builder() - .SetMessagePumpType(MessagePump::Type::DEFAULT) + .SetMessagePumpType(MessagePumpType::DEFAULT) .SetRandomisedSamplingEnabled(false) .SetTickClock(mock_tick_clock()) .SetAntiStarvationLogicForPrioritiesDisabled(
diff --git a/base/task/sequence_manager/sequence_manager_perftest.cc b/base/task/sequence_manager/sequence_manager_perftest.cc index 79fa69d..fb42e87 100644 --- a/base/task/sequence_manager/sequence_manager_perftest.cc +++ b/base/task/sequence_manager/sequence_manager_perftest.cc
@@ -10,6 +10,7 @@ #include "base/bind.h" #include "base/message_loop/message_loop.h" #include "base/message_loop/message_pump_default.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/sequence_checker.h" #include "base/single_thread_task_runner.h" @@ -167,7 +168,7 @@ public: SequenceManagerWithMessagePumpPerfTestDelegate( const char* name, - MessagePump::Type type, + MessagePumpType type, bool randomised_sampling_enabled = false) : name_(name) { auto settings = @@ -583,20 +584,20 @@ case PerfTestType::kUseSequenceManagerWithMessagePump: return std::make_unique<SequenceManagerWithMessagePumpPerfTestDelegate>( " SequenceManager with MessagePumpDefault ", - MessagePump::Type::DEFAULT); + MessagePumpType::DEFAULT); case PerfTestType::kUseSequenceManagerWithUIMessagePump: return std::make_unique<SequenceManagerWithMessagePumpPerfTestDelegate>( - " SequenceManager with MessagePumpForUI ", MessagePump::Type::UI); + " SequenceManager with MessagePumpForUI ", MessagePumpType::UI); case PerfTestType::kUseSequenceManagerWithIOMessagePump: return std::make_unique<SequenceManagerWithMessagePumpPerfTestDelegate>( - " SequenceManager with MessagePumpForIO ", MessagePump::Type::IO); + " SequenceManager with MessagePumpForIO ", MessagePumpType::IO); case PerfTestType::kUseSequenceManagerWithMessagePumpAndRandomSampling: return std::make_unique<SequenceManagerWithMessagePumpPerfTestDelegate>( " SequenceManager with MessagePumpDefault and random sampling ", - MessagePump::Type::DEFAULT, true); + MessagePumpType::DEFAULT, true); case PerfTestType::kUseSingleThreadInThreadPool: return std::make_unique<SingleThreadInThreadPoolPerfTestDelegate>();
diff --git a/base/task/sequence_manager/task_queue_unittest.cc b/base/task/sequence_manager/task_queue_unittest.cc index 5b6842f..df2123a 100644 --- a/base/task/sequence_manager/task_queue_unittest.cc +++ b/base/task/sequence_manager/task_queue_unittest.cc
@@ -4,6 +4,8 @@ #include "base/task/sequence_manager/task_queue.h" +#include "base/message_loop/message_pump.h" +#include "base/message_loop/message_pump_type.h" #include "base/task/sequence_manager/sequence_manager.h" #include "base/task/sequence_manager/test/sequence_manager_for_test.h" #include "testing/gtest/include/gtest/gtest.h" @@ -17,7 +19,7 @@ TEST(TaskQueueTest, TaskQueueVoters) { auto sequence_manager = CreateSequenceManagerOnCurrentThreadWithPump( - MessagePump::Create(MessagePump::Type::DEFAULT)); + MessagePump::Create(MessagePumpType::DEFAULT)); auto queue = sequence_manager->CreateTaskQueue(TaskQueue::Spec("test")); @@ -66,7 +68,7 @@ TEST(TaskQueueTest, ShutdownQueueBeforeEnabledVoterDeleted) { auto sequence_manager = CreateSequenceManagerOnCurrentThreadWithPump( - MessagePump::Create(MessagePump::Type::DEFAULT)); + MessagePump::Create(MessagePumpType::DEFAULT)); auto queue = sequence_manager->CreateTaskQueue(TaskQueue::Spec("test")); std::unique_ptr<TaskQueue::QueueEnabledVoter> voter = @@ -81,7 +83,7 @@ TEST(TaskQueueTest, ShutdownQueueBeforeDisabledVoterDeleted) { auto sequence_manager = CreateSequenceManagerOnCurrentThreadWithPump( - MessagePump::Create(MessagePump::Type::DEFAULT)); + MessagePump::Create(MessagePumpType::DEFAULT)); auto queue = sequence_manager->CreateTaskQueue(TaskQueue::Spec("test")); std::unique_ptr<TaskQueue::QueueEnabledVoter> voter =
diff --git a/base/task/sequence_manager/time_domain_unittest.cc b/base/task/sequence_manager/time_domain_unittest.cc index 72012bbe..23a5cba 100644 --- a/base/task/sequence_manager/time_domain_unittest.cc +++ b/base/task/sequence_manager/time_domain_unittest.cc
@@ -8,6 +8,8 @@ #include "base/macros.h" #include "base/memory/ptr_util.h" +#include "base/message_loop/message_pump.h" +#include "base/message_loop/message_pump_type.h" #include "base/task/sequence_manager/sequence_manager_impl.h" #include "base/task/sequence_manager/task_queue_impl.h" #include "base/task/sequence_manager/work_queue.h" @@ -392,7 +394,7 @@ } TEST_F(TimeDomainTest, SetNextWakeUpForQueueInThePast) { - constexpr auto kType = MessagePump::Type::DEFAULT; + constexpr auto kType = MessagePumpType::DEFAULT; constexpr auto kDelay = TimeDelta::FromMilliseconds(20); SimpleTestTickClock clock; auto sequence_manager = sequence_manager::CreateUnboundSequenceManager(
diff --git a/base/task/single_thread_task_executor.cc b/base/task/single_thread_task_executor.cc index 2c52470..7e12b78 100644 --- a/base/task/single_thread_task_executor.cc +++ b/base/task/single_thread_task_executor.cc
@@ -4,14 +4,13 @@ #include "base/task/single_thread_task_executor.h" -#include "base/message_loop/message_pump.h" #include "base/task/sequence_manager/sequence_manager.h" #include "base/task/sequence_manager/sequence_manager_impl.h" #include "build/build_config.h" namespace base { -SingleThreadTaskExecutor::SingleThreadTaskExecutor(MessagePump::Type type) +SingleThreadTaskExecutor::SingleThreadTaskExecutor(MessagePumpType type) : sequence_manager_(sequence_manager::CreateUnboundSequenceManager( sequence_manager::SequenceManager::Settings::Builder() .SetMessagePumpType(type) @@ -23,7 +22,7 @@ sequence_manager_->BindToMessagePump(MessagePump::Create(type)); #if defined(OS_IOS) - if (type == MessagePump::Type::UI) { + if (type == MessagePumpType::UI) { static_cast<sequence_manager::internal::SequenceManagerImpl*>( sequence_manager_.get()) ->AttachToMessagePump();
diff --git a/base/task/single_thread_task_executor.h b/base/task/single_thread_task_executor.h index ac62095c..497d810 100644 --- a/base/task/single_thread_task_executor.h +++ b/base/task/single_thread_task_executor.h
@@ -5,8 +5,12 @@ #ifndef BASE_TASK_SINGLE_THREAD_TASK_EXECUTOR_H_ #define BASE_TASK_SINGLE_THREAD_TASK_EXECUTOR_H_ +#include <memory> + #include "base/base_export.h" -#include "base/message_loop/message_loop.h" +#include "base/memory/scoped_refptr.h" +#include "base/message_loop/message_pump_type.h" +#include "base/single_thread_task_runner.h" namespace base { @@ -21,7 +25,7 @@ class BASE_EXPORT SingleThreadTaskExecutor { public: explicit SingleThreadTaskExecutor( - MessagePump::Type type = MessagePump::Type::DEFAULT); + MessagePumpType type = MessagePumpType::DEFAULT); // Shuts down the SingleThreadTaskExecutor, after this no tasks can be // executed and the base::TaskExecutor APIs are non-functional but won't crash @@ -30,12 +34,12 @@ scoped_refptr<SingleThreadTaskRunner> task_runner() const; - MessagePump::Type type() const { return type_; } + MessagePumpType type() const { return type_; } private: std::unique_ptr<sequence_manager::SequenceManager> sequence_manager_; scoped_refptr<sequence_manager::TaskQueue> default_task_queue_; - MessagePump::Type type_; + MessagePumpType type_; DISALLOW_COPY_AND_ASSIGN(SingleThreadTaskExecutor); };
diff --git a/base/test/scoped_task_environment.cc b/base/test/scoped_task_environment.cc index 250c0ff..a57d279 100644 --- a/base/test/scoped_task_environment.cc +++ b/base/test/scoped_task_environment.cc
@@ -12,6 +12,7 @@ #include "base/logging.h" #include "base/memory/ptr_util.h" #include "base/message_loop/message_pump.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/synchronization/condition_variable.h" #include "base/synchronization/lock.h" @@ -45,18 +46,18 @@ namespace { -base::MessagePump::Type GetMessagePumpTypeForMainThreadType( +base::MessagePumpType GetMessagePumpTypeForMainThreadType( ScopedTaskEnvironment::MainThreadType main_thread_type) { switch (main_thread_type) { case ScopedTaskEnvironment::MainThreadType::DEFAULT: - return MessagePump::Type::DEFAULT; + return MessagePumpType::DEFAULT; case ScopedTaskEnvironment::MainThreadType::UI: - return MessagePump::Type::UI; + return MessagePumpType::UI; case ScopedTaskEnvironment::MainThreadType::IO: - return MessagePump::Type::IO; + return MessagePumpType::IO; } NOTREACHED(); - return MessagePump::Type::DEFAULT; + return MessagePumpType::DEFAULT; } std::unique_ptr<sequence_manager::SequenceManager>
diff --git a/base/threading/platform_thread_win.cc b/base/threading/platform_thread_win.cc index 35cc6a57..07f09c87 100644 --- a/base/threading/platform_thread_win.cc +++ b/base/threading/platform_thread_win.cc
@@ -8,10 +8,13 @@ #include "base/debug/activity_tracker.h" #include "base/debug/alias.h" +#include "base/debug/crash_logging.h" #include "base/debug/dump_without_crashing.h" #include "base/debug/profiler.h" #include "base/logging.h" #include "base/metrics/histogram_macros.h" +#include "base/process/memory.h" +#include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/threading/scoped_blocking_call.h" #include "base/threading/thread_id_name_manager.h" @@ -149,8 +152,23 @@ if (!thread_handle) { DWORD last_error = ::GetLastError(); - base::debug::Alias(&last_error); - base::debug::DumpWithoutCrashing(); + + switch (last_error) { + case ERROR_NOT_ENOUGH_MEMORY: + case ERROR_OUTOFMEMORY: + case ERROR_COMMITMENT_LIMIT: + TerminateBecauseOutOfMemory(stack_size); + break; + + default: + static auto* last_error_crash_key = debug::AllocateCrashKeyString( + "create_thread_last_error", debug::CrashKeySize::Size32); + debug::SetCrashKeyString(last_error_crash_key, + base::NumberToString(last_error)); + debug::Alias(&last_error); + debug::DumpWithoutCrashing(); + break; + } delete params; return false;
diff --git a/base/threading/thread.h b/base/threading/thread.h index 4e18fbe9..e1a5227 100644 --- a/base/threading/thread.h +++ b/base/threading/thread.h
@@ -83,7 +83,7 @@ // Specifies the type of message pump that will be allocated on the thread. // This is ignored if message_pump_factory.is_null() is false. - MessagePumpType message_pump_type = MessagePump::Type::DEFAULT; + MessagePumpType message_pump_type = MessagePumpType::DEFAULT; // An unbound TaskEnvironment that will be bound to the thread. Ownership // of |task_environment| will be transferred to the thread.
diff --git a/base/threading/thread_unittest.cc b/base/threading/thread_unittest.cc index 42e59d5..22880e6 100644 --- a/base/threading/thread_unittest.cc +++ b/base/threading/thread_unittest.cc
@@ -544,7 +544,7 @@ void BindToCurrentThread(base::TimerSlack timer_slack) override { sequence_manager_->BindToMessagePump( - base::MessagePump::Create(base::MessagePump::Type::DEFAULT)); + base::MessagePump::Create(base::MessagePumpType::DEFAULT)); sequence_manager_->SetTimerSlack(timer_slack); }
diff --git a/base/trace_event/builtin_categories.h b/base/trace_event/builtin_categories.h index 7c0723ff..b50d4123 100644 --- a/base/trace_event/builtin_categories.h +++ b/base/trace_event/builtin_categories.h
@@ -85,6 +85,7 @@ X("latencyInfo") \ X("leveldb") \ X("loading") \ + X("log") \ X("login") \ X("media") \ X("media_router") \
diff --git a/base/trace_event/common/trace_event_common.h b/base/trace_event/common/trace_event_common.h index cbd80fc..57ac025 100644 --- a/base/trace_event/common/trace_event_common.h +++ b/base/trace_event/common/trace_event_common.h
@@ -958,6 +958,9 @@ #define TRACE_TASK_EXECUTION(run_function, task) \ INTERNAL_TRACE_TASK_EXECUTION(run_function, task) +#define TRACE_LOG_MESSAGE(file, message, line) \ + INTERNAL_TRACE_LOG_MESSAGE(file, message, line) + // TRACE_EVENT_METADATA* events are information related to other // injected events, not events in their own right. #define TRACE_EVENT_METADATA1(category_group, name, arg1_name, arg1_val) \
diff --git a/base/trace_event/log_message.cc b/base/trace_event/log_message.cc new file mode 100644 index 0000000..e6b02e44 --- /dev/null +++ b/base/trace_event/log_message.cc
@@ -0,0 +1,47 @@ +// Copyright 2019 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 "base/trace_event/log_message.h" + +#include <stdint.h> + +#include <string> + +#include "base/json/string_escape.h" +#include "base/strings/stringprintf.h" + +namespace base { +namespace trace_event { + +LogMessage::LogMessage(const char* file, base::StringPiece message, int line) + : file_(file), message_(message), line_number_(line) {} + +LogMessage::~LogMessage() = default; + +void LogMessage::AppendAsTraceFormat(std::string* out) const { + out->append("{"); + out->append(base::StringPrintf("\"line\":\"%d\",", line_number_)); + out->append("\"message\":"); + base::EscapeJSONString(message_, true, out); + out->append(","); + out->append(base::StringPrintf("\"file\":\"%s\"", file_)); + out->append("}"); +} + +void LogMessage::EstimateTraceMemoryOverhead( + TraceEventMemoryOverhead* overhead) { + overhead->Add(TraceEventMemoryOverhead::kOther, sizeof(this)); + overhead->AddString(message_); +} + +bool LogMessage::AppendToProto(ProtoAppender* appender) { + // LogMessage is handled in a special way in + // track_event_thread_local_event_sink.cc in the function |AddTraceEvent|, so + // this call should never happen. + NOTREACHED(); + return false; +} + +} // namespace trace_event +} // namespace base \ No newline at end of file
diff --git a/base/trace_event/log_message.h b/base/trace_event/log_message.h new file mode 100644 index 0000000..4c8cbcc --- /dev/null +++ b/base/trace_event/log_message.h
@@ -0,0 +1,49 @@ +// Copyright 2019 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 BASE_TRACE_EVENT_LOG_MESSAGE_H_ +#define BASE_TRACE_EVENT_LOG_MESSAGE_H_ + +#include <stddef.h> + +#include <memory> +#include <string> +#include <vector> + +#include "base/macros.h" +#include "base/strings/string_piece.h" +#include "base/trace_event/trace_event_impl.h" + +namespace base { + +class Value; + +namespace trace_event { + +class BASE_EXPORT LogMessage : public ConvertableToTraceFormat { + public: + LogMessage(const char* file, base::StringPiece message, int line); + ~LogMessage() override; + + // ConvertableToTraceFormat class implementation. + void AppendAsTraceFormat(std::string* out) const override; + bool AppendToProto(ProtoAppender* appender) override; + + void EstimateTraceMemoryOverhead(TraceEventMemoryOverhead* overhead) override; + + const char* file() const { return file_; } + const std::string& message() const { return message_; } + int line_number() const { return line_number_; } + + private: + const char* file_; + std::string message_; + int line_number_; + DISALLOW_COPY_AND_ASSIGN(LogMessage); +}; + +} // namespace trace_event +} // namespace base + +#endif // BASE_TRACE_EVENT_LOG_MESSAGE_H_ \ No newline at end of file
diff --git a/base/trace_event/thread_instruction_count.cc b/base/trace_event/thread_instruction_count.cc index 2b04b99..d73e47c 100644 --- a/base/trace_event/thread_instruction_count.cc +++ b/base/trace_event/thread_instruction_count.cc
@@ -105,7 +105,9 @@ uint64_t instructions = 0; ssize_t bytes_read = read(fd, &instructions, sizeof(instructions)); - DCHECK_EQ(bytes_read, static_cast<ssize_t>(sizeof(instructions))); + CHECK_EQ(bytes_read, static_cast<ssize_t>(sizeof(instructions))) + << "Short reads of small size from kernel memory is not expected. If " + "this fails, use HANDLE_EINTR."; return ThreadInstructionCount(instructions); #endif // defined(OS_LINUX) return ThreadInstructionCount();
diff --git a/base/trace_event/trace_event.h b/base/trace_event/trace_event.h index ac241e4..08f8ea80 100644 --- a/base/trace_event/trace_event.h +++ b/base/trace_event/trace_event.h
@@ -22,6 +22,7 @@ #include "base/trace_event/builtin_categories.h" #include "base/trace_event/common/trace_event_common.h" #include "base/trace_event/heap_profiler.h" +#include "base/trace_event/log_message.h" #include "base/trace_event/thread_instruction_count.h" #include "base/trace_event/trace_arguments.h" #include "base/trace_event/trace_category.h" @@ -431,6 +432,12 @@ } \ } while (0) +#define INTERNAL_TRACE_LOG_MESSAGE(file, message, line) \ + TRACE_EVENT_INSTANT1( \ + "log", "LogMessage", \ + TRACE_EVENT_FLAG_TYPED_PROTO_ARGS | TRACE_EVENT_SCOPE_THREAD, "message", \ + std::make_unique<base::trace_event::LogMessage>(file, message, line)) + #if BUILDFLAG(ENABLE_LOCATION_SOURCE) // Implementation detail: internal macro to trace a task execution with the
diff --git a/build/android/list_class_verification_failures.py b/build/android/list_class_verification_failures.py index 5ff5adc..cfcb2ac 100755 --- a/build/android/list_class_verification_failures.py +++ b/build/android/list_class_verification_failures.py
@@ -124,7 +124,7 @@ device.RunShellCommand(['oatdump', '--oat-file=' + odex_file, '--output=' + out_file], - shell=True, check_return=True) + timeout=120, shell=True, check_return=True) class JavaClass(object):
diff --git a/build/android/pylib/gtest/gtest_test_instance.py b/build/android/pylib/gtest/gtest_test_instance.py index 6db67b7..2b2c5e7 100644 --- a/build/android/pylib/gtest/gtest_test_instance.py +++ b/build/android/pylib/gtest/gtest_test_instance.py
@@ -29,13 +29,14 @@ ] RUN_IN_SUB_THREAD_TEST_SUITES = [ - # Multiprocess tests should be run outside of the main thread. - 'base_unittests', # file_locking_unittest.cc uses a child process. - 'ipc_perftests', - 'ipc_tests', - 'mojo_perftests', - 'mojo_unittests', - 'net_unittests' + # Multiprocess tests should be run outside of the main thread. + 'base_unittests', # file_locking_unittest.cc uses a child process. + 'gwp_asan_unittests', + 'ipc_perftests', + 'ipc_tests', + 'mojo_perftests', + 'mojo_unittests', + 'net_unittests' ]
diff --git a/build/android/stacktrace/crashpad_stackwalker.py b/build/android/stacktrace/crashpad_stackwalker.py index a538105..6be71ca 100755 --- a/build/android/stacktrace/crashpad_stackwalker.py +++ b/build/android/stacktrace/crashpad_stackwalker.py
@@ -46,6 +46,8 @@ build_path, '--binary', unstripped_library_path, + '--platform', + 'android', ] return_code = subprocess.call(cmd) if return_code != 0:
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn index f9d5a2e5..59ab781 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn
@@ -600,9 +600,12 @@ 1) _output_name = string_replace(_output_name, _magic_prefix, "", 1) - _shlib_extension = ".so" - if (is_component_build && _target_type != "loadable_module") { + if (defined(output_extension)) { + _shlib_extension = ".$output_extension" + } else if (is_component_build && _target_type != "loadable_module") { _shlib_extension = ".cr.so" + } else { + _shlib_extension = ".so" } metadata = {
diff --git a/build/fuchsia/layout_test_proxy/layout_test_proxy.cc b/build/fuchsia/layout_test_proxy/layout_test_proxy.cc index 0d2117b2..bc36a4a 100644 --- a/build/fuchsia/layout_test_proxy/layout_test_proxy.cc +++ b/build/fuchsia/layout_test_proxy/layout_test_proxy.cc
@@ -3,6 +3,8 @@ // found in the LICENSE file. #include "base/command_line.h" +#include "base/message_loop/message_pump_type.h" +#include "base/run_loop.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" #include "base/task/single_thread_task_executor.h" @@ -55,7 +57,7 @@ return 1; } - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); std::vector<std::unique_ptr<net::TcpSocketProxy>> proxies;
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index df757a60..9b96906 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -8906254133666028832 \ No newline at end of file +8906223823811531696 \ No newline at end of file
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index 1e20e6e..ca51c387 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -8906256854985066048 \ No newline at end of file +8906227347135980880 \ No newline at end of file
diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni index e34dd34..1f66d99 100644 --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni
@@ -876,7 +876,6 @@ "java/src/org/chromium/chrome/browser/metrics/UmaSessionStats.java", "java/src/org/chromium/chrome/browser/metrics/UmaUtils.java", "java/src/org/chromium/chrome/browser/metrics/VariationsSession.java", - "java/src/org/chromium/chrome/browser/metrics/WebappSplashUmaCache.java", "java/src/org/chromium/chrome/browser/metrics/WebApkSplashscreenMetrics.java", "java/src/org/chromium/chrome/browser/metrics/WebApkUma.java", "java/src/org/chromium/chrome/browser/modaldialog/AppModalPresenter.java",
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandlerImpl.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandlerImpl.java index a3a24d1..201a2be0 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandlerImpl.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandlerImpl.java
@@ -7,8 +7,10 @@ import android.content.Context; import android.os.Bundle; import android.support.annotation.Nullable; +import android.util.Base64; import org.chromium.base.Callback; +import org.chromium.base.Log; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.widget.ScrimView; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetController; @@ -22,6 +24,8 @@ * A handler that provides Autofill Assistant actions for a specific activity. */ class AutofillAssistantActionHandlerImpl implements AutofillAssistantActionHandler { + private static final String TAG = "AutofillAssistant"; + private final Context mContext; private final BottomSheetController mBottomSheetController; private final ScrimView mScrimView; @@ -36,8 +40,8 @@ } @Override - public void listActions(String userName, String experimentIds, Bundle arguments, - Callback<Set<String>> callback) { + public void listActions(String userName, String experimentIds, String scriptBundle, + Bundle arguments, Callback<Set<String>> callback) { if (!AutofillAssistantPreferencesUtil.isAutofillOnboardingAccepted()) { callback.onResult(Collections.emptySet()); return; @@ -47,8 +51,16 @@ callback.onResult(Collections.emptySet()); return; } - - client.listDirectActions(userName, experimentIds, toArgumentMap(arguments), callback); + byte[] scriptBundleBytes = null; + if (!scriptBundle.isEmpty()) { + try { + scriptBundleBytes = Base64.decode(scriptBundle, Base64.DEFAULT); + } catch (IllegalArgumentException e) { + Log.v(TAG, "Invalid script_bundle parameter value: base64 decoding failed."); + } + } + client.listDirectActions( + userName, experimentIds, scriptBundleBytes, toArgumentMap(arguments), callback); } @Override
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantClient.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantClient.java index 7e631ac75..627fdaa9e 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantClient.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantClient.java
@@ -135,7 +135,8 @@ /** Lists available direct actions. */ public void listDirectActions(String userName, String experimentIds, - Map<String, String> arguments, Callback<Set<String>> callback) { + @Nullable byte[] scriptBundle, Map<String, String> arguments, + Callback<Set<String>> callback) { if (mNativeClientAndroid == 0) { callback.onResult(Collections.emptySet()); return; @@ -145,7 +146,7 @@ // The native side calls sendDirectActionList() on the callback once the controller has // results. - nativeListDirectActions(mNativeClientAndroid, experimentIds, + nativeListDirectActions(mNativeClientAndroid, experimentIds, scriptBundle, arguments.keySet().toArray(new String[arguments.size()]), arguments.values().toArray(new String[arguments.size()]), callback); } @@ -334,7 +335,8 @@ private native void nativeDestroyUI(long nativeClientAndroid); private native void nativeTransferUITo(long nativeClientAndroid, Object otherWebContents); private native void nativeListDirectActions(long nativeClientAndroid, String experimentIds, - String[] argumentNames, String[] argumentValues, Object callback); + @Nullable byte[] scriptBundle, String[] argumentNames, String[] argumentValues, + Object callback); private native boolean nativePerformDirectAction(long nativeClientAndroid, String actionId, String experimentId, String[] argumentNames, String[] argumentValues, @Nullable AssistantOnboardingCoordinator onboardingCoordinator);
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandlerTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandlerTest.java index 607d31d1..f7d59f13 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandlerTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandlerTest.java
@@ -88,13 +88,16 @@ FakeDirectActionDefinition list = reporter.mActions.get(0); assertEquals("list_assistant_actions", list.mId); - assertEquals(2, list.mParameters.size()); + assertEquals(3, list.mParameters.size()); assertEquals("user_name", list.mParameters.get(0).mName); assertEquals(Type.STRING, list.mParameters.get(0).mType); assertEquals(false, list.mParameters.get(0).mRequired); assertEquals("experiment_ids", list.mParameters.get(1).mName); assertEquals(Type.STRING, list.mParameters.get(1).mType); assertEquals(false, list.mParameters.get(1).mRequired); + assertEquals("script_bundle", list.mParameters.get(2).mName); + assertEquals(Type.STRING, list.mParameters.get(2).mType); + assertEquals(false, list.mParameters.get(2).mRequired); assertEquals(1, list.mResults.size()); assertEquals("names", list.mResults.get(0).mName);
diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandler.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandler.java index b3c25bd..5d5486b 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandler.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandler.java
@@ -22,10 +22,11 @@ * * @param userName name of the user to use when sending RPCs. Might be empty. * @param experimentIds comma-separated set of experiment ids. Might be empty + * @param scriptBundle an optional ScriptBundle proto, base64 encoded. Usually empty. * @param arguments extra arguments to include into the RPC. Might be empty. * @param callback callback to report the result to */ - void listActions(String userName, String experimentIds, Bundle arguments, + void listActions(String userName, String experimentIds, String scriptBundle, Bundle arguments, Callback<Set<String>> callback); /** Performs onboarding and returns the result to the callback. */
diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandler.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandler.java index c1b53f9..bc12444d 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandler.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandler.java
@@ -32,6 +32,7 @@ private static final String ACTION_NAME = "name"; private static final String EXPERIMENT_IDS = "experiment_ids"; private static final String ONBOARDING_ACTION = "onboarding"; + private static final String SCRIPT_BUNDLE = "script_bundle"; private static final String USER_NAME = "user_name"; /** @@ -66,6 +67,7 @@ reporter.addDirectAction(LIST_AA_ACTIONS) .withParameter(USER_NAME, Type.STRING, /* required= */ false) .withParameter(EXPERIMENT_IDS, Type.STRING, /* required= */ false) + .withParameter(SCRIPT_BUNDLE, Type.STRING, /* required= */ false) .withResult(LIST_AA_ACTIONS_RESULT, Type.STRING); reporter.addDirectAction(PERFORM_AA_ACTION) @@ -111,12 +113,15 @@ String experimentIds = arguments.getString(EXPERIMENT_IDS, ""); arguments.remove(EXPERIMENT_IDS); + String scriptBundle = arguments.getString(SCRIPT_BUNDLE, ""); + arguments.remove(SCRIPT_BUNDLE); + getDelegate(/* installIfNecessary= */ false, (delegate) -> { if (delegate == null) { namesCallback.onResult(FALLBACK_ACTION_SET); return; } - delegate.listActions(userName, experimentIds, arguments, namesCallback); + delegate.listActions(userName, experimentIds, scriptBundle, arguments, namesCallback); }); }
diff --git a/chrome/android/java/monochrome_public_bundle.proguard_flags.expected b/chrome/android/java/monochrome_public_bundle.proguard_flags.expected index c8cfc29..5e3df65 100644 --- a/chrome/android/java/monochrome_public_bundle.proguard_flags.expected +++ b/chrome/android/java/monochrome_public_bundle.proguard_flags.expected
@@ -222,10 +222,10 @@ # Never inline classes or methods with this annotation, but allow shrinking and # obfuscation. --keepnames,allowobfuscation @org.chromium.base.annotations.DoNotInline class ** { - *; +-keep,allowobfuscation,allowoptimization @org.chromium.base.annotations.DoNotInline class ** { + <methods>; } --keepclassmembernames,allowobfuscation class ** { +-keepclassmembers,allowobfuscation,allowoptimization class ** { @org.chromium.base.annotations.DoNotInline <methods>; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java b/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java index 162fc3ca..d0916c7 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java
@@ -198,7 +198,7 @@ // Check if we should launch a WebApk to handle the intent. // For NoTouchMode, prefer to launch PWAs instead of the browser on view intents. - if (FeatureUtilities.isNoTouchModeEnabled() && url != null + if (!mIsCustomTabIntent && FeatureUtilities.isNoTouchModeEnabled() && url != null && Intent.ACTION_VIEW.equals(mIntent.getAction())) { String packageName = WebApkValidator.queryFirstWebApkPackage( ContextUtils.getApplicationContext(), url);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/metrics/OWNERS b/chrome/android/java/src/org/chromium/chrome/browser/metrics/OWNERS new file mode 100644 index 0000000..c7e9d39 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/metrics/OWNERS
@@ -0,0 +1 @@ +per-file WebApk*=file://chrome/android/java/src/org/chromium/chrome/browser/webapps/OWNERS
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/metrics/WebappSplashUmaCache.java b/chrome/android/java/src/org/chromium/chrome/browser/metrics/WebappSplashUmaCache.java deleted file mode 100644 index f2f8468..0000000 --- a/chrome/android/java/src/org/chromium/chrome/browser/metrics/WebappSplashUmaCache.java +++ /dev/null
@@ -1,143 +0,0 @@ -// Copyright 2015 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. - -package org.chromium.chrome.browser.metrics; - -import android.support.annotation.IntDef; - -import org.chromium.base.metrics.RecordHistogram; -import org.chromium.webapk.lib.common.splash.SplashLayout; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -/** - * Used by {@link WebappSplashDelegate} to cache webapp splash screen UMA values. Records UMA - * when {@link #commitMetrics()} is called. - */ -public class WebappSplashUmaCache { - // SplashColorStatus defined in tools/metrics/histograms/enums.xml. - // NUM_ENTRIES is intentionally included into @IntDef. - @IntDef({SplashColorStatus.DEFAULT, SplashColorStatus.CUSTOM, SplashColorStatus.NUM_ENTRIES}) - @Retention(RetentionPolicy.SOURCE) - public @interface SplashColorStatus { - int DEFAULT = 0; - int CUSTOM = 1; - int NUM_ENTRIES = 2; - } - - // SplashIconType defined in tools/metrics/histograms/enums.xml. - // NUM_ENTRIES is intentionally included into @IntDef. - @IntDef({SplashIconType.NONE, SplashIconType.FALLBACK, SplashIconType.CUSTOM, - SplashIconType.CUSTOM_SMALL, SplashIconType.NUM_ENTRIES}) - @Retention(RetentionPolicy.SOURCE) - public @interface SplashIconType { - int NONE = 0; - int FALLBACK = 1; - int CUSTOM = 2; - int CUSTOM_SMALL = 3; - int NUM_ENTRIES = 4; - } - - // Histogram names are defined in tools/metrics/histograms/histograms.xml. - public static final String HISTOGRAM_SPLASHSCREEN_BACKGROUNDCOLOR = - "Webapp.Splashscreen.BackgroundColor"; - public static final String HISTOGRAM_SPLASHSCREEN_ICON_TYPE = "Webapp.Splashscreen.Icon.Type"; - public static final String HISTOGRAM_SPLASHSCREEN_ICON_SIZE = "Webapp.Splashscreen.Icon.Size"; - public static final String HISTOGRAM_SPLASHSCREEN_THEMECOLOR = "Webapp.Splashscreen.ThemeColor"; - - private int mSplashScreenBackgroundColor = SplashColorStatus.NUM_ENTRIES; - private int mSplashScreenIconType = SplashIconType.NUM_ENTRIES; - private int mSplashScreenIconSize = -1; - private int mSplashScreenThemeColor = SplashColorStatus.NUM_ENTRIES; - - private boolean mCommitted; - - /** - * Records the type of background color on the splash screen. - * @param type flag representing the type of color. - */ - public void recordSplashscreenBackgroundColor(@SplashColorStatus int type) { - assert !mCommitted; - mSplashScreenBackgroundColor = type; - } - - /** - * Records the type of icon on the splash screen. - * @param selectedIconClassification - * @param usingDedicatedIcon Whether the PWA provides different icons for the splash screen and - * for the app icon. - */ - public void recordSplashscreenIconType( - @SplashLayout.IconClassification int selectedIconClassification, - boolean usingDedicatedIcon) { - assert !mCommitted; - mSplashScreenIconType = - determineIconTypeForUma(selectedIconClassification, usingDedicatedIcon); - } - - private static @SplashIconType int determineIconTypeForUma( - @SplashLayout.IconClassification int selectedIconClassification, - boolean usingDedicatedIcon) { - if (selectedIconClassification == SplashLayout.IconClassification.INVALID) { - return SplashIconType.NONE; - } - if (!usingDedicatedIcon) { - return SplashIconType.FALLBACK; - } - if (selectedIconClassification == SplashLayout.IconClassification.SMALL) { - return SplashIconType.CUSTOM_SMALL; - } - return SplashIconType.CUSTOM; - } - - public void recordSplashscreenIconSize(int size) { - assert !mCommitted; - assert size >= 0; - mSplashScreenIconSize = size; - } - - /** - * Records the type of theme color on the splash screen. - * @param type flag representing the type of color. - */ - public void recordSplashscreenThemeColor(@SplashColorStatus int type) { - assert !mCommitted; - mSplashScreenThemeColor = type; - } - - /** - * Records all metrics that could not be recorded because the native library - * was not loaded yet. - */ - public void commitMetrics() { - if (mCommitted) return; - - mCommitted = true; - - assert mSplashScreenBackgroundColor != SplashColorStatus.NUM_ENTRIES; - RecordHistogram.recordEnumeratedHistogram(HISTOGRAM_SPLASHSCREEN_BACKGROUNDCOLOR, - mSplashScreenBackgroundColor, SplashColorStatus.NUM_ENTRIES); - mSplashScreenBackgroundColor = SplashColorStatus.NUM_ENTRIES; - - assert mSplashScreenIconType != SplashIconType.NUM_ENTRIES; - RecordHistogram.recordEnumeratedHistogram(HISTOGRAM_SPLASHSCREEN_ICON_TYPE, - mSplashScreenIconType, SplashIconType.NUM_ENTRIES); - - if (mSplashScreenIconType == SplashIconType.NONE) { - assert mSplashScreenIconSize == -1; - } else { - assert mSplashScreenIconSize >= 0; - RecordHistogram.recordCount1000Histogram( - HISTOGRAM_SPLASHSCREEN_ICON_SIZE, mSplashScreenIconSize); - } - mSplashScreenIconType = SplashIconType.NUM_ENTRIES; - mSplashScreenIconSize = -1; - - assert mSplashScreenThemeColor != SplashColorStatus.NUM_ENTRIES; - RecordHistogram.recordEnumeratedHistogram(HISTOGRAM_SPLASHSCREEN_THEMECOLOR, - mSplashScreenThemeColor, SplashColorStatus.NUM_ENTRIES); - mSplashScreenThemeColor = SplashColorStatus.NUM_ENTRIES; - } -}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java index a854524..a678f12 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageLayout.java
@@ -70,12 +70,6 @@ public class NewTabPageLayout extends LinearLayout implements TileGroup.Observer, VrModeObserver { private static final String TAG = "NewTabPageLayout"; - /** - * Parameter for the simplified NTP ablation experiment arm which removes the additional - * suggestions sections without replacing them with shortcut buttons. - */ - private static final String PARAM_SIMPLIFIED_NTP_ABLATION = "simplified_ntp_ablation"; - private final int mTileGridLayoutBleed; private View mMiddleSpacer; // Spacer between toolbar and Most Likely. @@ -87,7 +81,6 @@ private ImageView mVoiceSearchButton; private View mTileGridPlaceholder; private View mNoSearchLogoSpacer; - private ViewGroup mShortcutsView; @Nullable private View mExploreSectionView; // View is null if explore flag is disabled. @@ -558,7 +551,6 @@ int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { View child = getChildAt(i); - if (mShortcutsView != null && child == mShortcutsView) break; if (child == mSiteSectionViewHolder.itemView) break; // Don't change the visibility of a ViewStub as that will automagically inflate it. @@ -582,17 +574,10 @@ * Updates the padding for the tile grid based on what is shown above it. */ private void updateTileGridPadding() { - int paddingTop; - if (mShortcutsView != null) { - // If the shortcuts view is visible, padding will be built into that view. - paddingTop = 0; - } else { - // Set a bit more top padding on the tile grid if there is no logo. - paddingTop = getResources().getDimensionPixelSize(shouldShowLogo() - ? R.dimen.tile_grid_layout_padding_top - : R.dimen.tile_grid_layout_no_logo_padding_top); - } - + // Set a bit more top padding on the tile grid if there is no logo. + int paddingTop = getResources().getDimensionPixelSize(shouldShowLogo() + ? R.dimen.tile_grid_layout_padding_top + : R.dimen.tile_grid_layout_no_logo_padding_top); mSiteSectionViewHolder.itemView.setPadding( 0, paddingTop, 0, mSiteSectionViewHolder.itemView.getPaddingBottom()); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/InterceptNavigationDelegateImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/InterceptNavigationDelegateImpl.java index 9e5421d..20d715f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/InterceptNavigationDelegateImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/InterceptNavigationDelegateImpl.java
@@ -127,7 +127,8 @@ .setTab(mTab) .setOpenInNewTab(true) .build(); - return mExternalNavHandler.shouldOverrideUrlLoading(params) + mLastOverrideUrlLoadingResult = mExternalNavHandler.shouldOverrideUrlLoading(params); + return mLastOverrideUrlLoadingResult != ExternalNavigationHandler.OverrideUrlLoadingResult.NO_OVERRIDE; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java index 029e6ec..c467487 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java
@@ -849,8 +849,8 @@ protected void initSplash() { // Splash screen is shown after preInflationStartup() is run and the delegate is set. boolean isWindowInitiallyTranslucent = mWebappInfo.isSplashProvidedByWebApk(); - mSplashController.setConfig(new WebappSplashDelegate(this, getLifecycleDispatcher(), - mTabObserverRegistrar, mWebappInfo), + mSplashController.setConfig( + new WebappSplashDelegate(this, mTabObserverRegistrar, mWebappInfo), isWindowInitiallyTranslucent, WebappSplashDelegate.HIDE_ANIMATION_DURATION_MS); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappSplashDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappSplashDelegate.java index 77d7470d..2d7a2a3 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappSplashDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappSplashDelegate.java
@@ -9,7 +9,6 @@ import android.content.res.Resources; import android.graphics.Bitmap; import android.net.Uri; -import android.util.DisplayMetrics; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; @@ -19,9 +18,6 @@ import org.chromium.base.FileUtils; import org.chromium.base.StrictModeContext; import org.chromium.base.metrics.RecordHistogram; -import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher; -import org.chromium.chrome.browser.lifecycle.NativeInitObserver; -import org.chromium.chrome.browser.metrics.WebappSplashUmaCache; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabObserverRegistrar; import org.chromium.chrome.browser.util.ColorUtils; @@ -29,47 +25,29 @@ import org.chromium.webapk.lib.common.splash.SplashLayout; /** Delegate for splash screen for webapps and WebAPKs. */ -public class WebappSplashDelegate implements SplashDelegate, NativeInitObserver { +public class WebappSplashDelegate implements SplashDelegate { public static final int HIDE_ANIMATION_DURATION_MS = 300; - public static final String HISTOGRAM_SPLASHSCREEN_DURATION = "Webapp.Splashscreen.Duration"; public static final String HISTOGRAM_SPLASHSCREEN_HIDES = "Webapp.Splashscreen.Hides"; - private Activity mActivity; - private ActivityLifecycleDispatcher mLifecycleDispatcher; private TabObserverRegistrar mTabObserverRegistrar; - /** Whether native was loaded. Native must be loaded in order to record metrics. */ - private boolean mNativeLoaded; - private WebappInfo mWebappInfo; - private WebappSplashUmaCache mWebappSplashUmaCache; - private WebApkSplashNetworkErrorObserver mWebApkNetworkErrorObserver; - public WebappSplashDelegate(Activity activity, ActivityLifecycleDispatcher lifecycleDispatcher, - TabObserverRegistrar tabObserverRegistrar, WebappInfo webappInfo) { - mActivity = activity; - mLifecycleDispatcher = lifecycleDispatcher; + public WebappSplashDelegate( + Activity activity, TabObserverRegistrar tabObserverRegistrar, WebappInfo webappInfo) { mTabObserverRegistrar = tabObserverRegistrar; mWebappInfo = webappInfo; - mLifecycleDispatcher.register(this); - if (mWebappInfo.isForWebApk()) { mWebApkNetworkErrorObserver = - new WebApkSplashNetworkErrorObserver(mActivity, mWebappInfo.name()); + new WebApkSplashNetworkErrorObserver(activity, mWebappInfo.name()); mTabObserverRegistrar.registerTabObserver(mWebApkNetworkErrorObserver); } } @Override - public void onFinishNativeInitialization() { - mNativeLoaded = true; - if (mWebappSplashUmaCache != null) mWebappSplashUmaCache.commitMetrics(); - } - - @Override public View buildSplashView() { Context appContext = ContextUtils.getApplicationContext(); int backgroundColor = @@ -88,11 +66,9 @@ tab.removeObserver(mWebApkNetworkErrorObserver); mWebApkNetworkErrorObserver = null; } - mLifecycleDispatcher.unregister(this); - recordSplashHiddenUma(reason, startTimestamp, endTimestamp); - - mActivity = null; + RecordHistogram.recordEnumeratedHistogram(HISTOGRAM_SPLASHSCREEN_HIDES, reason, + SplashController.SplashHidesReason.NUM_ENTRIES); } @Override @@ -142,47 +118,9 @@ selectedIconGenerated = mWebappInfo.isIconGenerated(); selectedIconAdaptive = mWebappInfo.isIconAdaptive(); } - @SplashLayout.IconClassification - int selectedIconClassification = SplashLayout.classifyIcon( - context.getResources(), selectedIcon, selectedIconGenerated); - SplashLayout.createLayout(context, splashScreen, selectedIcon, selectedIconAdaptive, - selectedIconClassification, mWebappInfo.name(), + selectedIconGenerated, mWebappInfo.name(), ColorUtils.shouldUseLightForegroundOnBackground(backgroundColor)); - - recordWebApkInfoSplashUma( - resources, selectedIconClassification, selectedIcon, (splashImage != null)); - } - - /** - * Records UMA metrics for splash screen built from WebApkInfo. - * @param resources - * @param selectedIconClassification. - * @param selectedIcon The icon used on the splash screen. - * @param usingDedicatedIcon Whether the PWA provides different icons for the splash screen and - * for the app icon. - */ - private void recordWebApkInfoSplashUma(Resources resources, - @SplashLayout.IconClassification int selectedIconClassification, Bitmap selectedIcon, - boolean usingDedicatedIcon) { - mWebappSplashUmaCache = new WebappSplashUmaCache(); - mWebappSplashUmaCache.recordSplashscreenBackgroundColor( - mWebappInfo.hasValidBackgroundColor() - ? WebappSplashUmaCache.SplashColorStatus.CUSTOM - : WebappSplashUmaCache.SplashColorStatus.DEFAULT); - mWebappSplashUmaCache.recordSplashscreenThemeColor(mWebappInfo.hasValidThemeColor() - ? WebappSplashUmaCache.SplashColorStatus.CUSTOM - : WebappSplashUmaCache.SplashColorStatus.DEFAULT); - - mWebappSplashUmaCache.recordSplashscreenIconType( - selectedIconClassification, usingDedicatedIcon); - if (selectedIconClassification != SplashLayout.IconClassification.INVALID) { - DisplayMetrics displayMetrics = resources.getDisplayMetrics(); - mWebappSplashUmaCache.recordSplashscreenIconSize(Math.round( - selectedIcon.getScaledWidth(displayMetrics) / displayMetrics.density)); - } - - if (mNativeLoaded) mWebappSplashUmaCache.commitMetrics(); } /** Builds splash screen using screenshot provided by WebAPK. */ @@ -203,14 +141,4 @@ return splashView; } - - /** Called once the splash screen is hidden to record UMA metrics. */ - private void recordSplashHiddenUma(@SplashController.SplashHidesReason int reason, - long startTimestamp, long endTimestamp) { - RecordHistogram.recordEnumeratedHistogram(HISTOGRAM_SPLASHSCREEN_HIDES, reason, - SplashController.SplashHidesReason.NUM_ENTRIES); - - RecordHistogram.recordMediumTimesHistogram( - HISTOGRAM_SPLASHSCREEN_DURATION, endTimestamp - startTimestamp); - } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/UrlOverridingTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/UrlOverridingTest.java index 8b9109a..5c2d708 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/UrlOverridingTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/externalnav/UrlOverridingTest.java
@@ -36,6 +36,7 @@ import org.chromium.chrome.browser.tab.InterceptNavigationDelegateImpl; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabmodel.EmptyTabModelSelectorObserver; +import org.chromium.chrome.browser.tabmodel.SingleTabModel; import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.content_public.browser.LoadUrlParams; @@ -92,10 +93,13 @@ private static class TestTabObserver extends EmptyTabObserver { private final CallbackHelper mFinishCallback; private final CallbackHelper mFailCallback; + private final CallbackHelper mDestroyedCallback; - TestTabObserver(final CallbackHelper finishCallback, final CallbackHelper failCallback) { + TestTabObserver(final CallbackHelper finishCallback, final CallbackHelper failCallback, + final CallbackHelper destroyedCallback) { mFinishCallback = finishCallback; mFailCallback = failCallback; + mDestroyedCallback = destroyedCallback; } @Override @@ -112,7 +116,7 @@ @Override public void onDestroyed(Tab tab) { // A new tab is destroyed when loading is overridden while opening it. - mFailCallback.notifyCalled(); + mDestroyedCallback.notifyCalled(); } } @@ -137,14 +141,16 @@ private void loadUrlAndWaitForIntentUrl(final String url, boolean needClick, boolean shouldLaunchExternalIntent) throws InterruptedException { - loadUrlAndWaitForIntentUrl(url, needClick, 0, shouldLaunchExternalIntent, url); + loadUrlAndWaitForIntentUrl(url, needClick, false, shouldLaunchExternalIntent, url, true); } private void loadUrlAndWaitForIntentUrl(final String url, boolean needClick, - int expectedNewTabCount, final boolean shouldLaunchExternalIntent, - final String expectedFinalUrl) throws InterruptedException { + boolean createsNewTab, final boolean shouldLaunchExternalIntent, + final String expectedFinalUrl, final boolean shouldFailNavigation) + throws InterruptedException { final CallbackHelper finishCallback = new CallbackHelper(); final CallbackHelper failCallback = new CallbackHelper(); + final CallbackHelper destroyedCallback = new CallbackHelper(); final CallbackHelper newTabCallback = new CallbackHelper(); final Tab tab = mActivityTestRule.getActivity().getActivityTab(); @@ -153,14 +159,15 @@ new InterceptNavigationDelegateImpl[1]; latestTabHolder[0] = tab; latestDelegateHolder[0] = getInterceptNavigationDelegate(tab); - tab.addObserver(new TestTabObserver(finishCallback, failCallback)); - if (expectedNewTabCount > 0) { + tab.addObserver(new TestTabObserver(finishCallback, failCallback, destroyedCallback)); + if (createsNewTab) { mActivityTestRule.getActivity().getTabModelSelector().addObserver( new EmptyTabModelSelectorObserver() { @Override public void onNewTabCreated(Tab newTab) { newTabCallback.notifyCalled(); - newTab.addObserver(new TestTabObserver(finishCallback, failCallback)); + newTab.addObserver(new TestTabObserver( + finishCallback, failCallback, destroyedCallback)); latestTabHolder[0] = newTab; latestDelegateHolder[0] = getInterceptNavigationDelegate(newTab); } @@ -190,13 +197,20 @@ TouchCommon.singleClickView(tab.getView()); } - if (failCallback.getCallCount() == 0) { + if (shouldFailNavigation) { try { failCallback.waitForCallback(0, 1, 20, TimeUnit.SECONDS); } catch (TimeoutException ex) { Assert.fail("Haven't received navigation failure of intents."); return; } + } else if (createsNewTab) { + try { + destroyedCallback.waitForCallback(0, 1, 20, TimeUnit.SECONDS); + } catch (TimeoutException ex) { + Assert.fail("Intercepted new tab wasn't destroyed."); + return; + } } boolean hasFallbackUrl = @@ -213,7 +227,7 @@ } } - Assert.assertEquals(expectedNewTabCount, newTabCallback.getCallCount()); + Assert.assertEquals(createsNewTab ? 1 : 0, newTabCallback.getCallCount()); // For sub frames, the |loadFailCallback| run through different threads // from the ExternalNavigationHandler. As a result, there is no guarantee // when url override result would come. @@ -247,8 +261,8 @@ } })); Assert.assertEquals(1 + (hasFallbackUrl ? 1 : 0), finishCallback.getCallCount()); - // failCallback can be called second time when the current tab is destroyed. - Assert.assertTrue(failCallback.getCallCount() >= 1); + + Assert.assertEquals(failCallback.getCallCount(), shouldFailNavigation ? 1 : 0); } private static InterceptNavigationDelegateImpl getInterceptNavigationDelegate(Tab tab) { @@ -332,7 +346,7 @@ + ":" + Base64.encodeToString( ApiCompatibilityUtils.getBytesUtf8(fallbackUrl), Base64.URL_SAFE)); - loadUrlAndWaitForIntentUrl(originalUrl, true, 0, false, fallbackUrl); + loadUrlAndWaitForIntentUrl(originalUrl, true, false, false, fallbackUrl, true); } @Test @@ -368,8 +382,10 @@ @SmallTest @RetryOnFailure public void testOpenWindowFromUserGesture() throws InterruptedException { - loadUrlAndWaitForIntentUrl( - mTestServer.getURL(OPEN_WINDOW_FROM_USER_GESTURE_PAGE), true, 1, true, null); + boolean opensNewTab = + !(mActivityTestRule.getActivity().getCurrentTabModel() instanceof SingleTabModel); + loadUrlAndWaitForIntentUrl(mTestServer.getURL(OPEN_WINDOW_FROM_USER_GESTURE_PAGE), true, + opensNewTab, true, null, false); } @Test
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenBackgroundColorTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenBackgroundColorTest.java index fa227e61..5e77fd7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenBackgroundColorTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenBackgroundColorTest.java
@@ -14,12 +14,10 @@ import org.junit.Test; import org.junit.runner.RunWith; -import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.ShortcutHelper; -import org.chromium.chrome.browser.metrics.WebappSplashUmaCache; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; /** @@ -44,10 +42,5 @@ ColorDrawable background = (ColorDrawable) splashScreen.getBackground(); Assert.assertEquals(Color.GREEN, background.getColor()); - - Assert.assertEquals(1, - RecordHistogram.getHistogramValueCountForTesting( - WebappSplashUmaCache.HISTOGRAM_SPLASHSCREEN_BACKGROUNDCOLOR, - WebappSplashUmaCache.SplashColorStatus.CUSTOM)); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenHomescreenIconTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenHomescreenIconTest.java index f39f9a8..98dcb27 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenHomescreenIconTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenHomescreenIconTest.java
@@ -4,7 +4,6 @@ package org.chromium.chrome.browser.webapps; -import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.support.test.filters.SmallTest; import android.view.ViewGroup; @@ -16,13 +15,11 @@ import org.junit.Test; import org.junit.runner.RunWith; -import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.chrome.R; import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.ShortcutHelper; -import org.chromium.chrome.browser.metrics.WebappSplashUmaCache; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; /** @@ -54,21 +51,4 @@ Assert.assertEquals(192, drawable.getBitmap().getWidth()); Assert.assertEquals(192, drawable.getBitmap().getHeight()); } - - @Test - @SmallTest - @Feature({"Webapps"}) - public void testUmaFallbackIcon() { - Assert.assertEquals(1, - RecordHistogram.getHistogramValueCountForTesting( - WebappSplashUmaCache.HISTOGRAM_SPLASHSCREEN_ICON_TYPE, - WebappSplashUmaCache.SplashIconType.FALLBACK)); - - Bitmap icon = ShortcutHelper.decodeBitmapFromString(WebappActivityTestRule.TEST_ICON); - int sizeInDp = Math.round((float) icon.getWidth() - / mActivityTestRule.getActivity().getResources().getDisplayMetrics().density); - Assert.assertEquals(1, - RecordHistogram.getHistogramValueCountForTesting( - WebappSplashUmaCache.HISTOGRAM_SPLASHSCREEN_ICON_SIZE, sizeInDp)); - } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenIconTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenIconTest.java index 5c4178f1a..27d47d3 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenIconTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenIconTest.java
@@ -4,7 +4,6 @@ package org.chromium.chrome.browser.webapps; -import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.support.test.filters.SmallTest; import android.view.ViewGroup; @@ -16,13 +15,11 @@ import org.junit.Test; import org.junit.runner.RunWith; -import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; import org.chromium.chrome.R; import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.ShortcutHelper; -import org.chromium.chrome.browser.metrics.WebappSplashUmaCache; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; /** @@ -57,22 +54,4 @@ Assert.assertEquals(512, drawable.getBitmap().getWidth()); Assert.assertEquals(512, drawable.getBitmap().getHeight()); } - - @Test - @SmallTest - @Feature({"Webapps"}) - public void testUmaCustomIcon() { - Assert.assertEquals(1, - RecordHistogram.getHistogramValueCountForTesting( - WebappSplashUmaCache.HISTOGRAM_SPLASHSCREEN_ICON_TYPE, - WebappSplashUmaCache.SplashIconType.CUSTOM)); - - Bitmap icon = - ShortcutHelper.decodeBitmapFromString(WebappActivityTestRule.TEST_SPLASH_ICON); - int sizeInDp = Math.round((float) icon.getWidth() - / mActivityTestRule.getActivity().getResources().getDisplayMetrics().density); - Assert.assertEquals(1, - RecordHistogram.getHistogramValueCountForTesting( - WebappSplashUmaCache.HISTOGRAM_SPLASHSCREEN_ICON_SIZE, sizeInDp)); - } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenTest.java index 11aa7109..3031e34 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenTest.java
@@ -29,14 +29,13 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; -import org.chromium.chrome.R; import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.ShortcutHelper; -import org.chromium.chrome.browser.metrics.WebappSplashUmaCache; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabTestUtils; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.content_public.browser.UiThreadTaskTraits; +import org.chromium.webapk.lib.common.splash.R; /** * Tests for splash screens. @@ -173,39 +172,6 @@ mActivityTestRule.startWebappActivityAndWaitForSplashScreen(); // Tests UMA values. - Assert.assertEquals(1, - RecordHistogram.getHistogramValueCountForTesting( - WebappSplashUmaCache.HISTOGRAM_SPLASHSCREEN_BACKGROUNDCOLOR, - WebappSplashUmaCache.SplashColorStatus.DEFAULT)); - Assert.assertEquals(1, - RecordHistogram.getHistogramValueCountForTesting( - WebappSplashUmaCache.HISTOGRAM_SPLASHSCREEN_THEMECOLOR, - WebappSplashUmaCache.SplashColorStatus.DEFAULT)); - Assert.assertEquals(1, - RecordHistogram.getHistogramValueCountForTesting( - WebappSplashUmaCache.HISTOGRAM_SPLASHSCREEN_ICON_TYPE, - WebappSplashUmaCache.SplashIconType.NONE)); - - // Tests UMA counts. - Assert.assertEquals(1, - getHistogramTotalCountFor( - WebappSplashUmaCache.HISTOGRAM_SPLASHSCREEN_BACKGROUNDCOLOR, - WebappSplashUmaCache.SplashColorStatus.NUM_ENTRIES)); - Assert.assertEquals(1, - getHistogramTotalCountFor(WebappSplashUmaCache.HISTOGRAM_SPLASHSCREEN_THEMECOLOR, - WebappSplashUmaCache.SplashColorStatus.NUM_ENTRIES)); - Assert.assertEquals(1, - getHistogramTotalCountFor(WebappSplashUmaCache.HISTOGRAM_SPLASHSCREEN_ICON_TYPE, - WebappSplashUmaCache.SplashIconType.NUM_ENTRIES)); - - // Given that there is no icon, the ICON_SIZE UMA should not be recorded. - Assert.assertEquals(0, - getHistogramTotalCountFor( - WebappSplashUmaCache.HISTOGRAM_SPLASHSCREEN_ICON_SIZE, 50)); - - // DURATION and HIDES UMA should not have been recorded yet. - Assert.assertFalse( - hasHistogramEntry(WebappSplashDelegate.HISTOGRAM_SPLASHSCREEN_DURATION, 3000)); Assert.assertEquals(0, getHistogramTotalCountFor(WebappSplashDelegate.HISTOGRAM_SPLASHSCREEN_HIDES, SplashController.SplashHidesReason.NUM_ENTRIES)); @@ -222,27 +188,10 @@ mActivityTestRule.waitUntilSplashscreenHides(); - // DURATION and HIDES should now have a value. - Assert.assertTrue( - hasHistogramEntry(WebappSplashDelegate.HISTOGRAM_SPLASHSCREEN_DURATION, 10000)); + // HIDES should now have a value. Assert.assertEquals(1, getHistogramTotalCountFor(WebappSplashDelegate.HISTOGRAM_SPLASHSCREEN_HIDES, SplashController.SplashHidesReason.NUM_ENTRIES)); - - // The other UMA records should not have changed. - Assert.assertEquals(1, - getHistogramTotalCountFor( - WebappSplashUmaCache.HISTOGRAM_SPLASHSCREEN_BACKGROUNDCOLOR, - WebappSplashUmaCache.SplashColorStatus.NUM_ENTRIES)); - Assert.assertEquals(1, - getHistogramTotalCountFor(WebappSplashUmaCache.HISTOGRAM_SPLASHSCREEN_THEMECOLOR, - WebappSplashUmaCache.SplashColorStatus.NUM_ENTRIES)); - Assert.assertEquals(1, - getHistogramTotalCountFor(WebappSplashUmaCache.HISTOGRAM_SPLASHSCREEN_ICON_TYPE, - WebappSplashUmaCache.SplashIconType.NUM_ENTRIES)); - Assert.assertEquals(0, - getHistogramTotalCountFor( - WebappSplashUmaCache.HISTOGRAM_SPLASHSCREEN_ICON_SIZE, 50)); } @Test @@ -252,7 +201,7 @@ // Register a properly-sized icon for the splash screen. Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); int thresholdSize = context.getResources().getDimensionPixelSize( - R.dimen.webapp_splash_image_size_threshold); + R.dimen.webapp_splash_image_size_minimum); int size = thresholdSize + 1; Bitmap splashBitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888); String bitmapString = ShortcutHelper.encodeBitmapAsString(splashBitmap);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenThemeColorTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenThemeColorTest.java index efa4cc0..49c02f9 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenThemeColorTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappSplashScreenThemeColorTest.java
@@ -15,14 +15,12 @@ import org.junit.Test; import org.junit.runner.RunWith; -import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.task.PostTask; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.ShortcutHelper; -import org.chromium.chrome.browser.metrics.WebappSplashUmaCache; import org.chromium.chrome.browser.tab.TabTestUtils; import org.chromium.chrome.browser.util.ColorUtils; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; @@ -92,14 +90,4 @@ } })); } - - @Test - @SmallTest - @Feature({"Webapps"}) - public void testUmaThemeColorCustom() { - Assert.assertEquals(1, - RecordHistogram.getHistogramValueCountForTesting( - WebappSplashUmaCache.HISTOGRAM_SPLASHSCREEN_THEMECOLOR, - WebappSplashUmaCache.SplashColorStatus.CUSTOM)); - } }
diff --git a/chrome/android/touchless/java/res/layout/dialog_list_item.xml b/chrome/android/touchless/java/res/layout/dialog_list_item.xml index a18102f3..3b2c166 100644 --- a/chrome/android/touchless/java/res/layout/dialog_list_item.xml +++ b/chrome/android/touchless/java/res/layout/dialog_list_item.xml
@@ -6,6 +6,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" + android:focusable="true" android:paddingStart="12dp" android:paddingEnd="12dp" android:paddingTop="9dp"
diff --git a/chrome/android/touchless/java/src/org/chromium/chrome/browser/touchless/NoTouchActivity.java b/chrome/android/touchless/java/src/org/chromium/chrome/browser/touchless/NoTouchActivity.java index d3cd6e7..f6a4889 100644 --- a/chrome/android/touchless/java/src/org/chromium/chrome/browser/touchless/NoTouchActivity.java +++ b/chrome/android/touchless/java/src/org/chromium/chrome/browser/touchless/NoTouchActivity.java
@@ -25,6 +25,7 @@ import org.chromium.chrome.browser.compositor.layouts.LayoutManager; import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager; import org.chromium.chrome.browser.preferences.ChromePreferenceManager; +import org.chromium.chrome.browser.tab.InterceptNavigationDelegateImpl; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabDelegateFactory; import org.chromium.chrome.browser.tab.TabRedirectHandler; @@ -48,8 +49,6 @@ // Time at which an intent was received and handled. private long mIntentHandlingTimeMs; - private TouchlessUiCoordinator mUiCoordinator; - /** The class that finishes this activity after a timeout. */ private ChromeInactivityTracker mInactivityTracker; @@ -77,9 +76,13 @@ case TabOpenType.REUSE_URL_MATCHING_TAB_ELSE_NEW_TAB: if (getActivityTab().getUrl().contentEquals(url)) break; // fall through - case TabOpenType.BRING_TAB_TO_FRONT: // fall through case TabOpenType.REUSE_APP_ID_MATCHING_TAB_ELSE_NEW_TAB: // fall through case TabOpenType.OPEN_NEW_TAB: // fall through + InterceptNavigationDelegateImpl delegate = + InterceptNavigationDelegateImpl.get(getActivityTab()); + if (delegate != null && delegate.shouldIgnoreNewTab(url, false)) return; + // fall through + case TabOpenType.BRING_TAB_TO_FRONT: // fall through case TabOpenType.CLOBBER_CURRENT_TAB: // TODO(mthiesse): For now, let's just clobber current tab always. Are the other // tab open types meaningful when we only have a single tab?
diff --git a/chrome/android/touchless/java/src/org/chromium/chrome/browser/touchless/TouchlessTabDelegate.java b/chrome/android/touchless/java/src/org/chromium/chrome/browser/touchless/TouchlessTabDelegate.java index 192f7507..b26af1a 100644 --- a/chrome/android/touchless/java/src/org/chromium/chrome/browser/touchless/TouchlessTabDelegate.java +++ b/chrome/android/touchless/java/src/org/chromium/chrome/browser/touchless/TouchlessTabDelegate.java
@@ -18,6 +18,7 @@ import org.chromium.chrome.browser.tabmodel.TabLaunchType; import org.chromium.chrome.browser.tabmodel.document.AsyncTabCreationParams; import org.chromium.chrome.browser.tabmodel.document.TabDelegate; +import org.chromium.chrome.browser.util.UrlUtilities; /** * Asynchronously creates Tabs for navigation originating from {@link NoTouchActivity}. @@ -39,6 +40,12 @@ super.createNewTab(asyncParams, type, parentId); return; } + if (UrlUtilities.validateIntentUrl(asyncParams.getLoadUrlParams().getUrl())) { + // Handle intent URLs as normal. + super.createNewTab(asyncParams, type, parentId); + return; + } + String url = asyncParams.getLoadUrlParams().getUrl(); int assignedTabId = TabIdManager.getInstance().generateValidId(Tab.INVALID_TAB_ID);
diff --git a/chrome/android/touchless/javatests/src/org/chromium/chrome/browser/touchless/dialog/TouchlessDialogPresenterTest.java b/chrome/android/touchless/javatests/src/org/chromium/chrome/browser/touchless/dialog/TouchlessDialogPresenterTest.java index cc4c483..ebb40ef 100644 --- a/chrome/android/touchless/javatests/src/org/chromium/chrome/browser/touchless/dialog/TouchlessDialogPresenterTest.java +++ b/chrome/android/touchless/javatests/src/org/chromium/chrome/browser/touchless/dialog/TouchlessDialogPresenterTest.java
@@ -25,7 +25,6 @@ import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.touchless.NoTouchActivity; @@ -58,7 +57,6 @@ } @Test - @DisabledTest(message = "crbug.com/984004") @SmallTest @Feature({"TouchlessModalDialog"}) public void testItemSelection() throws Exception {
diff --git a/chrome/android/webapk/libs/common/res_splash/values/common_dimens.xml b/chrome/android/webapk/libs/common/res_splash/values/common_dimens.xml index ead441c2..aa2a025 100644 --- a/chrome/android/webapk/libs/common/res_splash/values/common_dimens.xml +++ b/chrome/android/webapk/libs/common/res_splash/values/common_dimens.xml
@@ -6,7 +6,6 @@ <resources> <dimen name="webapp_splash_offset">32dp</dimen> <dimen name="webapp_splash_image_size_ideal">128dp</dimen> - <dimen name="webapp_splash_image_size_threshold">80dp</dimen> <dimen name="webapp_splash_image_size_minimum">16dp</dimen> <dimen name="webapp_splash_large_title_margin_bottom">16dp</dimen>
diff --git a/chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/splash/SplashLayout.java b/chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/splash/SplashLayout.java index 69031fe..563db8a 100644 --- a/chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/splash/SplashLayout.java +++ b/chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/splash/SplashLayout.java
@@ -10,68 +10,38 @@ import android.graphics.Bitmap; import android.graphics.drawable.Icon; import android.os.Build; -import android.support.annotation.IntDef; import android.util.DisplayMetrics; import android.view.LayoutInflater; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - /** * Contains utility methods for drawing splash screen. The methods are applicable for both home * screen shortcuts and WebAPKs. */ public class SplashLayout { - @IntDef({IconClassification.INVALID, IconClassification.SMALL, IconClassification.LARGE}) - @Retention(RetentionPolicy.SOURCE) - public @interface IconClassification { - int INVALID = 0; - int SMALL = 1; - int LARGE = 2; - } - public static int getDefaultBackgroundColor(Context appContext) { return getColorCompatibility(appContext.getResources(), R.color.webapp_default_bg); } /** - * Classifies the icon based on: - * - Whether it is appropriate to display on the splash screen. + * Selects the splash screen layout based on: + * - Whether the icon is appropriate to display on the splash screen. * - The icon size. - * Returns {@link IconClassification.INVALID} if the icon is inappropriate to display on the - * splash screen. */ - public static @IconClassification int classifyIcon( - Resources resources, Bitmap icon, boolean wasIconGenerated) { + public static int selectLayout(Resources resources, Bitmap icon, boolean wasIconGenerated) { if (icon == null || wasIconGenerated) { - return IconClassification.INVALID; + return R.layout.webapp_splash_screen_no_icon; } DisplayMetrics metrics = resources.getDisplayMetrics(); int smallestEdge = Math.min(icon.getScaledWidth(metrics), icon.getScaledHeight(metrics)); int minimumSizeThreshold = resources.getDimensionPixelSize(R.dimen.webapp_splash_image_size_minimum); if (smallestEdge < minimumSizeThreshold) { - return IconClassification.INVALID; + return R.layout.webapp_splash_screen_no_icon; } - int bigThreshold = - resources.getDimensionPixelSize(R.dimen.webapp_splash_image_size_threshold); - return (smallestEdge <= bigThreshold) ? IconClassification.SMALL : IconClassification.LARGE; - } - - /** Returns the layout for the splash screen given the classification of the splash icon. */ - private static int selectLayoutFromIconClassification( - @IconClassification int iconClassification) { - switch (iconClassification) { - case IconClassification.INVALID: - return R.layout.webapp_splash_screen_no_icon; - case IconClassification.SMALL: - case IconClassification.LARGE: - default: - return R.layout.webapp_splash_screen_large; - } + return R.layout.webapp_splash_screen_large; } /** @@ -88,9 +58,9 @@ /** Builds splash screen and attaches it to the parent view. */ public static void createLayout(Context appContext, ViewGroup parentView, Bitmap icon, - boolean isIconAdaptive, @IconClassification int iconClassification, String text, + boolean isIconAdaptive, boolean isIconGenerated, String text, boolean useLightTextColor) { - int layoutId = selectLayoutFromIconClassification(iconClassification); + int layoutId = selectLayout(appContext.getResources(), icon, isIconGenerated); ViewGroup layout = (ViewGroup) LayoutInflater.from(appContext).inflate(layoutId, parentView, true);
diff --git a/chrome/android/webapk/shell_apk/current_version/current_version.gni b/chrome/android/webapk/shell_apk/current_version/current_version.gni index 037418f..dd990c15 100644 --- a/chrome/android/webapk/shell_apk/current_version/current_version.gni +++ b/chrome/android/webapk/shell_apk/current_version/current_version.gni
@@ -12,4 +12,4 @@ # //chrome/android/webapk/shell_apk:webapk is changed. This includes # Java files, Android resource files and AndroidManifest.xml. Does not affect # Chrome.apk -current_shell_apk_version = 102 +current_shell_apk_version = 103
diff --git a/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/h2o/SplashUtils.java b/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/h2o/SplashUtils.java index e909f0c..9c130821 100644 --- a/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/h2o/SplashUtils.java +++ b/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/h2o/SplashUtils.java
@@ -22,13 +22,11 @@ public static View createSplashView(Context context) { Resources resources = context.getResources(); Bitmap icon = WebApkUtils.decodeBitmapFromDrawable(resources, R.drawable.splash_icon); - @SplashLayout.IconClassification - int iconClassification = SplashLayout.classifyIcon(resources, icon, false); int backgroundColor = WebApkUtils.getColor(resources, R.color.background_color_non_empty); FrameLayout layout = new FrameLayout(context); SplashLayout.createLayout(context, layout, icon, false /* isIconAdaptive */, - iconClassification, resources.getString(R.string.name), + false /* isIconGenerated */, resources.getString(R.string.name), WebApkUtils.shouldUseLightForegroundOnBackground(backgroundColor)); return layout; }
diff --git a/chrome/app/BUILD.gn b/chrome/app/BUILD.gn index 3943910..2242fdc 100644 --- a/chrome/app/BUILD.gn +++ b/chrome/app/BUILD.gn
@@ -626,20 +626,6 @@ } } -source_set("chrome_renderer_manifest") { - sources = [ - "chrome_renderer_manifest.cc", - "chrome_renderer_manifest.h", - ] - - deps = [ - "//base", - "//chrome/common:mojo_bindings", - "//components/safe_browsing/common:interfaces", - "//services/service_manager/public/cpp", - ] -} - source_set("chrome_service_manifests") { public_deps = [ ":builtin_service_manifests", @@ -647,6 +633,5 @@ ":chrome_content_gpu_overlay_manifest", ":chrome_content_renderer_overlay_manifest", ":chrome_content_utility_overlay_manifest", - ":chrome_renderer_manifest", ] }
diff --git a/chrome/app/OWNERS b/chrome/app/OWNERS index 1dbde35d..d96ba2d 100644 --- a/chrome/app/OWNERS +++ b/chrome/app/OWNERS
@@ -68,7 +68,3 @@ per-file chrome_content_utility_overlay_manifest.cc=file://ipc/SECURITY_OWNERS per-file chrome_content_utility_overlay_manifest.h=set noparent per-file chrome_content_utility_overlay_manifest.h=file://ipc/SECURITY_OWNERS -per-file chrome_renderer_manifest.cc=set noparent -per-file chrome_renderer_manifest.cc=file://ipc/SECURITY_OWNERS -per-file chrome_renderer_manifest.h=set noparent -per-file chrome_renderer_manifest.h=file://ipc/SECURITY_OWNERS
diff --git a/chrome/app/builtin_service_manifests.cc b/chrome/app/builtin_service_manifests.cc index a710e6f..cf2e0307 100644 --- a/chrome/app/builtin_service_manifests.cc +++ b/chrome/app/builtin_service_manifests.cc
@@ -7,15 +7,12 @@ #include "base/no_destructor.h" #include "build/build_config.h" #include "chrome/common/buildflags.h" -#include "chrome/common/constants.mojom.h" #include "chrome/services/file_util/public/cpp/manifest.h" #include "components/services/quarantine/public/cpp/manifest.h" -#include "components/startup_metric_utils/common/startup_metric.mojom.h" #include "device/vr/buildflags/buildflags.h" #include "extensions/buildflags/buildflags.h" #include "printing/buildflags/buildflags.h" #include "services/preferences/public/cpp/local_state_manifest.h" -#include "services/service_manager/public/cpp/manifest_builder.h" #if defined(OS_CHROMEOS) #include "ash/public/cpp/manifest.h" @@ -60,38 +57,9 @@ #include "services/content/simple_browser/public/cpp/manifest.h" // nogncheck #endif -namespace { - -const service_manager::Manifest& GetChromeManifest() { - static base::NoDestructor<service_manager::Manifest> manifest { - service_manager::ManifestBuilder() - .WithServiceName(chrome::mojom::kServiceName) - .WithDisplayName("Chrome") - .WithOptions( - service_manager::ManifestOptionsBuilder() - .WithExecutionMode( - service_manager::Manifest::ExecutionMode::kInProcessBuiltin) - .WithInstanceSharingPolicy( - service_manager::Manifest::InstanceSharingPolicy:: - kSharedAcrossGroups) - .CanConnectToInstancesWithAnyId(true) - .CanRegisterOtherServiceInstances(true) - .Build()) - .ExposeCapability("renderer", - service_manager::Manifest::InterfaceList< - startup_metric_utils::mojom::StartupMetricHost>()) - .RequireCapability(chrome::mojom::kRendererServiceName, "browser") - .Build() - }; - return *manifest; -} - -} // namespace - const std::vector<service_manager::Manifest>& GetChromeBuiltinServiceManifests() { static base::NoDestructor<std::vector<service_manager::Manifest>> manifests{{ - GetChromeManifest(), GetFileUtilManifest(), prefs::GetLocalStateManifest(), quarantine::GetQuarantineManifest(),
diff --git a/chrome/app/chrome_command_ids.h b/chrome/app/chrome_command_ids.h index 385adb9..f91d2a2 100644 --- a/chrome/app/chrome_command_ids.h +++ b/chrome/app/chrome_command_ids.h
@@ -220,6 +220,7 @@ #define IDC_CHROME_MENU 44002 // OSX only #define IDC_HIDE_APP 44003 // OSX only #define IDC_HISTORY_MENU 46000 // OSX only +#define IDC_TAB_MENU 46001 // OSX only #define IDC_PROFILE_MAIN_MENU 46100 // OSX only #define IDC_INPUT_METHODS_MENU 46300 // Linux only
diff --git a/chrome/app/chrome_renderer_manifest.cc b/chrome/app/chrome_renderer_manifest.cc deleted file mode 100644 index df82fedd..0000000 --- a/chrome/app/chrome_renderer_manifest.cc +++ /dev/null
@@ -1,25 +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 "chrome/app/chrome_renderer_manifest.h" - -#include "base/no_destructor.h" -#include "build/build_config.h" -#include "chrome/common/constants.mojom.h" -#include "chrome/common/media/webrtc_logging.mojom.h" -#include "components/safe_browsing/common/safe_browsing.mojom.h" -#include "services/service_manager/public/cpp/manifest_builder.h" - -const service_manager::Manifest& GetChromeRendererManifest() { - static base::NoDestructor<service_manager::Manifest> manifest{ - service_manager::ManifestBuilder() - .WithServiceName(chrome::mojom::kRendererServiceName) - .ExposeCapability("browser", - service_manager::Manifest::InterfaceList< - chrome::mojom::WebRtcLoggingAgent, - safe_browsing::mojom::PhishingModelSetter>()) - .RequireCapability(chrome::mojom::kServiceName, "renderer") - .Build()}; - return *manifest; -}
diff --git a/chrome/app/chrome_renderer_manifest.h b/chrome/app/chrome_renderer_manifest.h deleted file mode 100644 index 9c1c8311..0000000 --- a/chrome/app/chrome_renderer_manifest.h +++ /dev/null
@@ -1,16 +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 CHROME_APP_CHROME_RENDERER_MANIFEST_H_ -#define CHROME_APP_CHROME_RENDERER_MANIFEST_H_ - -#include "services/service_manager/public/cpp/manifest.h" - -// Returns the Manifest for the chrome_renderer service. Chrome registers an -// instance of this service for each renderer process started by Content, and -// that instance lives in the corresponding renderer process alongside the -// content_renderer instance. -const service_manager::Manifest& GetChromeRendererManifest(); - -#endif // CHROME_APP_CHROME_RENDERER_MANIFEST_H_
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index e83104c..29605e1c 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -7704,6 +7704,9 @@ <message name="IDS_WINDOW_MENU_MAC" desc="The menu title of the Mac window menu."> Window </message> + <message name="IDS_TAB_MENU_MAC" desc="The menu title of the Mac tab menu."> + Tab + </message> <message name="IDS_HELP_MENU_MAC" desc="The menu title of the Mac help menu."> Help </message>
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp index c9e8b67..34c3d592 100644 --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp
@@ -1607,6 +1607,9 @@ <message name="IDS_SETTINGS_PRINTING_CUPS_PRINTER_REQUIRE_INTERNET_MESSAGE" desc="The message shown when there is no internet access to set up a printer."> Connect to the internet to add a printer </message> + <message name="IDS_SETTINGS_PRINTING_CUPS_PRINTER_CHECK_CONNECTION_MESSAGE" desc="The message shown when there is no internet connection for detecting available printers"> + Please check your connection to see available printers in your network + </message> <message name="IDS_SETTINGS_PRINTING_CUPS_EDIT_PRINTER_DIALOG_TITLE" desc="Text for the title of the dialog that is used to edit a CUPS printer's information."> Edit printer </message> @@ -2718,9 +2721,16 @@ <message name="IDS_SETTINGS_LANGUAGES_EXPAND_ACCESSIBILITY_LABEL" desc="Label for the button that toggles showing the language options. Only visible by screen reader software."> Show language options </message> - <message name="IDS_SETTINGS_LANGUAGES_LANGUAGES_LIST_ORDERING_INSTRUCTIONS" desc="Explanatory message about ordering the list of languages."> - Order languages based on your preference - </message> + <if expr="chromeos"> + <message name="IDS_SETTINGS_LANGUAGES_LANGUAGES_LIST_ORDERING_INSTRUCTIONS" desc="Explanatory message about ordering the list of languages."> + Add languages or reorder list + </message> + </if> + <if expr="not chromeos"> + <message name="IDS_SETTINGS_LANGUAGES_LANGUAGES_LIST_ORDERING_INSTRUCTIONS" desc="Explanatory message about ordering the list of languages."> + Order languages based on your preference + </message> + </if> <message name="IDS_SETTINGS_LANGUAGES_LANGUAGES_LIST_MOVE_TO_TOP" desc="Label for the menu item that moves the language up to the top of the list of languages."> Move to the top </message>
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 9e883b9..df6fd66 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -284,8 +284,6 @@ "chrome_quota_permission_context.h", "chrome_resource_bundle_helper.cc", "chrome_resource_bundle_helper.h", - "chrome_service.cc", - "chrome_service.h", "client_hints/client_hints.cc", "client_hints/client_hints.h", "client_hints/client_hints_factory.cc", @@ -377,6 +375,8 @@ "data_reduction_proxy/data_reduction_proxy_chrome_settings_factory.h", "data_reduction_proxy/data_reduction_proxy_tab_helper.cc", "data_reduction_proxy/data_reduction_proxy_tab_helper.h", + "data_saver/data_saver_top_host_provider.cc", + "data_saver/data_saver_top_host_provider.h", "data_use_measurement/chrome_data_use_measurement.cc", "data_use_measurement/chrome_data_use_measurement.h", "defaults.cc", @@ -1364,8 +1364,6 @@ "previews/previews_service.h", "previews/previews_service_factory.cc", "previews/previews_service_factory.h", - "previews/previews_top_host_provider.cc", - "previews/previews_top_host_provider.h", "previews/previews_ui_tab_helper.cc", "previews/previews_ui_tab_helper.h", "previews/resource_loading_hints/resource_loading_hints_web_contents_observer.cc", @@ -3355,11 +3353,11 @@ "sharing/click_to_call/click_to_call_constants.h", "sharing/click_to_call/click_to_call_context_menu_observer.cc", "sharing/click_to_call/click_to_call_context_menu_observer.h", - "sharing/click_to_call/click_to_call_dialog.h", "sharing/click_to_call/click_to_call_sharing_dialog_controller.cc", "sharing/click_to_call/click_to_call_sharing_dialog_controller.h", "sharing/click_to_call/click_to_call_utils.cc", "sharing/click_to_call/click_to_call_utils.h", + "sharing/sharing_dialog.h", "sharing/sharing_dialog_controller.cc", "sharing/sharing_dialog_controller.h", "signin/signin_promo.cc",
diff --git a/chrome/browser/OWNERS b/chrome/browser/OWNERS index 824fa02b..46cdc362 100644 --- a/chrome/browser/OWNERS +++ b/chrome/browser/OWNERS
@@ -49,10 +49,6 @@ per-file flag-never-expire-list.json=avi@chromium.org per-file flag-never-expire-list.json=ellyjones@chromium.org -per-file io_thread*=mmenke@chromium.org -per-file io_thread*=rch@chromium.org -per-file io_thread*=rsleevi@chromium.org - per-file *.mm=avi@chromium.org per-file *.mm=mark@chromium.org per-file *.mm=rsesek@chromium.org
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 0cbb885..c4a94791 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -137,6 +137,7 @@ #include "storage/browser/fileapi/file_system_features.h" #include "third_party/blink/public/common/experiments/memory_ablation_experiment.h" #include "third_party/blink/public/common/features.h" +#include "third_party/blink/public/common/forcedark/forcedark_switches.h" #include "third_party/leveldatabase/leveldb_features.h" #include "ui/accessibility/accessibility_switches.h" #include "ui/base/ui_base_features.h" @@ -407,6 +408,50 @@ #endif // OS_ANDROID +const FeatureEntry::FeatureParam kForceDark_SimpleHsl[] = { + {"inversion_method", "hsl_based"}, + {"image_behavior", "none"}, + {"text_lightness_threshold", "256"}, + {"background_lightness_threshold", "0"}}; + +const FeatureEntry::FeatureParam kForceDark_SimpleCielab[] = { + {"inversion_method", "cielab_based"}, + {"image_behavior", "none"}, + {"text_lightness_threshold", "256"}, + {"background_lightness_threshold", "0"}}; + +const FeatureEntry::FeatureParam kForceDark_SelectiveImageInversion[] = { + {"inversion_method", "cielab_based"}, + {"image_behavior", "selective"}, + {"text_lightness_threshold", "256"}, + {"background_lightness_threshold", "0"}}; + +const FeatureEntry::FeatureParam kForceDark_SelectiveElementInversion[] = { + {"inversion_method", "cielab_based"}, + {"image_behavior", "none"}, + {"text_lightness_threshold", "150"}, + {"background_lightness_threshold", "205"}}; + +const FeatureEntry::FeatureParam kForceDark_SelectiveGeneralInversion[] = { + {"inversion_method", "cielab_based"}, + {"image_behavior", "selective"}, + {"text_lightness_threshold", "150"}, + {"background_lightness_threshold", "205"}}; + +const FeatureEntry::FeatureVariation kForceDarkVariations[] = { + {"with simple HSL-based inversion", kForceDark_SimpleHsl, + base::size(kForceDark_SimpleHsl), nullptr}, + {"with simple CIELAB-based inversion", kForceDark_SimpleCielab, + base::size(kForceDark_SimpleCielab), nullptr}, + {"with selective image inversion", kForceDark_SelectiveImageInversion, + base::size(kForceDark_SelectiveImageInversion), nullptr}, + {"with selective inversion of non-image elements", + kForceDark_SelectiveElementInversion, + base::size(kForceDark_SelectiveElementInversion), nullptr}, + {"with selective inversion of everything", + kForceDark_SelectiveGeneralInversion, + base::size(kForceDark_SelectiveGeneralInversion), nullptr}}; + const FeatureEntry::Choice kEnableGpuRasterizationChoices[] = { {flags_ui::kGenericExperimentChoiceDefault, "", ""}, {flags_ui::kGenericExperimentChoiceEnabled, @@ -1092,11 +1137,19 @@ #endif // OS_ANDROID #if defined(OS_ANDROID) +const FeatureEntry::FeatureParam kTabSwitcherOnReturn_Immediate[] = { + {"tab_switcher_on_return_time_ms", "0"}}; +const FeatureEntry::FeatureParam kTabSwitcherOnReturn_1Minute[] = { + {"tab_switcher_on_return_time_ms", "60000"}}; const FeatureEntry::FeatureParam kTabSwitcherOnReturn_30Minutes[] = { {"tab_switcher_on_return_time_ms", "1800000"}}; const FeatureEntry::FeatureParam kTabSwitcherOnReturn_60Minutes[] = { {"tab_switcher_on_return_time_ms", "3600000"}}; const FeatureEntry::FeatureVariation kTabSwitcherOnReturnVariations[] = { + {"Immediate", kTabSwitcherOnReturn_Immediate, + base::size(kTabSwitcherOnReturn_30Minutes), nullptr}, + {"1 minute", kTabSwitcherOnReturn_1Minute, + base::size(kTabSwitcherOnReturn_30Minutes), nullptr}, {"30 minutes", kTabSwitcherOnReturn_30Minutes, base::size(kTabSwitcherOnReturn_30Minutes), nullptr}, {"60 minutes", kTabSwitcherOnReturn_60Minutes, @@ -2247,11 +2300,12 @@ flag_descriptions::kPasswordEditingAndroidDescription, kOsAndroid, FEATURE_VALUE_TYPE(password_manager::features::kPasswordEditingAndroid)}, #endif // OS_ANDROID + {"enable-force-dark", flag_descriptions::kForceWebContentsDarkModeName, + flag_descriptions::kForceWebContentsDarkModeDescription, kOsAll, + FEATURE_WITH_PARAMS_VALUE_TYPE(blink::features::kForceWebContentsDarkMode, + kForceDarkVariations, + "ForceDarkVariations")}, #if defined(OS_ANDROID) - {"enable-android-web-contents-dark-mode", - flag_descriptions::kAndroidWebContentsDarkMode, - flag_descriptions::kAndroidWebContentsDarkModeDescription, kOsAndroid, - FEATURE_VALUE_TYPE(chrome::android::kAndroidWebContentsDarkMode)}, #if BUILDFLAG(ENABLE_ANDROID_NIGHT_MODE) {"enable-android-night-mode", flag_descriptions::kAndroidNightModeName, flag_descriptions::kAndroidNightModeDescription, kOsAndroid,
diff --git a/chrome/browser/android/autofill_assistant/client_android.cc b/chrome/browser/android/autofill_assistant/client_android.cc index 9eaebf85..533eaba 100644 --- a/chrome/browser/android/autofill_assistant/client_android.cc +++ b/chrome/browser/android/autofill_assistant/client_android.cc
@@ -212,16 +212,24 @@ JNIEnv* env, const base::android::JavaParamRef<jobject>& jcaller, const base::android::JavaParamRef<jstring>& jexperiment_ids, + const base::android::JavaParamRef<jbyteArray>& jscript_bundle, const base::android::JavaParamRef<jobjectArray>& jargument_names, const base::android::JavaParamRef<jobjectArray>& jargument_values, const base::android::JavaParamRef<jobject>& jcallback) { if (!controller_) CreateController(nullptr); + std::string script_bundle_bytes; + if (jscript_bundle) { + base::android::JavaByteArrayToString(env, jscript_bundle, + &script_bundle_bytes); + } + base::android::ScopedJavaGlobalRef<jobject> scoped_jcallback(env, jcallback); controller_->Track( CreateTriggerContext(env, jexperiment_ids, jargument_names, jargument_values), + script_bundle_bytes, base::BindOnce(&ClientAndroid::OnListDirectActions, weak_ptr_factory_.GetWeakPtr(), scoped_jcallback)); }
diff --git a/chrome/browser/android/autofill_assistant/client_android.h b/chrome/browser/android/autofill_assistant/client_android.h index 3a920bd..1337bb8 100644 --- a/chrome/browser/android/autofill_assistant/client_android.h +++ b/chrome/browser/android/autofill_assistant/client_android.h
@@ -66,6 +66,7 @@ JNIEnv* env, const base::android::JavaParamRef<jobject>& jcaller, const base::android::JavaParamRef<jstring>& jexperiment_ids, + const base::android::JavaParamRef<jbyteArray>& jscript_bundle, const base::android::JavaParamRef<jobjectArray>& jargument_names, const base::android::JavaParamRef<jobjectArray>& jargument_values, const base::android::JavaParamRef<jobject>& jcallback);
diff --git a/chrome/browser/android/chrome_feature_list.cc b/chrome/browser/android/chrome_feature_list.cc index 5a292bf..5be1ff3 100644 --- a/chrome/browser/android/chrome_feature_list.cc +++ b/chrome/browser/android/chrome_feature_list.cc
@@ -268,9 +268,6 @@ const base::Feature kAndroidSiteSettingsUIRefresh{ "AndroidSiteSettingsUIRefresh", base::FEATURE_ENABLED_BY_DEFAULT}; -const base::Feature kAndroidWebContentsDarkMode{ - "AndroidWebContentsDarkMode", base::FEATURE_DISABLED_BY_DEFAULT}; - const base::Feature kBackgroundTaskComponentUpdate{ "BackgroundTaskComponentUpdate", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/chrome/browser/android/chrome_feature_list.h b/chrome/browser/android/chrome_feature_list.h index ebb26fa..8d11b51 100644 --- a/chrome/browser/android/chrome_feature_list.h +++ b/chrome/browser/android/chrome_feature_list.h
@@ -23,7 +23,6 @@ extern const base::Feature kAndroidPaymentApps; extern const base::Feature kAndroidSearchEngineChoiceNotification; extern const base::Feature kAndroidSiteSettingsUIRefresh; -extern const base::Feature kAndroidWebContentsDarkMode; extern const base::Feature kBackgroundTaskComponentUpdate; extern const base::Feature kBackgroundTaskSchedulerForBackgroundSync; extern const base::Feature kCastDeviceFilter;
diff --git a/chrome/browser/android/contextualsearch/contextual_search_delegate_unittest.cc b/chrome/browser/android/contextualsearch/contextual_search_delegate_unittest.cc index a518f18..134daaa 100644 --- a/chrome/browser/android/contextualsearch/contextual_search_delegate_unittest.cc +++ b/chrome/browser/android/contextualsearch/contextual_search_delegate_unittest.cc
@@ -14,8 +14,8 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/macros.h" -#include "base/message_loop/message_loop.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/scoped_task_environment.h" #include "base/values.h" #include "chrome/browser/android/contextualsearch/contextual_search_context.h" #include "chrome/browser/android/contextualsearch/resolved_search_term.h" @@ -288,7 +288,8 @@ std::string search_url_preload_; int coca_card_tag_; - base::MessageLoopForIO io_message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_{ + base::test::ScopedTaskEnvironment::MainThreadType::IO}; std::unique_ptr<TemplateURLService> template_url_service_; scoped_refptr<network::SharedURLLoaderFactory> test_shared_url_loader_factory_;
diff --git a/chrome/browser/android/download/download_startup_utils.cc b/chrome/browser/android/download/download_startup_utils.cc index b079a052..c680ee0 100644 --- a/chrome/browser/android/download/download_startup_utils.cc +++ b/chrome/browser/android/download/download_startup_utils.cc
@@ -7,6 +7,7 @@ #include <jni.h> #include <utility> +#include "base/android/path_utils.h" #include "chrome/android/chrome_jni_headers/DownloadStartupUtils_jni.h" #include "chrome/browser/android/chrome_feature_list.h" #include "chrome/browser/android/download/download_controller.h" @@ -40,6 +41,9 @@ DownloadControllerBase::Get()); in_progress_manager->set_intermediate_path_cb( base::BindRepeating(&DownloadTargetDeterminer::GetCrDownloadPath)); + base::FilePath download_dir; + base::android::GetDownloadsDirectory(&download_dir); + in_progress_manager->set_default_download_dir(download_dir); download::SimpleDownloadManagerCoordinator* coordinator = SimpleDownloadManagerCoordinatorFactory::GetForKey(profile_key); auto* download_provider =
diff --git a/chrome/browser/app_controller_mac.h b/chrome/browser/app_controller_mac.h index 35984ff..12bcfbc 100644 --- a/chrome/browser/app_controller_mac.h +++ b/chrome/browser/app_controller_mac.h
@@ -30,6 +30,7 @@ class QuitWithAppsController; class ScopedKeepAlive; @class ShareMenuController; +class TabMenuBridge; // The application controller object, created by loading the MainMenu nib. // This handles things like responding to menus when there are no windows @@ -71,6 +72,8 @@ // Controller for the macOS system share menu. base::scoped_nsobject<ShareMenuController> shareMenuController_; + std::unique_ptr<TabMenuBridge> tabMenuBridge_; + // If we're told to open URLs (in particular, via |-application:openFiles:| by // Launch Services) before we've launched the browser, we queue them up in // |startupUrls_| so that they can go in the first browser window/tab. @@ -162,6 +165,7 @@ - (BookmarkMenuBridge*)bookmarkMenuBridge; - (HistoryMenuBridge*)historyMenuBridge; +- (TabMenuBridge*)tabMenuBridge; // Initializes the AppShimMenuController. This enables changing the menu bar for // apps.
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm index cf6c32db..79e8e17 100644 --- a/chrome/browser/app_controller_mac.mm +++ b/chrome/browser/app_controller_mac.mm
@@ -75,6 +75,7 @@ #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" #import "chrome/browser/ui/cocoa/profiles/profile_menu_controller.h" #import "chrome/browser/ui/cocoa/share_menu_controller.h" +#import "chrome/browser/ui/cocoa/tab_menu_bridge.h" #include "chrome/browser/ui/extensions/application_launch.h" #include "chrome/browser/ui/startup/startup_browser_creator.h" #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" @@ -609,8 +610,19 @@ - (void)windowDidBecomeMain:(NSNotification*)notify { Browser* browser = chrome::FindBrowserWithWindow([notify object]); - if (browser) - [self windowChangedToProfile:browser->profile()->GetOriginalProfile()]; + if (!browser) + return; + + if (browser->is_type_tabbed()) { + tabMenuBridge_ = std::make_unique<TabMenuBridge>( + browser->tab_strip_model(), + [[NSApp mainMenu] itemWithTag:IDC_TAB_MENU]); + tabMenuBridge_->BuildMenu(); + } else { + tabMenuBridge_.reset(); + } + + [self windowChangedToProfile:browser->profile()->GetOriginalProfile()]; } - (void)windowDidResignMain:(NSNotification*)notify { @@ -1547,6 +1559,10 @@ return historyMenuBridge_.get(); } +- (TabMenuBridge*)tabMenuBridge { + return tabMenuBridge_.get(); +} + - (void)initAppShimMenuController { if (!appShimMenuController_) appShimMenuController_.reset([[AppShimMenuController alloc] init]);
diff --git a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc index fbb26a4..719f3d8d 100644 --- a/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc +++ b/chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc
@@ -83,10 +83,8 @@ // ContentBrowserClient overrides. void RenderProcessWillLaunch( - content::RenderProcessHost* process_host, - service_manager::mojom::ServiceRequest* service_request) override { - ChromeContentBrowserClient::RenderProcessWillLaunch(process_host, - service_request); + content::RenderProcessHost* process_host) override { + ChromeContentBrowserClient::RenderProcessWillLaunch(process_host); filters_.push_back( new content::TestTextInputClientMessageFilter(process_host)); }
diff --git a/chrome/browser/apps/platform_apps/app_browsertest.cc b/chrome/browser/apps/platform_apps/app_browsertest.cc index 6709938..d96e2642 100644 --- a/chrome/browser/apps/platform_apps/app_browsertest.cc +++ b/chrome/browser/apps/platform_apps/app_browsertest.cc
@@ -1221,8 +1221,8 @@ IN_PROC_BROWSER_TEST_F(PlatformAppIncognitoBrowserTest, MAYBE_IncognitoComponentApp) { // Get the file manager app. - const Extension* file_manager = extension_service()->GetExtensionById( - "hhaomjibdihmijegdhdafkllkbggdgoj", false); + const Extension* file_manager = extension_registry()->GetExtensionById( + "hhaomjibdihmijegdhdafkllkbggdgoj", ExtensionRegistry::ENABLED); ASSERT_TRUE(file_manager != NULL); Profile* incognito_profile = profile()->GetOffTheRecordProfile(); ASSERT_TRUE(incognito_profile != NULL);
diff --git a/chrome/browser/background/background_contents_service.cc b/chrome/browser/background/background_contents_service.cc index 274063c..675f6cfd 100644 --- a/chrome/browser/background/background_contents_service.cc +++ b/chrome/browser/background/background_contents_service.cc
@@ -474,14 +474,14 @@ prefs_->GetDictionary(prefs::kRegisteredBackgroundContents); if (!contents) return; - extensions::ExtensionService* extensions_service = - extensions::ExtensionSystem::Get(profile)->extension_service(); - DCHECK(extensions_service); + extensions::ExtensionRegistry* extension_registry = + extensions::ExtensionRegistry::Get(profile); + DCHECK(extension_registry); for (base::DictionaryValue::Iterator it(*contents); !it.IsAtEnd(); it.Advance()) { // Check to make sure that the parent extension is still enabled. - const Extension* extension = - extensions_service->GetExtensionById(it.key(), false); + const Extension* extension = extension_registry->GetExtensionById( + it.key(), extensions::ExtensionRegistry::ENABLED); if (!extension) { // We should never reach here - it should not be possible for an app // to become uninstalled without the associated BackgroundContents being @@ -523,9 +523,9 @@ Profile* profile, const std::string& extension_id) { // First look if the manifest specifies a background page. - const Extension* extension = extensions::ExtensionSystem::Get(profile) - ->extension_service() - ->GetExtensionById(extension_id, false); + const Extension* extension = + extensions::ExtensionRegistry::Get(profile)->GetExtensionById( + extension_id, extensions::ExtensionRegistry::ENABLED); DCHECK(!extension || extension->is_hosted_app()); if (extension && BackgroundInfo::HasBackgroundPage(extension)) { LoadBackgroundContents(profile, BackgroundInfo::GetBackgroundURL(extension), @@ -742,24 +742,21 @@ // Do not register in the pref if the extension has a manifest-specified // background page. const std::string& appid = GetParentApplicationId(contents); - extensions::ExtensionService* extension_service = - extensions::ExtensionSystem::Get(profile_)->extension_service(); - // extension_service can be nullptr when running tests. - if (extension_service) { - const Extension* extension = - extension_service->GetExtensionById(appid, false); - if (extension && BackgroundInfo::HasBackgroundPage(extension)) - return; - } + extensions::ExtensionRegistry* extension_registry = + extensions::ExtensionRegistry::Get(profile_); + const Extension* extension = extension_registry->GetExtensionById( + appid, extensions::ExtensionRegistry::ENABLED); + if (extension && BackgroundInfo::HasBackgroundPage(extension)) + return; RegisterBackgroundContents(contents); } void BackgroundContentsService::OnBackgroundContentsTerminated( BackgroundContents* contents) { HandleExtensionCrashed( - extensions::ExtensionSystem::Get(profile_) - ->extension_service() - ->GetExtensionById(GetParentApplicationId(contents), false)); + extensions::ExtensionRegistry::Get(profile_)->GetExtensionById( + GetParentApplicationId(contents), + extensions::ExtensionRegistry::ENABLED)); } void BackgroundContentsService::OnBackgroundContentsClosed(
diff --git a/chrome/browser/browser_process_platform_part_chromeos.cc b/chrome/browser/browser_process_platform_part_chromeos.cc index 9af1e63..19e37e7 100644 --- a/chrome/browser/browser_process_platform_part_chromeos.cc +++ b/chrome/browser/browser_process_platform_part_chromeos.cc
@@ -13,7 +13,6 @@ #include "base/time/default_tick_clock.h" #include "base/time/tick_clock.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chromeos/chrome_service_name.h" #include "chrome/browser/chromeos/kerberos/kerberos_credentials_manager.h" #include "chrome/browser/chromeos/login/saml/in_session_password_change_manager.h" #include "chrome/browser/chromeos/login/session/chrome_session_manager.h"
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 2e56a1c..d9a1c7e9 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -37,7 +37,6 @@ #include "chrome/app/chrome_content_gpu_overlay_manifest.h" #include "chrome/app/chrome_content_renderer_overlay_manifest.h" #include "chrome/app/chrome_content_utility_overlay_manifest.h" -#include "chrome/app/chrome_renderer_manifest.h" #include "chrome/browser/accessibility/accessibility_labels_service.h" #include "chrome/browser/accessibility/accessibility_labels_service_factory.h" #include "chrome/browser/after_startup_task_utils.h" @@ -172,7 +171,6 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths_internal.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/constants.mojom.h" #include "chrome/common/env_vars.h" #include "chrome/common/google_url_loader_throttle.h" #include "chrome/common/logging_chrome.h" @@ -259,6 +257,7 @@ #include "components/services/quarantine/quarantine_service.h" #include "components/signin/public/base/signin_pref_names.h" #include "components/spellcheck/spellcheck_buildflags.h" +#include "components/startup_metric_utils/browser/startup_metric_host_impl.h" #include "components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.h" #include "components/translate/core/common/translate_switches.h" #include "components/url_formatter/url_fixer.h" @@ -390,7 +389,6 @@ #include "chrome/browser/chromeos/arc/fileapi/arc_documents_provider_backend_delegate.h" #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" #include "chrome/browser/chromeos/chrome_content_browser_client_chromeos_part.h" -#include "chrome/browser/chromeos/chrome_service_name.h" #include "chrome/browser/chromeos/drive/fileapi/drivefs_file_system_backend_delegate.h" #include "chrome/browser/chromeos/drive/fileapi/file_system_backend_delegate.h" #include "chrome/browser/chromeos/file_manager/app_id.h" @@ -1280,8 +1278,6 @@ chrome::AddMetricsExtraParts(main_parts.get()); - main_parts->AddParts(ChromeService::GetInstance()->CreateExtraParts()); - return main_parts; } @@ -1407,8 +1403,7 @@ } void ChromeContentBrowserClient::RenderProcessWillLaunch( - content::RenderProcessHost* host, - service_manager::mojom::ServiceRequest* service_request) { + content::RenderProcessHost* host) { int id = host->GetID(); Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); host->AddFilter(new ChromeRenderMessageFilter(id, profile)); @@ -1455,17 +1450,6 @@ for (size_t i = 0; i < extra_parts_.size(); ++i) extra_parts_[i]->RenderProcessWillLaunch(host); - - mojo::PendingRemote<service_manager::mojom::Service> service; - *service_request = service.InitWithNewPipeAndPassReceiver(); - service_manager::Identity renderer_identity = host->GetChildIdentity(); - mojo::Remote<service_manager::mojom::ProcessMetadata> metadata; - ChromeService::GetInstance()->connector()->RegisterServiceInstance( - service_manager::Identity(chrome::mojom::kRendererServiceName, - renderer_identity.instance_group(), - renderer_identity.instance_id(), - base::Token::CreateRandom()), - std::move(service), metadata.BindNewPipeAndPassReceiver()); } GURL ChromeContentBrowserClient::GetEffectiveURL( @@ -3117,9 +3101,9 @@ web_prefs->device_scale_adjustment = GetDeviceScaleAdjustment(); web_prefs->force_enable_zoom = prefs->GetBoolean(prefs::kWebKitForceEnableZoom); +#endif web_prefs->force_dark_mode_enabled = prefs->GetBoolean(prefs::kWebKitForceDarkModeEnabled); -#endif #if defined(OS_ANDROID) web_prefs->password_echo_enabled = @@ -3881,6 +3865,17 @@ #endif // BUILDFLAG(ENABLE_SPELLCHECK) } +void ChromeContentBrowserClient::BindHostReceiverForRendererOnIOThread( + int render_process_id, + mojo::GenericPendingReceiver* receiver) { + if (auto host_receiver = + receiver->As<startup_metric_utils::mojom::StartupMetricHost>()) { + startup_metric_utils::StartupMetricHostImpl::Create( + std::move(host_receiver)); + return; + } +} + void ChromeContentBrowserClient::WillStartServiceManager() { #if defined(OS_WIN) if (startup_data_) { @@ -3984,12 +3979,6 @@ void ChromeContentBrowserClient::RunServiceInstanceOnIOThread( const service_manager::Identity& identity, mojo::PendingReceiver<service_manager::mojom::Service>* receiver) { - if (identity.name() == chrome::mojom::kServiceName) { - ChromeService::GetInstance()->CreateChromeServiceRequestHandler().Run( - std::move(*receiver)); - return; - } - if (identity.name() == heap_profiling::mojom::kServiceName) { heap_profiling::HeapProfilingService::GetServiceFactory().Run( std::move(*receiver)); @@ -4013,7 +4002,6 @@ std::vector<service_manager::Manifest> ChromeContentBrowserClient::GetExtraServiceManifests() { auto manifests = GetChromeBuiltinServiceManifests(); - manifests.push_back(GetChromeRendererManifest()); #if BUILDFLAG(ENABLE_NACL) manifests.push_back(GetNaClLoaderManifest());
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index 0b9c225..763c35e 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h
@@ -20,7 +20,6 @@ #include "base/memory/weak_ptr.h" #include "base/sequenced_task_runner.h" #include "build/build_config.h" -#include "chrome/browser/chrome_service.h" #include "chrome/browser/startup_data.h" #include "content/public/browser/content_browser_client.h" #include "content/public/common/previews_state.h" @@ -129,9 +128,7 @@ bool* in_memory) override; content::WebContentsViewDelegate* GetWebContentsViewDelegate( content::WebContents* web_contents) override; - void RenderProcessWillLaunch( - content::RenderProcessHost* host, - service_manager::mojom::ServiceRequest* service_request) override; + void RenderProcessWillLaunch(content::RenderProcessHost* host) override; bool AllowGpuLaunchRetryOnIOThread() override; GURL GetEffectiveURL(content::BrowserContext* browser_context, const GURL& url) override; @@ -395,6 +392,9 @@ void BindHostReceiverForRenderer( content::RenderProcessHost* render_process_host, mojo::GenericPendingReceiver receiver) override; + void BindHostReceiverForRendererOnIOThread( + int render_process_id, + mojo::GenericPendingReceiver* receiver) override; void WillStartServiceManager() override; void RunServiceInstance( const service_manager::Identity& identity,
diff --git a/chrome/browser/chrome_service.cc b/chrome/browser/chrome_service.cc deleted file mode 100644 index 94edf7b..0000000 --- a/chrome/browser/chrome_service.cc +++ /dev/null
@@ -1,143 +0,0 @@ -// Copyright 2017 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/chrome_service.h" - -#include "base/bind.h" -#include "base/no_destructor.h" -#include "base/single_thread_task_runner.h" -#include "base/task/post_task.h" -#include "chrome/browser/chrome_browser_main_extra_parts.h" -#include "chrome/common/constants.mojom.h" -#include "components/startup_metric_utils/browser/startup_metric_host_impl.h" -#include "content/public/browser/browser_task_traits.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/content_browser_client.h" -#include "content/public/browser/system_connector.h" -#include "content/public/common/content_client.h" -#include "content/public/common/service_manager_connection.h" -#include "services/service_manager/public/cpp/binder_registry.h" -#include "services/service_manager/public/cpp/connector.h" -#include "services/service_manager/public/cpp/service.h" -#include "services/service_manager/public/cpp/service_binding.h" - -class ChromeService::IOThreadContext : public service_manager::Service { - public: - IOThreadContext() { - scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner = - base::CreateSingleThreadTaskRunner({content::BrowserThread::UI}); - - registry_.AddInterface(base::BindRepeating( - &startup_metric_utils::StartupMetricHostImpl::Create)); - } - ~IOThreadContext() override = default; - - void BindServiceRequest(service_manager::mojom::ServiceRequest request) { - service_binding_.Bind(std::move(request)); - } - - void BindConnector( - service_manager::mojom::ConnectorRequest connector_request) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - - // NOTE: It's not safe to modify |connector_request_| here since it's read - // on the IO thread. Post a task instead. As long as this task is posted - // before any code attempts to connect to the chrome service, there's no - // race. - base::CreateSingleThreadTaskRunner({content::BrowserThread::IO}) - ->PostTask(FROM_HERE, - base::BindOnce(&IOThreadContext::BindConnectorOnIOThread, - base::Unretained(this), - std::move(connector_request))); - } - - private: - void BindConnectorOnIOThread( - service_manager::mojom::ConnectorRequest connector_request) { - DCHECK_CURRENTLY_ON(content::BrowserThread::IO); - connector_request_ = std::move(connector_request); - } - - // service_manager::Service: - void OnStart() override { - DCHECK_CURRENTLY_ON(content::BrowserThread::IO); - DCHECK(connector_request_.is_pending()); - service_binding_.GetConnector()->BindConnectorRequest( - std::move(connector_request_)); - } - - void OnBindInterface(const service_manager::BindSourceInfo& remote_info, - const std::string& name, - mojo::ScopedMessagePipeHandle handle) override { - DCHECK_CURRENTLY_ON(content::BrowserThread::IO); - if (!handle.is_valid()) - return; - - if (!registry_.TryBindInterface(name, &handle)) - registry_with_source_info_.TryBindInterface(name, &handle, remote_info); - } - - service_manager::mojom::ConnectorRequest connector_request_; - - service_manager::ServiceBinding service_binding_{this}; - service_manager::BinderRegistry registry_; - service_manager::BinderRegistryWithArgs< - const service_manager::BindSourceInfo&> - registry_with_source_info_; - - DISALLOW_COPY_AND_ASSIGN(IOThreadContext); -}; - -class ChromeService::ExtraParts : public ChromeBrowserMainExtraParts { - public: - ExtraParts() = default; - ~ExtraParts() override = default; - - private: - void PostCreateThreads() override { - // Initializing the connector asynchronously configures the Connector on the - // IO thread. This needs to be done before WarmService() is called or - // ChromeService::BindConnector() can race with ChromeService::OnStart(). - ChromeService::GetInstance()->InitConnector(); - - // TODO(https://crbug.com/904148): This should not use |WarmService()|. - content::GetSystemConnector()->WarmService( - service_manager::ServiceFilter::ByName(chrome::mojom::kServiceName)); - } - - DISALLOW_COPY_AND_ASSIGN(ExtraParts); -}; - -// static -ChromeService* ChromeService::GetInstance() { - static base::NoDestructor<ChromeService> service; - return service.get(); -} - -ChromeBrowserMainExtraParts* ChromeService::CreateExtraParts() { - return new ExtraParts; -} - -content::ServiceManagerConnection::ServiceRequestHandler -ChromeService::CreateChromeServiceRequestHandler() { - return base::BindRepeating(&ChromeService::BindChromeServiceRequest, - base::Unretained(this)); -} - -ChromeService::ChromeService() - : io_thread_context_(std::make_unique<IOThreadContext>()) {} - -ChromeService::~ChromeService() = default; - -void ChromeService::InitConnector() { - service_manager::mojom::ConnectorRequest request; - connector_ = service_manager::Connector::Create(&request); - io_thread_context_->BindConnector(std::move(request)); -} - -void ChromeService::BindChromeServiceRequest( - service_manager::mojom::ServiceRequest request) { - DCHECK_CURRENTLY_ON(content::BrowserThread::IO); - io_thread_context_->BindServiceRequest(std::move(request)); -}
diff --git a/chrome/browser/chrome_service.h b/chrome/browser/chrome_service.h deleted file mode 100644 index 8cacb2f..0000000 --- a/chrome/browser/chrome_service.h +++ /dev/null
@@ -1,56 +0,0 @@ -// Copyright 2017 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 CHROME_BROWSER_CHROME_SERVICE_H_ -#define CHROME_BROWSER_CHROME_SERVICE_H_ - -#include "base/no_destructor.h" -#include "content/public/common/service_manager_connection.h" -#include "mojo/public/cpp/system/message_pipe.h" -#include "services/service_manager/public/mojom/service.mojom-forward.h" - -namespace service_manager { -class Connector; -class Service; -} // namespace service_manager - -class ChromeBrowserMainExtraParts; - -// Provides access to a service for the "chrome" content embedder. Actual -// service_manager::Service implementation lives on IO thread (IOThreadContext). -class ChromeService { - public: - static ChromeService* GetInstance(); - - // ChromeBrowserMain takes ownership of the returned parts. - ChromeBrowserMainExtraParts* CreateExtraParts(); - - content::ServiceManagerConnection::ServiceRequestHandler - CreateChromeServiceRequestHandler(); - - // This is available after the content::ServiceManagerConnection is - // initialized. - service_manager::Connector* connector() { return connector_.get(); } - - private: - friend class base::NoDestructor<ChromeService>; - - class ExtraParts; - class IOThreadContext; - - ChromeService(); - ~ChromeService(); - - void InitConnector(); - - void BindChromeServiceRequest(service_manager::mojom::ServiceRequest request); - - const std::unique_ptr<IOThreadContext> io_thread_context_; - - std::unique_ptr<service_manager::Connector> connector_; - - DISALLOW_COPY_AND_ASSIGN(ChromeService); -}; - -#endif // CHROME_BROWSER_CHROME_SERVICE_H_
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 55af8d55..d70f8852 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -725,8 +725,6 @@ "chrome_browser_main_chromeos.h", "chrome_content_browser_client_chromeos_part.cc", "chrome_content_browser_client_chromeos_part.h", - "chrome_service_name.cc", - "chrome_service_name.h", "crostini/crostini_export_import.cc", "crostini/crostini_export_import.h", "crostini/crostini_export_import_notification.cc",
diff --git a/chrome/browser/chromeos/app_mode/startup_app_launcher_unittest.cc b/chrome/browser/chromeos/app_mode/startup_app_launcher_unittest.cc index 3ffa0c53..0f43410 100644 --- a/chrome/browser/chromeos/app_mode/startup_app_launcher_unittest.cc +++ b/chrome/browser/chromeos/app_mode/startup_app_launcher_unittest.cc
@@ -207,8 +207,10 @@ : public extensions::ExternalProviderInterface::VisitorInterface { public: TestKioskLoaderVisitor(content::BrowserContext* browser_context, + extensions::ExtensionRegistry* extension_registry, extensions::ExtensionService* extension_service) : browser_context_(browser_context), + extension_registry_(extension_registry), extension_service_(extension_service) {} ~TestKioskLoaderVisitor() override = default; @@ -263,7 +265,8 @@ bool OnExternalExtensionFileFound( const ExternalInstallInfoFile& info) override { const extensions::Extension* existing = - extension_service_->GetExtensionById(info.extension_id, true); + extension_registry_->GetExtensionById( + info.extension_id, extensions::ExtensionRegistry::COMPATIBILITY); // Alredy exists, and does not require update. if (existing && existing->version().CompareTo(info.version) >= 0) return false; @@ -282,7 +285,8 @@ bool OnExternalExtensionUpdateUrlFound( const ExternalInstallInfoUpdateUrl& info, bool is_initial_load) override { - if (extension_service_->GetExtensionById(info.extension_id, true)) + if (extension_registry_->GetExtensionById( + info.extension_id, extensions::ExtensionRegistry::COMPATIBILITY)) return false; if (!extension_service_->pending_extension_manager() @@ -320,6 +324,7 @@ private: content::BrowserContext* const browser_context_; + extensions::ExtensionRegistry* const extension_registry_; extensions::ExtensionService* const extension_service_; std::set<std::string> pending_crx_files_; @@ -349,8 +354,8 @@ extensions::ExtensionServiceTestBase::SetUp(); InitializeEmptyExtensionService(); - external_apps_loader_handler_ = - std::make_unique<TestKioskLoaderVisitor>(browser_context(), service()); + external_apps_loader_handler_ = std::make_unique<TestKioskLoaderVisitor>( + browser_context(), registry(), service()); CreateAndInitializeKioskAppsProviders(external_apps_loader_handler_.get()); extensions::TestEventRouter* event_router =
diff --git a/chrome/browser/chromeos/chrome_service_name.cc b/chrome/browser/chromeos/chrome_service_name.cc deleted file mode 100644 index faed9da..0000000 --- a/chrome/browser/chromeos/chrome_service_name.cc +++ /dev/null
@@ -1,11 +0,0 @@ -// Copyright 2017 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/chromeos/chrome_service_name.h" - -namespace chromeos { - -const char kChromeServiceName[] = "chrome"; - -} // namespace chromeos
diff --git a/chrome/browser/chromeos/chrome_service_name.h b/chrome/browser/chromeos/chrome_service_name.h deleted file mode 100644 index 248becbe..0000000 --- a/chrome/browser/chromeos/chrome_service_name.h +++ /dev/null
@@ -1,16 +0,0 @@ -// Copyright 2017 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 CHROME_BROWSER_CHROMEOS_CHROME_SERVICE_NAME_H_ -#define CHROME_BROWSER_CHROMEOS_CHROME_SERVICE_NAME_H_ - -namespace chromeos { - -// This is the service name used for services exposed by Chrome. Interfaces -// exported (and potentially used inside Chrome) are registered under this name. -extern const char kChromeServiceName[]; - -} // namespace chromeos - -#endif // CHROME_BROWSER_CHROMEOS_CHROME_SERVICE_NAME_H_
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc index 7fdf431e9..e0c8697e 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
@@ -1064,7 +1064,8 @@ WRAPPED_INSTANTIATE_TEST_SUITE_P( NavigationList, /* navigation_list.js */ FilesAppBrowserTest, - ::testing::Values(TestCase("navigationScrollsWhenClipped"))); + ::testing::Values(TestCase("navigationListHorizontalScroll"), + TestCase("navigationListVerticalScroll"))); WRAPPED_INSTANTIATE_TEST_SUITE_P( Search, /* search.js */
diff --git a/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc b/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc index 259f967..650d89f 100644 --- a/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc +++ b/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc
@@ -31,6 +31,7 @@ #include "content/public/test/test_browser_thread_bundle.h" #include "extensions/browser/entry_info.h" #include "extensions/browser/extension_prefs.h" +#include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" #include "extensions/common/constants.h" #include "extensions/common/extension_builder.h" @@ -565,8 +566,10 @@ graphr.AddFlags(extensions::Extension::InitFromValueFlags::FROM_BOOKMARK); extension_service_->AddExtension(graphr.Build().get()); - const extensions::Extension* extension = - extension_service_->GetExtensionById(kGraphrId, false); + extensions::ExtensionRegistry* registry = + extensions::ExtensionRegistry::Get(&test_profile_); + const extensions::Extension* extension = registry->GetExtensionById( + kGraphrId, extensions::ExtensionRegistry::ENABLED); ASSERT_EQ(extension->GetType(), extensions::Manifest::Type::TYPE_HOSTED_APP); ASSERT_TRUE(extension->from_bookmark());
diff --git a/chrome/browser/chromeos/first_run/drive_first_run_controller.cc b/chrome/browser/chromeos/first_run/drive_first_run_controller.cc index c64a3c1..4511e19 100644 --- a/chrome/browser/chromeos/first_run/drive_first_run_controller.cc +++ b/chrome/browser/chromeos/first_run/drive_first_run_controller.cc
@@ -23,7 +23,6 @@ #include "chrome/browser/background/background_contents_service_observer.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" -#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/notifications/notification_display_service.h" #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" #include "chrome/browser/ui/singleton_tabs.h" @@ -323,9 +322,10 @@ return; } - extensions::ExtensionService* extension_service = - extensions::ExtensionSystem::Get(profile_)->extension_service(); - if (!extension_service->GetExtensionById(drive_hosted_app_id_, false)) { + extensions::ExtensionRegistry* extension_registry = + extensions::ExtensionRegistry::Get(profile_); + if (!extension_registry->GetExtensionById( + drive_hosted_app_id_, extensions::ExtensionRegistry::ENABLED)) { LOG(WARNING) << "Drive app is not installed."; OnOfflineInit(false, OUTCOME_APP_NOT_INSTALLED); return; @@ -403,11 +403,11 @@ } void DriveFirstRunController::ShowNotification() { - extensions::ExtensionService* service = - extensions::ExtensionSystem::Get(profile_)->extension_service(); - DCHECK(service); - const extensions::Extension* extension = - service->GetExtensionById(drive_hosted_app_id_, false); + extensions::ExtensionRegistry* registry = + extensions::ExtensionRegistry::Get(profile_); + DCHECK(registry); + const extensions::Extension* extension = registry->GetExtensionById( + drive_hosted_app_id_, extensions::ExtensionRegistry::ENABLED); DCHECK(extension); message_center::RichNotificationData data;
diff --git a/chrome/browser/chromeos/first_run/first_run.cc b/chrome/browser/chromeos/first_run/first_run.cc index 823d7b81..de7fa8d 100644 --- a/chrome/browser/chromeos/first_run/first_run.cc +++ b/chrome/browser/chromeos/first_run/first_run.cc
@@ -17,7 +17,6 @@ #include "chrome/browser/chromeos/login/ui/login_display_host.h" #include "chrome/browser/chromeos/login/wizard_controller.h" #include "chrome/browser/chromeos/profiles/profile_helper.h" -#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/policy/profile_policy_connector.h" #include "chrome/browser/prefs/pref_service_syncable_util.h" #include "chrome/browser/profiles/profile.h" @@ -38,7 +37,7 @@ #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_service.h" #include "content/public/common/content_switches.h" -#include "extensions/browser/extension_system.h" +#include "extensions/browser/extension_registry.h" #include "extensions/common/constants.h" #include "ui/gfx/geometry/rect.h" @@ -48,13 +47,14 @@ namespace { void LaunchDialogForProfile(Profile* profile) { - extensions::ExtensionService* service = - extensions::ExtensionSystem::Get(profile)->extension_service(); - if (!service) + extensions::ExtensionRegistry* registry = + extensions::ExtensionRegistry::Get(profile); + if (!registry) return; const extensions::Extension* extension = - service->GetExtensionById(extension_misc::kFirstRunDialogId, false); + registry->GetExtensionById(extension_misc::kFirstRunDialogId, + extensions::ExtensionRegistry::ENABLED); if (!extension) return;
diff --git a/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc b/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc index 45a3623..2827393 100644 --- a/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc +++ b/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc
@@ -25,6 +25,7 @@ #include "chrome/grit/browser_resources.h" #include "extensions/browser/extension_pref_value_map.h" #include "extensions/browser/extension_pref_value_map_factory.h" +#include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" #include "extensions/common/extension.h" #include "extensions/common/manifest_constants.h" @@ -94,12 +95,11 @@ const std::string& extension_id, const std::string& manifest, const base::FilePath& file_path) { - extensions::ExtensionSystem* extension_system = - extensions::ExtensionSystem::Get(profile); - extensions::ExtensionService* extension_service = - extension_system->extension_service(); - DCHECK(extension_service); - if (extension_service->GetExtensionById(extension_id, false)) { + extensions::ExtensionRegistry* extension_registry = + extensions::ExtensionRegistry::Get(profile); + DCHECK(extension_registry); + if (extension_registry->GetExtensionById( + extension_id, extensions::ExtensionRegistry::ENABLED)) { VLOG(1) << "the IME extension(id=\"" << extension_id << "\") is already enabled"; return; @@ -119,6 +119,11 @@ true, // is_enabled. true); // is_incognito_enabled. DCHECK_EQ(loaded_extension_id, extension_id); + extensions::ExtensionSystem* extension_system = + extensions::ExtensionSystem::Get(profile); + extensions::ExtensionService* extension_service = + extension_system->extension_service(); + DCHECK(extension_service); if (!extension_service->IsExtensionEnabled(loaded_extension_id)) { LOG(ERROR) << "An IME extension(id=\"" << loaded_extension_id << "\") is not enabled after loading";
diff --git a/chrome/browser/chromeos/login/demo_mode/demo_app_launcher.cc b/chrome/browser/chromeos/login/demo_mode/demo_app_launcher.cc index 0170865..f31b091e 100644 --- a/chrome/browser/chromeos/login/demo_mode/demo_app_launcher.cc +++ b/chrome/browser/chromeos/login/demo_mode/demo_app_launcher.cc
@@ -23,6 +23,7 @@ #include "components/account_id/account_id.h" #include "components/session_manager/core/session_manager.h" #include "components/user_manager/user_names.h" +#include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" #include "extensions/common/constants.h" #include "extensions/common/extension.h" @@ -77,8 +78,10 @@ const std::string extension_id = extension_service->component_loader()->Add( IDR_DEMO_APP_MANIFEST, *demo_app_path_); - const extensions::Extension* extension = - extension_service->GetExtensionById(extension_id, true); + extensions::ExtensionRegistry* extension_registry = + extensions::ExtensionRegistry::Get(profile); + const extensions::Extension* extension = extension_registry->GetExtensionById( + extension_id, extensions::ExtensionRegistry::COMPATIBILITY); if (!extension) { // We've already done too much setup at this point to just return out, it // is safer to just restart.
diff --git a/chrome/browser/chromeos/login/reset_browsertest.cc b/chrome/browser/chromeos/login/reset_browsertest.cc index 5c27c74e..0f57b1b4 100644 --- a/chrome/browser/chromeos/login/reset_browsertest.cc +++ b/chrome/browser/chromeos/login/reset_browsertest.cc
@@ -438,7 +438,9 @@ prefs->SetBoolean(prefs::kFactoryResetRequested, true); } -IN_PROC_BROWSER_TEST_F(ResetFirstAfterBootTestWithRollback, RollbackAvailable) { +// See http://crbug.com/990362 for details. +IN_PROC_BROWSER_TEST_F(ResetFirstAfterBootTestWithRollback, + DISABLED_RollbackAvailable) { PrefService* prefs = g_browser_process->local_state(); // PRE test triggers start with Reset screen.
diff --git a/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc b/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc index 70bcb39f..0013d07 100644 --- a/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc +++ b/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc
@@ -55,9 +55,6 @@ #include "chrome/browser/chromeos/policy/external_data_handlers/print_servers_external_data_handler.h" #include "chrome/browser/chromeos/policy/external_data_handlers/user_avatar_image_external_data_handler.h" #include "chrome/browser/chromeos/policy/external_data_handlers/wallpaper_image_external_data_handler.h" -#include "chrome/browser/chromeos/printing/bulk_printers_calculator_factory.h" -#include "chrome/browser/chromeos/printing/print_servers_provider.h" -#include "chrome/browser/chromeos/printing/print_servers_provider_factory.h" #include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/chromeos/session_length_limiter.h" #include "chrome/browser/chromeos/settings/cros_settings.h" @@ -444,7 +441,6 @@ } multi_profile_user_controller_.reset(); cloud_external_data_policy_handlers_.clear(); - BulkPrintersCalculatorFactory::Get()->ShutdownProfiles(); registrar_.RemoveAll(); }
diff --git a/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc b/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc index 1cf3fa3..5f145ee 100644 --- a/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc +++ b/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc
@@ -43,7 +43,6 @@ #include "chrome/browser/chromeos/policy/remote_commands/affiliated_remote_commands_invalidator.h" #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" #include "chrome/browser/chromeos/policy/tpm_auto_update_mode_policy_handler.h" -#include "chrome/browser/chromeos/printing/bulk_printers_calculator_factory.h" #include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/chromeos/settings/device_settings_service.h" #include "chrome/browser/chromeos/system/timezone_util.h" @@ -294,7 +293,6 @@ device_cloud_external_data_policy_handlers_) { device_cloud_external_data_policy_handler->Shutdown(); } - chromeos::BulkPrintersCalculatorFactory::Get()->ShutdownForDevice(); ChromeBrowserPolicyConnector::Shutdown(); }
diff --git a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc index 6b821a19..038279f 100644 --- a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc +++ b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc
@@ -1129,12 +1129,14 @@ // Verify that the hosted app was installed. Profile* profile = GetProfileForTest(); ASSERT_TRUE(profile); - extensions::ExtensionService* extension_service = - extensions::ExtensionSystem::Get(profile)->extension_service(); - EXPECT_TRUE(extension_service->GetExtensionById(kHostedAppID, true)); + extensions::ExtensionRegistry* extension_registry = + extensions::ExtensionRegistry::Get(profile); + EXPECT_TRUE(extension_registry->GetExtensionById( + kHostedAppID, extensions::ExtensionRegistry::COMPATIBILITY)); // Verify that the extension was not installed. - EXPECT_FALSE(extension_service->GetExtensionById(kGoodExtensionID, true)); + EXPECT_FALSE(extension_registry->GetExtensionById( + kGoodExtensionID, extensions::ExtensionRegistry::COMPATIBILITY)); // Verify that the app was downloaded to the account's extension cache. base::FilePath test_dir; @@ -1213,12 +1215,14 @@ // Verify that the hosted app was installed. Profile* profile = GetProfileForTest(); ASSERT_TRUE(profile); - extensions::ExtensionService* extension_service = - extensions::ExtensionSystem::Get(profile)->extension_service(); - EXPECT_TRUE(extension_service->GetExtensionById(kHostedAppID, true)); + extensions::ExtensionRegistry* extension_registry = + extensions::ExtensionRegistry::Get(profile); + EXPECT_TRUE(extension_registry->GetExtensionById( + kHostedAppID, extensions::ExtensionRegistry::COMPATIBILITY)); // Verify that the extension was not installed. - EXPECT_FALSE(extension_service->GetExtensionById(kGoodExtensionID, true)); + EXPECT_FALSE(extension_registry->GetExtensionById( + kGoodExtensionID, extensions::ExtensionRegistry::COMPATIBILITY)); // Verify that the app is still in the account's extension cache. { @@ -2301,9 +2305,10 @@ // Verify that the app was installed. Profile* profile = GetProfileForTest(); ASSERT_TRUE(profile); - extensions::ExtensionService* extension_service = - extensions::ExtensionSystem::Get(profile)->extension_service(); - EXPECT_TRUE(extension_service->GetExtensionById(kShowManagedStorageID, true)); + extensions::ExtensionRegistry* extension_registry = + extensions::ExtensionRegistry::Get(profile); + EXPECT_TRUE(extension_registry->GetExtensionById( + kShowManagedStorageID, extensions::ExtensionRegistry::COMPATIBILITY)); // Wait for the app policy if it hasn't been fetched yet. ProfilePolicyConnector* connector = profile->GetProfilePolicyConnector();
diff --git a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc index 6ff2ed4f..2086a856 100644 --- a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc +++ b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc
@@ -43,7 +43,7 @@ namespace policy { // A pattern for validating hostnames. -const char hostNameRegex[] = "^([A-z0-9][A-z0-9-]+\\.)+[A-z0-9]+$"; +const char hostNameRegex[] = "^([A-z0-9][A-z0-9-]*\\.)+[A-z0-9]+$"; namespace {
diff --git a/chrome/browser/chromeos/policy/external_data_handlers/device_native_printers_external_data_handler.cc b/chrome/browser/chromeos/policy/external_data_handlers/device_native_printers_external_data_handler.cc index 06543fb3..46cad2a 100644 --- a/chrome/browser/chromeos/policy/external_data_handlers/device_native_printers_external_data_handler.cc +++ b/chrome/browser/chromeos/policy/external_data_handlers/device_native_printers_external_data_handler.cc
@@ -16,7 +16,8 @@ namespace { base::WeakPtr<chromeos::BulkPrintersCalculator> GetBulkPrintersCalculator() { - return chromeos::BulkPrintersCalculatorFactory::Get()->GetForDevice(); + return chromeos::BulkPrintersCalculatorFactory::Get()->GetForDevice( + /*create_if_not_exists=*/true); } } // namespace @@ -30,7 +31,9 @@ this)) {} DeviceNativePrintersExternalDataHandler:: - ~DeviceNativePrintersExternalDataHandler() = default; + ~DeviceNativePrintersExternalDataHandler() { + chromeos::BulkPrintersCalculatorFactory::Get()->Shutdown(); +} void DeviceNativePrintersExternalDataHandler::OnDeviceExternalDataSet( const std::string& policy) { @@ -50,8 +53,7 @@ } void DeviceNativePrintersExternalDataHandler::Shutdown() { - if (device_native_printers_observer_) - device_native_printers_observer_.reset(); + device_native_printers_observer_.reset(); } } // namespace policy
diff --git a/chrome/browser/chromeos/policy/external_data_handlers/device_native_printers_external_data_handler_unittest.cc b/chrome/browser/chromeos/policy/external_data_handlers/device_native_printers_external_data_handler_unittest.cc index 5735e25..449feed 100644 --- a/chrome/browser/chromeos/policy/external_data_handlers/device_native_printers_external_data_handler_unittest.cc +++ b/chrome/browser/chromeos/policy/external_data_handlers/device_native_printers_external_data_handler_unittest.cc
@@ -74,7 +74,7 @@ std::make_unique<DeviceNativePrintersExternalDataHandler>( &policy_service_); external_printers_ = - chromeos::BulkPrintersCalculatorFactory::Get()->GetForDevice(); + chromeos::BulkPrintersCalculatorFactory::Get()->GetForDevice(true); external_printers_->SetAccessMode( chromeos::BulkPrintersCalculator::ALL_ACCESS); }
diff --git a/chrome/browser/chromeos/policy/external_data_handlers/native_printers_external_data_handler.cc b/chrome/browser/chromeos/policy/external_data_handlers/native_printers_external_data_handler.cc index db5ed4cf..c6a1734 100644 --- a/chrome/browser/chromeos/policy/external_data_handlers/native_printers_external_data_handler.cc +++ b/chrome/browser/chromeos/policy/external_data_handlers/native_printers_external_data_handler.cc
@@ -19,7 +19,8 @@ base::WeakPtr<chromeos::BulkPrintersCalculator> GetBulkPrintersCalculator( const std::string& user_id) { return chromeos::BulkPrintersCalculatorFactory::Get()->GetForAccountId( - CloudExternalDataPolicyHandler::GetAccountId(user_id)); + CloudExternalDataPolicyHandler::GetAccountId(user_id), + /*create_if_not_exists=*/true); } } // namespace
diff --git a/chrome/browser/chromeos/printing/bulk_printers_calculator_factory.cc b/chrome/browser/chromeos/printing/bulk_printers_calculator_factory.cc index 93bda14..d0d2283 100644 --- a/chrome/browser/chromeos/printing/bulk_printers_calculator_factory.cc +++ b/chrome/browser/chromeos/printing/bulk_printers_calculator_factory.cc
@@ -4,7 +4,7 @@ #include "chrome/browser/chromeos/printing/bulk_printers_calculator_factory.h" -#include "base/lazy_instance.h" +#include "base/no_destructor.h" #include "chrome/browser/chromeos/printing/bulk_printers_calculator.h" #include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/profiles/profile.h" @@ -13,39 +13,34 @@ namespace chromeos { -namespace { - -base::LazyInstance<BulkPrintersCalculatorFactory>::DestructorAtExit - g_printers_factory = LAZY_INSTANCE_INITIALIZER; - -} // namespace - // static BulkPrintersCalculatorFactory* BulkPrintersCalculatorFactory::Get() { - return g_printers_factory.Pointer(); + static base::NoDestructor<BulkPrintersCalculatorFactory> instance; + return instance.get(); } base::WeakPtr<BulkPrintersCalculator> -BulkPrintersCalculatorFactory::GetForAccountId(const AccountId& account_id) { +BulkPrintersCalculatorFactory::GetForAccountId(const AccountId& account_id, + bool create_if_not_exists) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - auto found = printers_by_user_.find(account_id); - if (found != printers_by_user_.end()) { - return found->second->AsWeakPtr(); - } - - printers_by_user_[account_id] = BulkPrintersCalculator::Create(); + auto it = printers_by_user_.find(account_id); + if (it != printers_by_user_.end()) + return it->second->AsWeakPtr(); + if (!create_if_not_exists) + return nullptr; + printers_by_user_.emplace(account_id, BulkPrintersCalculator::Create()); return printers_by_user_[account_id]->AsWeakPtr(); } base::WeakPtr<BulkPrintersCalculator> -BulkPrintersCalculatorFactory::GetForProfile(Profile* profile) { +BulkPrintersCalculatorFactory::GetForProfile(Profile* profile, + bool create_if_not_exists) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); const user_manager::User* user = ProfileHelper::Get()->GetUserByProfile(profile); if (!user) return nullptr; - - return GetForAccountId(user->GetAccountId()); + return GetForAccountId(user->GetAccountId(), create_if_not_exists); } void BulkPrintersCalculatorFactory::RemoveForUserId( @@ -55,20 +50,19 @@ } base::WeakPtr<BulkPrintersCalculator> -BulkPrintersCalculatorFactory::GetForDevice() { +BulkPrintersCalculatorFactory::GetForDevice(bool create_if_not_exists) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - if (!device_printers_) - device_printers_ = BulkPrintersCalculator::Create(); + if (device_printers_) + return device_printers_->AsWeakPtr(); + if (!create_if_not_exists) + return nullptr; + device_printers_ = BulkPrintersCalculator::Create(); return device_printers_->AsWeakPtr(); } -void BulkPrintersCalculatorFactory::ShutdownProfiles() { +void BulkPrintersCalculatorFactory::Shutdown() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); printers_by_user_.clear(); -} - -void BulkPrintersCalculatorFactory::ShutdownForDevice() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); device_printers_.reset(); }
diff --git a/chrome/browser/chromeos/printing/bulk_printers_calculator_factory.h b/chrome/browser/chromeos/printing/bulk_printers_calculator_factory.h index c02c287..00af1c1 100644 --- a/chrome/browser/chromeos/printing/bulk_printers_calculator_factory.h +++ b/chrome/browser/chromeos/printing/bulk_printers_calculator_factory.h
@@ -8,7 +8,6 @@ #include <map> #include <memory> -#include "base/lazy_instance.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" @@ -20,40 +19,51 @@ class BulkPrintersCalculator; -// Dispenses BulkPrintersCalculator objects based on account id. Access to this -// object should be sequenced. +// Dispenses BulkPrintersCalculator objects based on account id or for device +// context. Access to this object should be sequenced. class BulkPrintersCalculatorFactory { public: + // It never returns nullptr. static BulkPrintersCalculatorFactory* Get(); + BulkPrintersCalculatorFactory(); + // Returns a WeakPtr to the BulkPrintersCalculator registered for - // |account_id|. If an BulkPrintersCalculator does not exist, one will be - // created for |account_id|. The returned object remains valid until - // RemoveForUserId or Shutdown is called. + // |account_id|. + // If requested BulkPrintersCalculator does not exist, the output depends on + // the given parameter |create_if_not_exists|. If it is true, the object is + // created and registered, otherwise nullptr is returned. + // The returned object remains valid until RemoveForUserId or Shutdown is + // called. base::WeakPtr<BulkPrintersCalculator> GetForAccountId( - const AccountId& account_id); + const AccountId& account_id, + bool create_if_not_exists); // Returns a WeakPtr to the BulkPrintersCalculator registered for |profile| - // which could be null if |profile| does not map to a valid AccountId. The - // returned object remains valid until RemoveForUserId or Shutdown is called. - base::WeakPtr<BulkPrintersCalculator> GetForProfile(Profile* profile); + // which could be nullptr if |profile| does not map to a valid AccountId. + // If requested BulkPrintersCalculator does not exist, the output depends on + // the given parameter |create_if_not_exists|. If it is true, the object is + // created and registered, otherwise nullptr is returned. + // The returned object remains valid until RemoveForUserId or Shutdown is + // called. + base::WeakPtr<BulkPrintersCalculator> GetForProfile( + Profile* profile, + bool create_if_not_exists); // Returns a WeakPtr to the BulkPrintersCalculator registered for the device. - base::WeakPtr<BulkPrintersCalculator> GetForDevice(); + // If requested BulkPrintersCalculator does not exist, the output depends on + // the given parameter |create_if_not_exists|. If it is true, the object is + // created and registered, otherwise nullptr is returned. + // The returned object remains valid until Shutdown is called. + base::WeakPtr<BulkPrintersCalculator> GetForDevice(bool create_if_not_exists); // Deletes the BulkPrintersCalculator registered for |account_id|. void RemoveForUserId(const AccountId& account_id); - // Tear down all BulkPrintersCalculator created for users/profiles. - void ShutdownProfiles(); - - // Tear down BulkPrintersCalculator created for the device. - void ShutdownForDevice(); + // Tear down all BulkPrintersCalculator objects. + void Shutdown(); private: - friend struct base::LazyInstanceTraitsBase<BulkPrintersCalculatorFactory>; - - BulkPrintersCalculatorFactory(); ~BulkPrintersCalculatorFactory(); std::map<AccountId, std::unique_ptr<BulkPrintersCalculator>>
diff --git a/chrome/browser/chromeos/printing/calculators_policies_binder.cc b/chrome/browser/chromeos/printing/calculators_policies_binder.cc index 8a5f474..3577ed92 100644 --- a/chrome/browser/chromeos/printing/calculators_policies_binder.cc +++ b/chrome/browser/chromeos/printing/calculators_policies_binder.cc
@@ -60,7 +60,8 @@ : settings_(settings), profile_(profile) { pref_change_registrar_.Init(profile->GetPrefs()); // Bind device policies to corresponding instance of BulkPrintersCalculator. - device_printers_ = BulkPrintersCalculatorFactory::Get()->GetForDevice(); + device_printers_ = BulkPrintersCalculatorFactory::Get()->GetForDevice( + /*create_if_not_exists=*/false); if (device_printers_ && ++(BindingsCount()[device_printers_.get()]) == 1) { BindSettings(kDeviceNativePrintersAccessMode, &CalculatorsPoliciesBinderImpl::UpdateDeviceAccessMode); @@ -70,8 +71,9 @@ &CalculatorsPoliciesBinderImpl::UpdateDeviceWhitelist); } // Bind user policies to corresponding instance of BulkPrintersCalculator. - user_printers_ = - BulkPrintersCalculatorFactory::Get()->GetForProfile(profile); + user_printers_ = BulkPrintersCalculatorFactory::Get()->GetForProfile( + profile, + /*create_if_not_exists=*/false); if (user_printers_ && ++(BindingsCount()[user_printers_.get()]) == 1) { BindPref(prefs::kRecommendedNativePrintersAccessMode, &CalculatorsPoliciesBinderImpl::UpdateUserAccessMode);
diff --git a/chrome/browser/chromeos/printing/enterprise_printers_provider.cc b/chrome/browser/chromeos/printing/enterprise_printers_provider.cc index 27a4ba57..5a7d047 100644 --- a/chrome/browser/chromeos/printing/enterprise_printers_provider.cc +++ b/chrome/browser/chromeos/printing/enterprise_printers_provider.cc
@@ -52,14 +52,16 @@ // Binds instances of BulkPrintersCalculator to policies. policies_binder_ = CalculatorsPoliciesBinder::Create(settings, profile); // Get instance of BulkPrintersCalculator for device policies. - device_printers_ = BulkPrintersCalculatorFactory::Get()->GetForDevice(); + device_printers_ = BulkPrintersCalculatorFactory::Get()->GetForDevice( + /*create_if_not_exists=*/false); if (device_printers_) { device_printers_->AddObserver(this); RecalculateCompleteFlagForDevicePrinters(); } // Get instance of BulkPrintersCalculator for user policies. - user_printers_ = - BulkPrintersCalculatorFactory::Get()->GetForProfile(profile); + user_printers_ = BulkPrintersCalculatorFactory::Get()->GetForProfile( + profile, + /*create_if_not_exists=*/false); if (user_printers_) { user_printers_->AddObserver(this); RecalculateCompleteFlagForUserPrinters();
diff --git a/chrome/browser/data_reduction_proxy/data_reduction_proxy_settings_unittest_android.cc b/chrome/browser/data_reduction_proxy/data_reduction_proxy_settings_unittest_android.cc index e58d3a6..7a0435b9 100644 --- a/chrome/browser/data_reduction_proxy/data_reduction_proxy_settings_unittest_android.cc +++ b/chrome/browser/data_reduction_proxy/data_reduction_proxy_settings_unittest_android.cc
@@ -16,9 +16,9 @@ #include "base/android/scoped_java_ref.h" #include "base/base64.h" #include "base/memory/ref_counted.h" -#include "base/message_loop/message_loop.h" #include "base/strings/string_piece.h" #include "base/test/scoped_feature_list.h" +#include "base/test/scoped_task_environment.h" #include "base/test/test_simple_task_runner.h" #include "base/time/time.h" #include "chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings.h" @@ -178,7 +178,8 @@ } private: - base::MessageLoopForIO message_loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_{ + base::test::ScopedTaskEnvironment::MainThreadType::IO}; JNIEnv* env_; net::MockClientSocketFactory mock_socket_factory_; std::unique_ptr<data_reduction_proxy::DataReductionProxyTestContext>
diff --git a/chrome/browser/previews/previews_top_host_provider.cc b/chrome/browser/data_saver/data_saver_top_host_provider.cc similarity index 86% rename from chrome/browser/previews/previews_top_host_provider.cc rename to chrome/browser/data_saver/data_saver_top_host_provider.cc index 10c8a98..70e8b793 100644 --- a/chrome/browser/previews/previews_top_host_provider.cc +++ b/chrome/browser/data_saver/data_saver_top_host_provider.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/previews/previews_top_host_provider.h" +#include "chrome/browser/data_saver/data_saver_top_host_provider.h" #include "base/metrics/histogram_macros.h" #include "base/values.h" @@ -30,25 +30,26 @@ } // namespace -PreviewsTopHostProvider::PreviewsTopHostProvider( +DataSaverTopHostProvider::DataSaverTopHostProvider( content::BrowserContext* browser_context) : browser_context_(browser_context), pref_service_(Profile::FromBrowserContext(browser_context_)->GetPrefs()) { } -PreviewsTopHostProvider::~PreviewsTopHostProvider() {} +DataSaverTopHostProvider::~DataSaverTopHostProvider() {} -void PreviewsTopHostProvider::InitializeHintsFetcherTopHostBlacklist() { +void DataSaverTopHostProvider::InitializeHintsFetcherTopHostBlacklist() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(browser_context_); DCHECK_EQ(GetCurrentBlacklistState(), optimization_guide::prefs::HintsFetcherTopHostBlacklistState:: kNotInitialized); - DCHECK(pref_service_ - ->GetDictionary( - optimization_guide::prefs::kHintsFetcherTopHostBlacklist) - ->empty()); + DCHECK( + pref_service_ + ->GetDictionary( + optimization_guide::prefs::kHintsFetcherDataSaverTopHostBlacklist) + ->empty()); Profile* profile = Profile::FromBrowserContext(browser_context_); SiteEngagementService* engagement_service = @@ -83,8 +84,9 @@ "OnInitialize", top_host_blacklist->size()); - pref_service_->Set(optimization_guide::prefs::kHintsFetcherTopHostBlacklist, - *top_host_blacklist); + pref_service_->Set( + optimization_guide::prefs::kHintsFetcherDataSaverTopHostBlacklist, + *top_host_blacklist); UpdateCurrentBlacklistState( optimization_guide::prefs::HintsFetcherTopHostBlacklistState:: @@ -92,7 +94,7 @@ } // static -void PreviewsTopHostProvider::MaybeUpdateTopHostBlacklist( +void DataSaverTopHostProvider::MaybeUpdateTopHostBlacklist( content::NavigationHandle* navigation_handle) { if (!navigation_handle->GetURL().SchemeIsHTTPOrHTTPS()) return; @@ -103,14 +105,16 @@ ->GetPrefs(); if (pref_service->GetInteger( - optimization_guide::prefs::kHintsFetcherTopHostBlacklistState) != + optimization_guide::prefs:: + kHintsFetcherDataSaverTopHostBlacklistState) != static_cast<int>(optimization_guide::prefs:: HintsFetcherTopHostBlacklistState::kInitialized)) { return; } DictionaryPrefUpdate blacklist_pref( - pref_service, optimization_guide::prefs::kHintsFetcherTopHostBlacklist); + pref_service, + optimization_guide::prefs::kHintsFetcherDataSaverTopHostBlacklist); if (!blacklist_pref->FindKey(optimization_guide::HashHostForDictionary( navigation_handle->GetURL().host()))) { return; @@ -120,21 +124,22 @@ if (blacklist_pref->empty()) { blacklist_pref->Clear(); pref_service->SetInteger( - optimization_guide::prefs::kHintsFetcherTopHostBlacklistState, + optimization_guide::prefs::kHintsFetcherDataSaverTopHostBlacklistState, static_cast<int>(optimization_guide::prefs:: HintsFetcherTopHostBlacklistState::kEmpty)); } } optimization_guide::prefs::HintsFetcherTopHostBlacklistState -PreviewsTopHostProvider::GetCurrentBlacklistState() const { +DataSaverTopHostProvider::GetCurrentBlacklistState() const { return static_cast< optimization_guide::prefs::HintsFetcherTopHostBlacklistState>( pref_service_->GetInteger( - optimization_guide::prefs::kHintsFetcherTopHostBlacklistState)); + optimization_guide::prefs:: + kHintsFetcherDataSaverTopHostBlacklistState)); } -void PreviewsTopHostProvider::UpdateCurrentBlacklistState( +void DataSaverTopHostProvider::UpdateCurrentBlacklistState( optimization_guide::prefs::HintsFetcherTopHostBlacklistState new_state) { optimization_guide::prefs::HintsFetcherTopHostBlacklistState current_state = GetCurrentBlacklistState(); @@ -168,11 +173,11 @@ // TODO(mcrouse): Add histogram to record the blacklist state change. pref_service_->SetInteger( - optimization_guide::prefs::kHintsFetcherTopHostBlacklistState, + optimization_guide::prefs::kHintsFetcherDataSaverTopHostBlacklistState, static_cast<int>(new_state)); } -std::vector<std::string> PreviewsTopHostProvider::GetTopHosts( +std::vector<std::string> DataSaverTopHostProvider::GetTopHosts( size_t max_sites) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -195,7 +200,7 @@ if (GetCurrentBlacklistState() != optimization_guide::prefs::HintsFetcherTopHostBlacklistState::kEmpty) { top_host_blacklist = pref_service_->GetDictionary( - optimization_guide::prefs::kHintsFetcherTopHostBlacklist); + optimization_guide::prefs::kHintsFetcherDataSaverTopHostBlacklist); UMA_HISTOGRAM_COUNTS_1000( "OptimizationGuide.HintsFetcher.TopHostProvider.BlacklistSize." "OnRequest", @@ -246,7 +251,7 @@ return top_hosts; } -size_t PreviewsTopHostProvider::GetMinTopHostEngagementThreshold() const { +size_t DataSaverTopHostProvider::GetMinTopHostEngagementThreshold() const { // The base score for the first navigation of a host when added to the site // engagement service. The threshold corresponds to the minimum score that a // host is considered to be a top host, hosts with a lower score have not
diff --git a/chrome/browser/previews/previews_top_host_provider.h b/chrome/browser/data_saver/data_saver_top_host_provider.h similarity index 79% rename from chrome/browser/previews/previews_top_host_provider.h rename to chrome/browser/data_saver/data_saver_top_host_provider.h index 5e5e617..b4060cf2 100644 --- a/chrome/browser/previews/previews_top_host_provider.h +++ b/chrome/browser/data_saver/data_saver_top_host_provider.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_PREVIEWS_PREVIEWS_TOP_HOST_PROVIDER_H_ -#define CHROME_BROWSER_PREVIEWS_PREVIEWS_TOP_HOST_PROVIDER_H_ +#ifndef CHROME_BROWSER_DATA_SAVER_DATA_SAVER_TOP_HOST_PROVIDER_H_ +#define CHROME_BROWSER_DATA_SAVER_DATA_SAVER_TOP_HOST_PROVIDER_H_ #include <memory> #include <string> @@ -23,11 +23,12 @@ } // namespace content // An implementation of the optimization_guide::TopHostProvider for getting the -// top sites based on site engagement scores. -class PreviewsTopHostProvider : public optimization_guide::TopHostProvider { +// top sites based on site engagement scores. This is the mechanism that has +// been approved for users that have Data Saver (aka Lite Mode) enabled. +class DataSaverTopHostProvider : public optimization_guide::TopHostProvider { public: - explicit PreviewsTopHostProvider(content::BrowserContext* BrowserContext); - ~PreviewsTopHostProvider() override; + explicit DataSaverTopHostProvider(content::BrowserContext* BrowserContext); + ~DataSaverTopHostProvider() override; // Update the HintsFetcherTopHostBlacklist by attempting to remove the host // for the current navigation from the blacklist. A host is removed if it is @@ -70,7 +71,7 @@ SEQUENCE_CHECKER(sequence_checker_); - DISALLOW_COPY_AND_ASSIGN(PreviewsTopHostProvider); + DISALLOW_COPY_AND_ASSIGN(DataSaverTopHostProvider); }; -#endif // CHROME_BROWSER_PREVIEWS_PREVIEWS_TOP_HOST_PROVIDER_H_ +#endif // CHROME_BROWSER_DATA_SAVER_DATA_SAVER_TOP_HOST_PROVIDER_H_
diff --git a/chrome/browser/previews/previews_top_host_provider_unittest.cc b/chrome/browser/data_saver/data_saver_top_host_provider_unittest.cc similarity index 84% rename from chrome/browser/previews/previews_top_host_provider_unittest.cc rename to chrome/browser/data_saver/data_saver_top_host_provider_unittest.cc index 8d51278f..562e6006 100644 --- a/chrome/browser/previews/previews_top_host_provider_unittest.cc +++ b/chrome/browser/data_saver/data_saver_top_host_provider_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/previews/previews_top_host_provider.h" +#include "chrome/browser/data_saver/data_saver_top_host_provider.h" #include "base/values.h" #include "chrome/browser/engagement/site_engagement_score.h" @@ -17,12 +17,12 @@ #include "testing/gtest/include/gtest/gtest.h" // Class to test the TopHostProvider and the HintsFetcherTopHostBlacklist. -class PreviewsTopHostProviderTest : public ChromeRenderViewHostTestHarness { +class DataSaverTopHostProviderTest : public ChromeRenderViewHostTestHarness { public: void SetUp() override { ChromeRenderViewHostTestHarness::SetUp(); - top_host_provider_ = std::make_unique<PreviewsTopHostProvider>(profile()); + top_host_provider_ = std::make_unique<DataSaverTopHostProvider>(profile()); service_ = SiteEngagementService::Get(profile()); pref_service_ = profile()->GetPrefs(); } @@ -43,7 +43,7 @@ bool IsHostBlacklisted(const std::string& host) { const base::DictionaryValue* top_host_blacklist = pref_service_->GetDictionary( - optimization_guide::prefs::kHintsFetcherTopHostBlacklist); + optimization_guide::prefs::kHintsFetcherDataSaverTopHostBlacklist); return top_host_blacklist->FindKey( optimization_guide::HashHostForDictionary(host)); } @@ -51,8 +51,8 @@ void PopulateTopHostBlacklist(size_t num_hosts) { std::unique_ptr<base::DictionaryValue> top_host_filter = pref_service_ - ->GetDictionary( - optimization_guide::prefs::kHintsFetcherTopHostBlacklist) + ->GetDictionary(optimization_guide::prefs:: + kHintsFetcherDataSaverTopHostBlacklist) ->CreateDeepCopy(); for (size_t i = 1; i <= num_hosts; i++) { @@ -60,20 +60,22 @@ base::StringPrintf("domain%zu.com", i)), true); } - pref_service_->Set(optimization_guide::prefs::kHintsFetcherTopHostBlacklist, - *top_host_filter); + pref_service_->Set( + optimization_guide::prefs::kHintsFetcherDataSaverTopHostBlacklist, + *top_host_filter); } void AddHostToBlackList(const std::string& host) { std::unique_ptr<base::DictionaryValue> top_host_filter = pref_service_ - ->GetDictionary( - optimization_guide::prefs::kHintsFetcherTopHostBlacklist) + ->GetDictionary(optimization_guide::prefs:: + kHintsFetcherDataSaverTopHostBlacklist) ->CreateDeepCopy(); top_host_filter->SetBoolKey(optimization_guide::HashHostForDictionary(host), true); - pref_service_->Set(optimization_guide::prefs::kHintsFetcherTopHostBlacklist, - *top_host_filter); + pref_service_->Set( + optimization_guide::prefs::kHintsFetcherDataSaverTopHostBlacklist, + *top_host_filter); } void SimulateUniqueNavigationsToTopHosts(size_t num_hosts) { @@ -85,29 +87,30 @@ void SimulateNavigation(GURL url) { std::unique_ptr<content::MockNavigationHandle> test_handle_ = std::make_unique<content::MockNavigationHandle>(url, main_rfh()); - PreviewsTopHostProvider::MaybeUpdateTopHostBlacklist(test_handle_.get()); + DataSaverTopHostProvider::MaybeUpdateTopHostBlacklist(test_handle_.get()); } void RemoveHostsFromBlacklist(size_t num_hosts_navigated) { std::unique_ptr<base::DictionaryValue> top_host_filter = pref_service_ - ->GetDictionary( - optimization_guide::prefs::kHintsFetcherTopHostBlacklist) + ->GetDictionary(optimization_guide::prefs:: + kHintsFetcherDataSaverTopHostBlacklist) ->CreateDeepCopy(); for (size_t i = 1; i <= num_hosts_navigated; i++) { top_host_filter->RemoveKey(optimization_guide::HashHostForDictionary( base::StringPrintf("domain%zu.com", i))); } - pref_service_->Set(optimization_guide::prefs::kHintsFetcherTopHostBlacklist, - *top_host_filter); + pref_service_->Set( + optimization_guide::prefs::kHintsFetcherDataSaverTopHostBlacklist, + *top_host_filter); } void SetTopHostBlacklistState( optimization_guide::prefs::HintsFetcherTopHostBlacklistState blacklist_state) { profile()->GetPrefs()->SetInteger( - optimization_guide::prefs::kHintsFetcherTopHostBlacklistState, + optimization_guide::prefs::kHintsFetcherDataSaverTopHostBlacklistState, static_cast<int>(blacklist_state)); } @@ -116,22 +119,23 @@ return static_cast< optimization_guide::prefs::HintsFetcherTopHostBlacklistState>( pref_service_->GetInteger( - optimization_guide::prefs::kHintsFetcherTopHostBlacklistState)); + optimization_guide::prefs:: + kHintsFetcherDataSaverTopHostBlacklistState)); } void TearDown() override { ChromeRenderViewHostTestHarness::TearDown(); } - PreviewsTopHostProvider* top_host_provider() { + DataSaverTopHostProvider* top_host_provider() { return top_host_provider_.get(); } private: - std::unique_ptr<PreviewsTopHostProvider> top_host_provider_; + std::unique_ptr<DataSaverTopHostProvider> top_host_provider_; SiteEngagementService* service_; PrefService* pref_service_; }; -TEST_F(PreviewsTopHostProviderTest, GetTopHostsMaxSites) { +TEST_F(DataSaverTopHostProviderTest, GetTopHostsMaxSites) { SetTopHostBlacklistState(optimization_guide::prefs:: HintsFetcherTopHostBlacklistState::kInitialized); size_t engaged_hosts = 5; @@ -144,7 +148,7 @@ EXPECT_EQ(max_top_hosts, hosts.size()); } -TEST_F(PreviewsTopHostProviderTest, +TEST_F(DataSaverTopHostProviderTest, GetTopHostsFiltersPrivacyBlackedlistedHosts) { SetTopHostBlacklistState(optimization_guide::prefs:: HintsFetcherTopHostBlacklistState::kInitialized); @@ -161,7 +165,7 @@ EXPECT_EQ(hosts.size(), engaged_hosts - num_hosts_blacklisted); } -TEST_F(PreviewsTopHostProviderTest, GetTopHostsInitializeBlacklistState) { +TEST_F(DataSaverTopHostProviderTest, GetTopHostsInitializeBlacklistState) { EXPECT_EQ(GetCurrentTopHostBlacklistState(), optimization_guide::prefs::HintsFetcherTopHostBlacklistState:: kNotInitialized); @@ -178,7 +182,7 @@ kInitialized); } -TEST_F(PreviewsTopHostProviderTest, +TEST_F(DataSaverTopHostProviderTest, GetTopHostsBlacklistStateNotInitializedToInitialized) { size_t engaged_hosts = 5; size_t max_top_hosts = 5; @@ -201,7 +205,7 @@ kInitialized); } -TEST_F(PreviewsTopHostProviderTest, +TEST_F(DataSaverTopHostProviderTest, GetTopHostsBlacklistStateNotInitializedToEmpty) { size_t engaged_hosts = 5; size_t max_top_hosts = 5; @@ -224,7 +228,7 @@ optimization_guide::prefs::HintsFetcherTopHostBlacklistState::kEmpty); } -TEST_F(PreviewsTopHostProviderTest, +TEST_F(DataSaverTopHostProviderTest, MaybeUpdateTopHostBlacklistNavigationsOnBlacklist) { size_t engaged_hosts = 5; size_t max_top_hosts = 5; @@ -244,7 +248,8 @@ EXPECT_EQ(hosts.size(), num_top_hosts); } -TEST_F(PreviewsTopHostProviderTest, MaybeUpdateTopHostBlacklistEmptyBlacklist) { +TEST_F(DataSaverTopHostProviderTest, + MaybeUpdateTopHostBlacklistEmptyBlacklist) { size_t engaged_hosts = 5; size_t max_top_hosts = 5; size_t num_top_hosts = 5; @@ -264,7 +269,7 @@ EXPECT_EQ(hosts.size(), num_top_hosts); } -TEST_F(PreviewsTopHostProviderTest, +TEST_F(DataSaverTopHostProviderTest, HintsFetcherTopHostBlacklistNonHTTPOrHTTPSHost) { size_t engaged_hosts = 5; size_t max_top_hosts = 5; @@ -296,7 +301,7 @@ EXPECT_FALSE(IsHostBlacklisted(http_url.host())); } -TEST_F(PreviewsTopHostProviderTest, IntializeTopHostBlacklistWithMaxTopSites) { +TEST_F(DataSaverTopHostProviderTest, IntializeTopHostBlacklistWithMaxTopSites) { size_t engaged_hosts = optimization_guide::features::MaxHintsFetcherTopHostBlacklistSize() + 1; size_t max_top_hosts = @@ -327,7 +332,7 @@ EXPECT_FALSE(IsHostBlacklisted(base::StringPrintf("domain%u.com", 1u))); } -TEST_F(PreviewsTopHostProviderTest, TopHostsFilteredByEngagementThreshold) { +TEST_F(DataSaverTopHostProviderTest, TopHostsFilteredByEngagementThreshold) { size_t engaged_hosts = optimization_guide::features::MaxHintsFetcherTopHostBlacklistSize() + 1; size_t max_top_hosts =
diff --git a/chrome/browser/devtools/devtools_sanity_browsertest.cc b/chrome/browser/devtools/devtools_sanity_browsertest.cc index 46f81c3e..68604a6 100644 --- a/chrome/browser/devtools/devtools_sanity_browsertest.cc +++ b/chrome/browser/devtools/devtools_sanity_browsertest.cc
@@ -43,6 +43,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" +#include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" @@ -786,22 +787,21 @@ DevToolsWindowTesting::Get(windows[2])->main_web_contents()); // Try to close second devtools. { - content::WindowedNotificationObserver cancel_browser( - chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, - content::NotificationService::AllSources()); chrome::CloseWindow(DevToolsWindowTesting::Get(windows[1])->browser()); CancelModalDialog(); - cancel_browser.Wait(); + base::RunLoop().RunUntilIdle(); + // The second devtools hasn't closed. + EXPECT_EQ(windows[1], + DevToolsWindow::GetInstanceForInspectedWebContents( + DevToolsWindowTesting::Get(windows[0])->main_web_contents())); } // Try to close browser window. { - content::WindowedNotificationObserver cancel_browser( - chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, - content::NotificationService::AllSources()); chrome::CloseWindow(browser()); AcceptModalDialog(); CancelModalDialog(); - cancel_browser.Wait(); + base::RunLoop().RunUntilIdle(); + EXPECT_EQ(browser(), BrowserList::GetInstance()->get(0)); } // Try to exit application. {
diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index aec13d0..b8f779b 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc
@@ -53,7 +53,6 @@ #include "chrome/browser/download/download_shelf.h" #include "chrome/browser/download/download_target_determiner.h" #include "chrome/browser/download/download_test_file_activity_observer.h" -#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/install_verifier.h" #include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/infobars/infobar_service.h" @@ -115,6 +114,7 @@ #include "content/public/test/test_file_error_injector.h" #include "content/public/test/test_navigation_observer.h" #include "extensions/browser/extension_dialog_auto_confirm.h" +#include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/scoped_ignore_content_verifier_for_test.h" #include "net/base/filename_util.h" @@ -2217,10 +2217,10 @@ EXPECT_TRUE(VerifyNoDownloads()); // Check that the CRX is not installed. - extensions::ExtensionService* extension_service = - extensions::ExtensionSystem::Get(browser()->profile()) - ->extension_service(); - ASSERT_FALSE(extension_service->GetExtensionById(kGoodCrxId, false)); + extensions::ExtensionRegistry* extension_registry = + extensions::ExtensionRegistry::Get(browser()->profile()); + ASSERT_FALSE(extension_registry->GetExtensionById( + kGoodCrxId, extensions::ExtensionRegistry::ENABLED)); } // Download an extension. Expect a dangerous download warning. @@ -2254,10 +2254,10 @@ downloads[0], base::Bind(&WasAutoOpened)).WaitForEvent(); // Check that the extension was not installed. - extensions::ExtensionService* extension_service = - extensions::ExtensionSystem::Get(browser()->profile()) - ->extension_service(); - ASSERT_FALSE(extension_service->GetExtensionById(kGoodCrxId, false)); + extensions::ExtensionRegistry* extension_registry = + extensions::ExtensionRegistry::Get(browser()->profile()); + ASSERT_FALSE(extension_registry->GetExtensionById( + kGoodCrxId, extensions::ExtensionRegistry::ENABLED)); } // Download an extension. Expect a dangerous download warning. @@ -2294,10 +2294,10 @@ downloads[0], base::Bind(&WasAutoOpened)).WaitForEvent(); // Check that the extension was installed. - extensions::ExtensionService* extension_service = - extensions::ExtensionSystem::Get(browser()->profile()) - ->extension_service(); - ASSERT_TRUE(extension_service->GetExtensionById(kGoodCrxId, false)); + extensions::ExtensionRegistry* extension_registry = + extensions::ExtensionRegistry::Get(browser()->profile()); + ASSERT_TRUE(extension_registry->GetExtensionById( + kGoodCrxId, extensions::ExtensionRegistry::ENABLED)); } // Test installing a CRX that fails integrity checks. @@ -2322,10 +2322,10 @@ CheckDownloadStates(1, DownloadItem::COMPLETE); // Check that the extension was not installed. - extensions::ExtensionService* extension_service = - extensions::ExtensionSystem::Get(browser()->profile()) - ->extension_service(); - ASSERT_FALSE(extension_service->GetExtensionById(kGoodCrxId, false)); + extensions::ExtensionRegistry* extension_registry = + extensions::ExtensionRegistry::Get(browser()->profile()); + ASSERT_FALSE(extension_registry->GetExtensionById( + kGoodCrxId, extensions::ExtensionRegistry::ENABLED)); } // Install a large (100kb) theme. @@ -2361,10 +2361,10 @@ downloads[0], base::Bind(&WasAutoOpened)).WaitForEvent(); // Check that the extension was installed. - extensions::ExtensionService* extension_service = - extensions::ExtensionSystem::Get(browser()->profile()) - ->extension_service(); - ASSERT_TRUE(extension_service->GetExtensionById(kLargeThemeCrxId, false)); + extensions::ExtensionRegistry* extension_registry = + extensions::ExtensionRegistry::Get(browser()->profile()); + ASSERT_TRUE(extension_registry->GetExtensionById( + kLargeThemeCrxId, extensions::ExtensionRegistry::ENABLED)); } // Tests for download initiation functions.
diff --git a/chrome/browser/download/download_target_determiner.cc b/chrome/browser/download/download_target_determiner.cc index e0d2c5c..bf1ca3f 100644 --- a/chrome/browser/download/download_target_determiner.cc +++ b/chrome/browser/download/download_target_determiner.cc
@@ -410,7 +410,6 @@ << " Result:" << static_cast<int>(result); DCHECK_EQ(STATE_PROMPT_USER_FOR_DOWNLOAD_PATH, next_state_); RecordDownloadPathValidation(result, download_->IsTransient()); - if (download_->IsTransient()) { DCHECK_EQ(DownloadConfirmationReason::NONE, confirmation_reason_) << "Transient download should not ask the user for confirmation.";
diff --git a/chrome/browser/extensions/active_tab_apitest.cc b/chrome/browser/extensions/active_tab_apitest.cc index 34a2bd2..ba85bf4 100644 --- a/chrome/browser/extensions/active_tab_apitest.cc +++ b/chrome/browser/extensions/active_tab_apitest.cc
@@ -268,8 +268,8 @@ }; auto can_load_file_iframe = [this, &extension_id]() { - const Extension* extension = - extension_service()->GetExtensionById(extension_id, false); + const Extension* extension = extension_registry()->GetExtensionById( + extension_id, ExtensionRegistry::ENABLED); // Load an extension page with a file iframe. GURL page = extension->GetResourceURL("file_iframe.html");
diff --git a/chrome/browser/extensions/api/commands/command_service_browsertest.cc b/chrome/browser/extensions/api/commands/command_service_browsertest.cc index c9ecdae1..a6a2e01 100644 --- a/chrome/browser/extensions/api/commands/command_service_browsertest.cc +++ b/chrome/browser/extensions/api/commands/command_service_browsertest.cc
@@ -10,11 +10,11 @@ #include "build/build_config.h" #include "chrome/browser/extensions/api/commands/command_service.h" #include "chrome/browser/extensions/extension_apitest.h" -#include "chrome/browser/extensions/extension_service.h" #include "chrome/common/pref_names.h" #include "components/prefs/scoped_user_pref_update.h" #include "content/public/test/browser_test.h" #include "content/public/test/test_utils.h" +#include "extensions/browser/extension_registry.h" #include "extensions/common/manifest_constants.h" namespace { @@ -64,15 +64,14 @@ scoped_temp_dir.GetPath().AppendASCII("v2.crx"), pem_path, base::FilePath()); - ExtensionService* service = ExtensionSystem::Get(browser()->profile())-> - extension_service(); + ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile()); CommandService* command_service = CommandService::Get(browser()->profile()); const char kId[] = "pgoakhfeplldmjheffidklpoklkppipp"; // Install v1 of the extension. ASSERT_TRUE(InstallExtension(path_v1, 1)); - EXPECT_TRUE(service->GetExtensionById(kId, false) != NULL); + EXPECT_TRUE(registry->GetExtensionById(kId, ExtensionRegistry::ENABLED)); // Verify it has a command of Alt+Shift+F. ui::Accelerator accelerator = command_service->FindCommandByName( @@ -93,7 +92,7 @@ // Update to version 2. EXPECT_TRUE(UpdateExtension(kId, path_v2, 0)); - EXPECT_TRUE(service->GetExtensionById(kId, false) != NULL); + EXPECT_TRUE(registry->GetExtensionById(kId, ExtensionRegistry::ENABLED)); // Verify it is still set to nothing. accelerator = command_service->FindCommandByName(
diff --git a/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc b/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc index 66c7af00..83b28ca 100644 --- a/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc +++ b/chrome/browser/extensions/api/declarative_net_request/declarative_net_request_browsertest.cc
@@ -31,7 +31,6 @@ #include "build/build_config.h" #include "chrome/browser/extensions/extension_action_runner.h" #include "chrome/browser/extensions/extension_browsertest.h" -#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_util.h" #include "chrome/browser/extensions/load_error_reporter.h" #include "chrome/browser/extensions/scripting_permissions_modifier.h" @@ -1688,8 +1687,8 @@ set_has_background_script(true); LoadExtensionWithRules({}); - const Extension* dnr_extension = extension_service()->GetExtensionById( - last_loaded_extension_id(), false /*include_disabled*/); + const Extension* dnr_extension = extension_registry()->GetExtensionById( + last_loaded_extension_id(), extensions::ExtensionRegistry::ENABLED); ASSERT_TRUE(dnr_extension); EXPECT_EQ("Test extension", dnr_extension->name()); @@ -2046,8 +2045,8 @@ const GURL unblocked_url = embedded_test_server()->GetURL( "yahoo.com", "/pages_with_script/index.html"); - const Extension* extension = extension_service()->GetExtensionById( - extension_id, false /*include_disabled*/); + const Extension* extension = extension_registry()->GetExtensionById( + extension_id, ExtensionRegistry::ENABLED); RulesetSource static_source = RulesetSource::CreateStatic(*extension); RulesetSource dynamic_source = RulesetSource::CreateDynamic(profile(), *extension); @@ -2288,8 +2287,8 @@ ASSERT_NO_FATAL_FAILURE(LoadExtensionWithRules( {rule}, "extension" /* directory */, host_permissions)); - const Extension* extension = extension_service()->GetExtensionById( - last_loaded_extension_id(), false /*include_disabled*/); + const Extension* extension = extension_registry()->GetExtensionById( + last_loaded_extension_id(), ExtensionRegistry::ENABLED); ASSERT_TRUE(extension); auto verify_script_redirected = [this, extension]( @@ -2414,8 +2413,8 @@ ASSERT_NO_FATAL_FAILURE(LoadExtensionWithRules( {rule}, "test_extension", {URLPattern::kAllUrlsPattern})); - const Extension* extension = extension_service()->GetExtensionById( - last_loaded_extension_id(), false /*include_disabled*/); + const Extension* extension = extension_registry()->GetExtensionById( + last_loaded_extension_id(), ExtensionRegistry::ENABLED); ASSERT_TRUE(extension); EXPECT_TRUE(extension->permissions_data()->HasEffectiveAccessToAllHosts());
diff --git a/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc b/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc index 7ad5b39..8fd11ee 100644 --- a/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc +++ b/chrome/browser/extensions/api/extension_action/browser_action_interactive_test.cc
@@ -10,7 +10,6 @@ #include "chrome/browser/extensions/extension_action.h" #include "chrome/browser/extensions/extension_action_manager.h" #include "chrome/browser/extensions/extension_apitest.h" -#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/sessions/session_tab_helper.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" @@ -29,7 +28,6 @@ #include "content/public/browser/notification_types.h" #include "content/public/common/page_zoom.h" #include "extensions/browser/extension_registry.h" -#include "extensions/browser/extension_system.h" #include "extensions/browser/notification_types.h" #include "extensions/common/extension.h" #include "extensions/common/extension_set.h" @@ -341,9 +339,10 @@ return; OpenPopupViaAPI(false); - ExtensionService* service = extensions::ExtensionSystem::Get( - browser()->profile())->extension_service(); - ASSERT_FALSE(service->GetExtensionById(last_loaded_extension_id(), false) + ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile()); + ASSERT_FALSE(registry + ->GetExtensionById(last_loaded_extension_id(), + ExtensionRegistry::ENABLED) ->permissions_data() ->HasAPIPermissionForTab( SessionTabHelper::IdForTab(
diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc b/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc index 3d419c95..697de915 100644 --- a/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc +++ b/chrome/browser/extensions/api/input_ime/input_ime_api_chromeos.cc
@@ -16,12 +16,12 @@ #include "chrome/browser/chromeos/login/lock/screen_locker.h" #include "chrome/browser/chromeos/login/session/user_session_manager.h" #include "chrome/browser/chromeos/profiles/profile_helper.h" -#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client.h" #include "chrome/common/extensions/api/input_ime.h" #include "chrome/common/extensions/api/input_method_private.h" -#include "extensions/browser/extension_system.h" +#include "extensions/browser/extension_registry.h" +#include "extensions/browser/process_manager.h" #include "extensions/common/manifest_handlers/background_info.h" #include "ui/base/ime/chromeos/component_extension_ime_manager.h" #include "ui/base/ime/chromeos/extension_ime_util.h" @@ -271,12 +271,12 @@ // events (e.g. runtime.onMessage) from its other pages. // This is to save memory for steady state Chrome OS on which the users // don't want any IME features. - extensions::ExtensionSystem* extension_system = - extensions::ExtensionSystem::Get(profile_); - if (extension_system) { + extensions::ExtensionRegistry* extension_registry = + extensions::ExtensionRegistry::Get(profile_); + if (extension_registry) { const extensions::Extension* extension = - extension_system->extension_service()->GetExtensionById( - extension_id_, false /* include_disabled */); + extension_registry->GetExtensionById( + extension_id_, extensions::ExtensionRegistry::ENABLED); if (!extension) return; extensions::ProcessManager* process_manager =
diff --git a/chrome/browser/extensions/api/management/management_api_browsertest.cc b/chrome/browser/extensions/api/management/management_api_browsertest.cc index 16f29ac9..93f3c8d 100644 --- a/chrome/browser/extensions/api/management/management_api_browsertest.cc +++ b/chrome/browser/extensions/api/management/management_api_browsertest.cc
@@ -26,7 +26,7 @@ #include "extensions/browser/extension_dialog_auto_confirm.h" #include "extensions/browser/extension_host.h" #include "extensions/browser/extension_prefs.h" -#include "extensions/browser/extension_system.h" +#include "extensions/browser/extension_registry.h" #include "extensions/browser/notification_types.h" #include "extensions/common/extension_builder.h" #include "extensions/test/extension_test_message_listener.h" @@ -243,17 +243,17 @@ scoped_temp_dir_.GetPath().AppendASCII("permissions2.crx"), pem_path, base::FilePath()); - ExtensionService* service = ExtensionSystem::Get(browser()->profile())-> - extension_service(); - // Install low-permission version of the extension. ASSERT_TRUE(InstallExtension(path_v1, 1)); - EXPECT_TRUE(service->GetExtensionById(kId, false) != NULL); + EXPECT_TRUE(extension_registry()->GetExtensionById( + kId, ExtensionRegistry::ENABLED)); // Update to a high-permission version - it should get disabled. EXPECT_FALSE(UpdateExtension(kId, path_v2, -1)); - EXPECT_TRUE(service->GetExtensionById(kId, false) == NULL); - EXPECT_TRUE(service->GetExtensionById(kId, true) != NULL); + EXPECT_FALSE(extension_registry()->GetExtensionById( + kId, ExtensionRegistry::ENABLED)); + EXPECT_TRUE(extension_registry()->GetExtensionById( + kId, ExtensionRegistry::COMPATIBILITY)); EXPECT_TRUE(ExtensionPrefs::Get(browser()->profile()) ->DidExtensionEscalatePermissions(kId)); } @@ -344,14 +344,11 @@ // Register the target extension with extension service. scoped_refptr<const Extension> target_extension = ExtensionBuilder("TargetExtension").SetID(kId).Build(); - ExtensionService* const service = - ExtensionSystem::Get(browser()->profile())->extension_service(); - service->AddExtension(target_extension.get()); + extension_service()->AddExtension(target_extension.get()); SetEnabled(false, true, std::string(), source_extension); SetEnabled(true, true, std::string(), source_extension); - const Extension* extension = ExtensionSystem::Get(browser()->profile()) - ->extension_service() - ->GetExtensionById(kId, false); + const Extension* extension = + extension_registry()->GetExtensionById(kId, ExtensionRegistry::ENABLED); EXPECT_TRUE(extension); } }
diff --git a/chrome/browser/extensions/api/management/management_api_non_persistent_apitest.cc b/chrome/browser/extensions/api/management/management_api_non_persistent_apitest.cc index 5c8767f..febd21f 100644 --- a/chrome/browser/extensions/api/management/management_api_non_persistent_apitest.cc +++ b/chrome/browser/extensions/api/management/management_api_non_persistent_apitest.cc
@@ -15,13 +15,7 @@ namespace extensions { -namespace { -enum class ContextType { - kEventPage, - kServiceWorker, -}; - -} // namespace +using ContextType = ExtensionBrowserTest::ContextType; // Tests management API from a non-persistent extension (event page or // Service Worker).
diff --git a/chrome/browser/extensions/api/management/management_apitest.cc b/chrome/browser/extensions/api/management/management_apitest.cc index e1a883c..7d76485f 100644 --- a/chrome/browser/extensions/api/management/management_apitest.cc +++ b/chrome/browser/extensions/api/management/management_apitest.cc
@@ -22,6 +22,7 @@ #include "chrome/common/extensions/extension_constants.h" #include "extensions/browser/api/management/management_api.h" #include "extensions/browser/extension_dialog_auto_confirm.h" +#include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/test_management_policy.h" #include "extensions/common/manifest.h" @@ -281,11 +282,11 @@ LoadExtensions(); extensions::ScopedTestDialogAutoConfirm auto_confirm( extensions::ScopedTestDialogAutoConfirm::ACCEPT); - extensions::ExtensionService* service = - extensions::ExtensionSystem::Get(browser()->profile()) - ->extension_service(); - EXPECT_TRUE(service->GetExtensionById(extension_ids_["enabled_extension"], - false)); + extensions::ExtensionRegistry* registry = + extensions::ExtensionRegistry::Get(browser()->profile()); + EXPECT_TRUE( + registry->GetExtensionById(extension_ids_["enabled_extension"], + extensions::ExtensionRegistry::ENABLED)); // Ensure that all actions are allowed. extensions::ExtensionSystem::Get( @@ -294,8 +295,9 @@ ASSERT_TRUE(RunExtensionSubtest("management/management_policy", "allowed.html")); // The last thing the test does is uninstall the "enabled_extension". - EXPECT_FALSE(service->GetExtensionById(extension_ids_["enabled_extension"], - true)); + EXPECT_FALSE( + registry->GetExtensionById(extension_ids_["enabled_extension"], + extensions::ExtensionRegistry::COMPATIBILITY)); } // Fails often on Windows dbg bots. http://crbug.com/177163 @@ -308,11 +310,11 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, MAYBE_ManagementPolicyProhibited) { LoadExtensions(); - extensions::ExtensionService* service = - extensions::ExtensionSystem::Get(browser()->profile()) - ->extension_service(); - EXPECT_TRUE(service->GetExtensionById(extension_ids_["enabled_extension"], - false)); + extensions::ExtensionRegistry* registry = + extensions::ExtensionRegistry::Get(browser()->profile()); + EXPECT_TRUE( + registry->GetExtensionById(extension_ids_["enabled_extension"], + extensions::ExtensionRegistry::ENABLED)); // Prohibit status changes. extensions::ManagementPolicy* policy = extensions::ExtensionSystem::Get( @@ -326,10 +328,6 @@ } IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, LaunchPanelApp) { - extensions::ExtensionService* service = - extensions::ExtensionSystem::Get(browser()->profile()) - ->extension_service(); - // Load an extension that calls launchApp() on any app that gets // installed. ExtensionTestMessageListener launcher_loaded("launcher loaded", false); @@ -351,10 +349,13 @@ // Close the app panel. CloseBrowserSynchronously(app_browser); + extensions::ExtensionRegistry* registry = + extensions::ExtensionRegistry::Get(browser()->profile()); // Unload the extension. UninstallExtension(app_id); ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile())); - ASSERT_FALSE(service->GetExtensionById(app_id, true)); + ASSERT_FALSE(registry->GetExtensionById( + app_id, extensions::ExtensionRegistry::COMPATIBILITY)); // Set a pref indicating that the user wants to launch in a regular tab. // This should be ignored, because panel apps always load in a popup. @@ -386,10 +387,6 @@ #endif IN_PROC_BROWSER_TEST_F(ExtensionManagementApiTest, MAYBE_LaunchTabApp) { - extensions::ExtensionService* service = - extensions::ExtensionSystem::Get(browser()->profile()) - ->extension_service(); - // Load an extension that calls launchApp() on any app that gets // installed. ExtensionTestMessageListener launcher_loaded("launcher loaded", false); @@ -411,10 +408,13 @@ ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile())); ASSERT_EQ(2, browser()->tab_strip_model()->count()); + extensions::ExtensionRegistry* registry = + extensions::ExtensionRegistry::Get(browser()->profile()); // Unload the extension. UninstallExtension(app_id); ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile())); - ASSERT_FALSE(service->GetExtensionById(app_id, true)); + ASSERT_FALSE(registry->GetExtensionById( + app_id, extensions::ExtensionRegistry::COMPATIBILITY)); // Set a pref indicating that the user wants to launch in a window. extensions::SetLaunchType(browser()->profile(), app_id,
diff --git a/chrome/browser/extensions/api/management/management_browsertest.cc b/chrome/browser/extensions/api/management/management_browsertest.cc index b05f8f0..f21eeb5 100644 --- a/chrome/browser/extensions/api/management/management_browsertest.cc +++ b/chrome/browser/extensions/api/management/management_browsertest.cc
@@ -46,10 +46,11 @@ using content::BrowserThread; using extensions::Extension; using extensions::ExtensionRegistry; +using extensions::ExtensionService; using extensions::Manifest; using policy::PolicyMap; -using testing::Return; using testing::_; +using testing::Return; namespace { @@ -207,12 +208,10 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, MAYBE_InstallRequiresConfirm) { // Installing the extension without an auto confirming UI should result in // it being disabled, since good.crx has permissions that require approval. - extensions::ExtensionService* service = - extensions::ExtensionSystem::Get(browser()->profile()) - ->extension_service(); std::string id = "ldnnhddmnhbkjipkidpdiheffobcpfmf"; ASSERT_FALSE(InstallExtension(test_data_dir_.AppendASCII("good.crx"), 0)); - ASSERT_TRUE(service->GetExtensionById(id, true)); + ASSERT_TRUE(extension_registry()->GetExtensionById( + id, ExtensionRegistry::COMPATIBILITY)); UninstallExtension(id); // And the install should succeed when the permissions are accepted. @@ -373,10 +372,8 @@ // Install version 1 of the extension. ExtensionTestMessageListener listener1("v1 installed", false); - extensions::ExtensionService* service = - extensions::ExtensionSystem::Get(browser()->profile()) - ->extension_service(); - ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile()); + ExtensionService* service = extension_service(); + ExtensionRegistry* registry = extension_registry(); const size_t size_before = registry->enabled_extensions().size(); ASSERT_TRUE(registry->disabled_extensions().is_empty()); const Extension* extension = InstallExtension(v1_path, 1); @@ -397,8 +394,8 @@ install_observer.WaitForExtensionWillBeInstalled(); EXPECT_TRUE(listener2.WaitUntilSatisfied()); ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); - extension = service->GetExtensionById( - "ogjcoiohnmldgjemafoockdghcjciccf", false); + extension = registry->GetExtensionById("ogjcoiohnmldgjemafoockdghcjciccf", + ExtensionRegistry::ENABLED); ASSERT_TRUE(extension); ASSERT_EQ("2.0", extension->VersionString()); ASSERT_TRUE(notification_listener.started()); @@ -422,8 +419,8 @@ // Make sure the extension state is the same as before. ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); - extension = service->GetExtensionById( - "ogjcoiohnmldgjemafoockdghcjciccf", false); + extension = registry->GetExtensionById("ogjcoiohnmldgjemafoockdghcjciccf", + ExtensionRegistry::ENABLED); ASSERT_TRUE(extension); ASSERT_EQ("2.0", extension->VersionString()); } @@ -474,10 +471,8 @@ // Install version 1 of the extension. ExtensionTestMessageListener listener1("v1 installed", false); - extensions::ExtensionService* service = - extensions::ExtensionSystem::Get(browser()->profile()) - ->extension_service(); - ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile()); + ExtensionService* service = extension_service(); + ExtensionRegistry* registry = extension_registry(); const size_t enabled_size_before = registry->enabled_extensions().size(); const size_t disabled_size_before = registry->disabled_extensions().size(); const Extension* extension = InstallExtension(v1_path, 1); @@ -500,11 +495,11 @@ install_observer.WaitForExtensionWillBeInstalled(); ASSERT_EQ(disabled_size_before + 1, registry->disabled_extensions().size()); ASSERT_EQ(enabled_size_before, registry->enabled_extensions().size()); - extension = service->GetExtensionById( - "ogjcoiohnmldgjemafoockdghcjciccf", true); + extension = registry->GetExtensionById("ogjcoiohnmldgjemafoockdghcjciccf", + ExtensionRegistry::COMPATIBILITY); ASSERT_TRUE(extension); - ASSERT_FALSE(service->GetExtensionById( - "ogjcoiohnmldgjemafoockdghcjciccf", false)); + ASSERT_FALSE(registry->GetExtensionById("ogjcoiohnmldgjemafoockdghcjciccf", + ExtensionRegistry::ENABLED)); ASSERT_EQ("2.0", extension->VersionString()); // The extension should have not made the callback because it is disabled. @@ -520,9 +515,7 @@ } IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalUrlUpdate) { - extensions::ExtensionService* service = - extensions::ExtensionSystem::Get(browser()->profile()) - ->extension_service(); + ExtensionService* service = extension_service(); const char kExtensionId[] = "ogjcoiohnmldgjemafoockdghcjciccf"; base::ScopedAllowBlockingForTesting allow_blocking; @@ -550,7 +543,7 @@ return false; })); - ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile()); + ExtensionRegistry* registry = extension_registry(); const size_t size_before = registry->enabled_extensions().size(); ASSERT_TRUE(registry->disabled_extensions().is_empty()); @@ -576,7 +569,8 @@ service->updater()->CheckNow(extensions::ExtensionUpdater::CheckParams()); install_observer.WaitForExtensionWillBeInstalled(); ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); - const Extension* extension = service->GetExtensionById(kExtensionId, false); + const Extension* extension = + registry->GetExtensionById(kExtensionId, ExtensionRegistry::ENABLED); ASSERT_TRUE(extension); ASSERT_EQ("2.0", extension->VersionString()); @@ -629,9 +623,6 @@ // See http://crbug.com/57378 for flakiness details. IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, ExternalPolicyRefresh) { - extensions::ExtensionService* service = - extensions::ExtensionSystem::Get(browser()->profile()) - ->extension_service(); const char kExtensionId[] = "ogjcoiohnmldgjemafoockdghcjciccf"; base::ScopedAllowBlockingForTesting allow_blocking; @@ -683,7 +674,8 @@ // Check if the extension got installed. ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); - const Extension* extension = service->GetExtensionById(kExtensionId, false); + const Extension* extension = + registry->GetExtensionById(kExtensionId, ExtensionRegistry::ENABLED); ASSERT_TRUE(extension); ASSERT_EQ("2.0", extension->VersionString()); EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location()); @@ -708,7 +700,8 @@ policies.Erase(policy::key::kExtensionInstallForcelist); UpdateProviderPolicy(policies); EXPECT_EQ(size_before + 1, registry->enabled_extensions().size()); - EXPECT_FALSE(service->GetExtensionById(kExtensionId, true)); + EXPECT_FALSE(registry->GetExtensionById(kExtensionId, + ExtensionRegistry::COMPATIBILITY)); } // See http://crbug.com/103371 and http://crbug.com/120640. @@ -763,7 +756,8 @@ // User install of the extension. ASSERT_TRUE(InstallExtension(v2_path, 1)); ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); - const Extension* extension = service->GetExtensionById(kExtensionId, false); + const Extension* extension = + registry->GetExtensionById(kExtensionId, ExtensionRegistry::ENABLED); ASSERT_TRUE(extension); EXPECT_EQ(Manifest::INTERNAL, extension->location()); EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); @@ -782,7 +776,8 @@ install_observer.WaitForExtensionWillBeInstalled(); ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); - extension = service->GetExtensionById(kExtensionId, false); + extension = + registry->GetExtensionById(kExtensionId, ExtensionRegistry::ENABLED); ASSERT_TRUE(extension); EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location()); EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); @@ -794,13 +789,15 @@ policies.Erase(policy::key::kExtensionInstallForcelist); UpdateProviderPolicy(policies); ASSERT_EQ(size_before, registry->enabled_extensions().size()); - extension = service->GetExtensionById(kExtensionId, true); + extension = registry->GetExtensionById(kExtensionId, + ExtensionRegistry::COMPATIBILITY); EXPECT_FALSE(extension); // User install again, but have it disabled too before setting the policy. ASSERT_TRUE(InstallExtension(v2_path, 1)); ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); - extension = service->GetExtensionById(kExtensionId, false); + extension = + registry->GetExtensionById(kExtensionId, ExtensionRegistry::ENABLED); ASSERT_TRUE(extension); EXPECT_EQ(Manifest::INTERNAL, extension->location()); EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); @@ -808,7 +805,8 @@ DisableExtension(kExtensionId); EXPECT_EQ(1u, registry->disabled_extensions().size()); - extension = service->GetExtensionById(kExtensionId, true); + extension = registry->GetExtensionById(kExtensionId, + ExtensionRegistry::COMPATIBILITY); EXPECT_TRUE(extension); EXPECT_FALSE(service->IsExtensionEnabled(kExtensionId)); @@ -824,7 +822,8 @@ extension_observer.WaitForExtensionWillBeInstalled(); ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); - extension = service->GetExtensionById(kExtensionId, false); + extension = + registry->GetExtensionById(kExtensionId, ExtensionRegistry::ENABLED); ASSERT_TRUE(extension); EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location()); EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId));
diff --git a/chrome/browser/extensions/api/tabs/tabs_interactive_test.cc b/chrome/browser/extensions/api/tabs/tabs_interactive_test.cc index 3ed158c3..77050a9 100644 --- a/chrome/browser/extensions/api/tabs/tabs_interactive_test.cc +++ b/chrome/browser/extensions/api/tabs/tabs_interactive_test.cc
@@ -18,19 +18,10 @@ namespace extensions { -namespace { - -// TODO(lazyboy): Move this to some common place for reuse, e.g. -// ExtensionBrowserTest. -enum class ContextType { - kEventPage, - kServiceWorker, -}; -} // namespace - namespace keys = tabs_constants; namespace utils = extension_function_test_utils; +using ContextType = ExtensionBrowserTest::ContextType; using ExtensionTabsTest = InProcessBrowserTest; IN_PROC_BROWSER_TEST_F(ExtensionTabsTest, GetLastFocusedWindow) {
diff --git a/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc b/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc index 0a076f31..8123b0c 100644 --- a/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc +++ b/chrome/browser/extensions/api/tabs/tabs_util_chromeos.cc
@@ -27,14 +27,6 @@ void SetLockedFullscreenState(Browser* browser, bool locked) { UMA_HISTOGRAM_BOOLEAN("Extensions.LockedFullscreenStateRequest", locked); - // Disable ChromeVox before entering locked fullscreen. Quickfix for - // crbug.com/957950. - auto* const accessibility_manager = chromeos::AccessibilityManager::Get(); - if (locked && accessibility_manager && - accessibility_manager->IsSpokenFeedbackEnabled()) { - accessibility_manager->EnableSpokenFeedback(false); - } - aura::Window* window = browser->window()->GetNativeWindow(); // TRUSTED_PINNED is used here because that one locks the window fullscreen // without allowing the user to exit (as opposed to regular PINNED).
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc index b06f9750..ac34f48 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_apitest.cc
@@ -23,7 +23,6 @@ #include "chrome/browser/download/download_prefs.h" #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" #include "chrome/browser/extensions/extension_apitest.h" -#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h" #include "chrome/browser/ui/browser.h" @@ -44,7 +43,7 @@ #include "content/public/test/download_test_observer.h" #include "content/public/test/no_renderer_crashes_assertion.h" #include "content/public/test/test_utils.h" -#include "extensions/browser/extension_system.h" +#include "extensions/browser/extension_registry.h" #include "extensions/common/switches.h" #include "extensions/test/result_catcher.h" #include "net/dns/mock_host_resolver.h" @@ -360,10 +359,9 @@ ResultCatcher catcher; - ExtensionService* service = extensions::ExtensionSystem::Get( - browser()->profile())->extension_service(); const extensions::Extension* extension = - service->GetExtensionById(last_loaded_extension_id(), false); + extension_registry()->GetExtensionById(last_loaded_extension_id(), + ExtensionRegistry::ENABLED); GURL url = extension->GetResourceURL( "a.html?" + base::NumberToString(embedded_test_server()->port())); @@ -400,10 +398,9 @@ ResultCatcher catcher; - ExtensionService* service = extensions::ExtensionSystem::Get( - browser()->profile())->extension_service(); const extensions::Extension* extension = - service->GetExtensionById(last_loaded_extension_id(), false); + extension_registry()->GetExtensionById(last_loaded_extension_id(), + ExtensionRegistry::ENABLED); GURL url = extension->GetResourceURL("a.html"); ui_test_utils::NavigateToURL(browser(), url);
diff --git a/chrome/browser/extensions/api/web_request/web_request_apitest.cc b/chrome/browser/extensions/api/web_request/web_request_apitest.cc index 1398d76d..2c2f8533 100644 --- a/chrome/browser/extensions/api/web_request/web_request_apitest.cc +++ b/chrome/browser/extensions/api/web_request/web_request_apitest.cc
@@ -78,7 +78,8 @@ #include "extensions/browser/api/web_request/web_request_api.h" #include "extensions/browser/blocked_action_type.h" #include "extensions/browser/extension_prefs.h" -#include "extensions/browser/extension_system.h" +#include "extensions/browser/extension_registry.h" +#include "extensions/browser/process_manager.h" #include "extensions/common/extension_builder.h" #include "extensions/common/extension_features.h" #include "extensions/common/features/feature.h" @@ -652,10 +653,9 @@ ResultCatcher catcher; - ExtensionService* service = - ExtensionSystem::Get(browser()->profile())->extension_service(); - const Extension* extension = - service->GetExtensionById(last_loaded_extension_id(), false); + ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile()); + const Extension* extension = registry->GetExtensionById( + last_loaded_extension_id(), extensions::ExtensionRegistry::ENABLED); GURL url = extension->GetResourceURL("newTab/a.html"); ui_test_utils::NavigateToURL(browser(), url); @@ -949,9 +949,7 @@ .Build()) .Build()) .Build(); - ExtensionSystem::Get(browser()->profile()) - ->extension_service() - ->AddExtension(hosted_app.get()); + extension_service()->AddExtension(hosted_app.get()); ExtensionTestMessageListener listener1("main_frame", false); ExtensionTestMessageListener listener2("xmlhttprequest", false);
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc index d45553f6..e552a77 100644 --- a/chrome/browser/extensions/crx_installer.cc +++ b/chrome/browser/extensions/crx_installer.cc
@@ -536,9 +536,10 @@ if (SharedModuleInfo::ImportsModules(extension())) { const std::vector<SharedModuleInfo::ImportInfo>& imports = SharedModuleInfo::GetImports(extension()); + ExtensionRegistry* registry = ExtensionRegistry::Get(service->profile()); for (const auto& import : imports) { - const Extension* imported_module = - service->GetExtensionById(import.extension_id, true); + const Extension* imported_module = registry->GetExtensionById( + import.extension_id, ExtensionRegistry::COMPATIBILITY); if (!imported_module) continue;
diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc index ce4679a..924cda0 100644 --- a/chrome/browser/extensions/extension_browsertest.cc +++ b/chrome/browser/extensions/extension_browsertest.cc
@@ -393,20 +393,18 @@ const Extension* ExtensionBrowserTest::LoadExtensionAsComponentWithManifest( const base::FilePath& path, const base::FilePath::CharType* manifest_relative_path) { - ExtensionService* service = - ExtensionSystem::Get(profile())->extension_service(); - ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); - base::ScopedAllowBlockingForTesting allow_blocking; std::string manifest; if (!base::ReadFileToString(path.Append(manifest_relative_path), &manifest)) { return NULL; } - service->component_loader()->set_ignore_whitelist_for_testing(true); - std::string extension_id = service->component_loader()->Add(manifest, path); + extension_service()->component_loader()->set_ignore_whitelist_for_testing( + true); + std::string extension_id = + extension_service()->component_loader()->Add(manifest, path); const Extension* extension = - registry->enabled_extensions().GetByID(extension_id); + extension_registry()->enabled_extensions().GetByID(extension_id); if (!extension) return NULL; observer_->set_last_loaded_extension_id(extension->id()); @@ -569,9 +567,7 @@ Extension::InitFromValueFlags creation_flags, bool install_immediately, bool grant_permissions) { - ExtensionService* service = - ExtensionSystem::Get(profile())->extension_service(); - ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); + ExtensionRegistry* registry = extension_registry(); size_t num_before = registry->enabled_extensions().size(); { @@ -609,7 +605,7 @@ browser->tab_strip_model()->GetActiveWebContents())); } scoped_refptr<CrxInstaller> installer( - CrxInstaller::Create(service, std::move(install_ui))); + CrxInstaller::Create(extension_service(), std::move(install_ui))); installer->set_expected_id(id); installer->set_creation_flags(creation_flags); installer->set_install_source(install_source); @@ -650,16 +646,16 @@ if (!observer_->WaitForExtensionViewsToLoad()) return NULL; - return service->GetExtensionById(last_loaded_extension_id(), false); + return registry->GetExtensionById(last_loaded_extension_id(), + ExtensionRegistry::ENABLED); } void ExtensionBrowserTest::ReloadExtension(const std::string& extension_id) { - ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); - const Extension* extension = registry->GetInstalledExtension(extension_id); + const Extension* extension = + extension_registry()->GetInstalledExtension(extension_id); ASSERT_TRUE(extension); - TestExtensionRegistryObserver observer(registry, extension_id); - ExtensionSystem::Get(profile())->extension_service()->ReloadExtension( - extension_id); + TestExtensionRegistryObserver observer(extension_registry(), extension_id); + extension_service()->ReloadExtension(extension_id); observer.WaitForExtensionLoaded(); // We need to let other ExtensionRegistryObservers handle the extension load @@ -671,27 +667,22 @@ } void ExtensionBrowserTest::UnloadExtension(const std::string& extension_id) { - ExtensionService* service = - ExtensionSystem::Get(profile())->extension_service(); - service->UnloadExtension(extension_id, UnloadedExtensionReason::DISABLE); + extension_service()->UnloadExtension(extension_id, + UnloadedExtensionReason::DISABLE); } void ExtensionBrowserTest::UninstallExtension(const std::string& extension_id) { - ExtensionService* service = - ExtensionSystem::Get(profile())->extension_service(); - service->UninstallExtension(extension_id, UNINSTALL_REASON_FOR_TESTING, NULL); + extension_service()->UninstallExtension( + extension_id, UNINSTALL_REASON_FOR_TESTING, nullptr); } void ExtensionBrowserTest::DisableExtension(const std::string& extension_id) { - ExtensionService* service = - ExtensionSystem::Get(profile())->extension_service(); - service->DisableExtension(extension_id, disable_reason::DISABLE_USER_ACTION); + extension_service()->DisableExtension(extension_id, + disable_reason::DISABLE_USER_ACTION); } void ExtensionBrowserTest::EnableExtension(const std::string& extension_id) { - ExtensionService* service = - ExtensionSystem::Get(profile())->extension_service(); - service->EnableExtension(extension_id); + extension_service()->EnableExtension(extension_id); } void ExtensionBrowserTest::OpenWindow(content::WebContents* contents,
diff --git a/chrome/browser/extensions/extension_browsertest.h b/chrome/browser/extensions/extension_browsertest.h index 0ab486d..5ae8898 100644 --- a/chrome/browser/extensions/extension_browsertest.h +++ b/chrome/browser/extensions/extension_browsertest.h
@@ -24,6 +24,7 @@ #include "extensions/browser/extension_creator.h" #include "extensions/browser/extension_host.h" #include "extensions/browser/extension_protocols.h" +#include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/sandboxed_unpacker.h" #include "extensions/browser/scoped_ignore_content_verifier_for_test.h" @@ -44,6 +45,15 @@ // Base class for extension browser tests. Provides utilities for loading, // unloading, and installing extensions. class ExtensionBrowserTest : virtual public InProcessBrowserTest { + public: + // Different types of extension's lazy background contexts used in some tests. + enum class ContextType { + // A non-persistent background page/JS based extension. + kEventPage, + // A Service Worker based extension. + kServiceWorker, + }; + protected: // Flags used to configure how the tests are run. enum Flags { @@ -79,6 +89,10 @@ return ExtensionSystem::Get(profile())->extension_service(); } + ExtensionRegistry* extension_registry() { + return ExtensionRegistry::Get(profile()); + } + const std::string& last_loaded_extension_id() { return observer_->last_loaded_extension_id(); }
diff --git a/chrome/browser/extensions/extension_context_menu_browsertest.cc b/chrome/browser/extensions/extension_context_menu_browsertest.cc index 07534dae..6389e53 100644 --- a/chrome/browser/extensions/extension_context_menu_browsertest.cc +++ b/chrome/browser/extensions/extension_context_menu_browsertest.cc
@@ -36,18 +36,10 @@ using content::WebContents; using extensions::ContextMenuMatcher; +using ContextType = extensions::ExtensionBrowserTest::ContextType; using extensions::MenuItem; using ui::MenuModel; -namespace { - -enum class ContextType { - kBackgroundPage, - kServiceWorker, -}; - -} // namespace - class ExtensionContextMenuBrowserTest : public extensions::ExtensionBrowserTest, public testing::WithParamInterface<ContextType> { @@ -63,7 +55,7 @@ } std::string GetExtensionDirectory(base::StringPiece root) { - if (GetParam() == ContextType::kBackgroundPage) + if (GetParam() == ContextType::kEventPage) return std::string(root); DCHECK_EQ(ContextType::kServiceWorker, GetParam()); return base::StrCat({root, "/service_worker"}); @@ -941,13 +933,13 @@ false); } -INSTANTIATE_TEST_SUITE_P(BackgroundPage, +INSTANTIATE_TEST_SUITE_P(EventPage, ExtensionContextMenuBrowserTest, - ::testing::Values(ContextType::kBackgroundPage)); + ::testing::Values(ContextType::kEventPage)); INSTANTIATE_TEST_SUITE_P(ServiceWorker, ExtensionContextMenuBrowserTest, ::testing::Values(ContextType::kServiceWorker)); // TODO(crbug.com/939664): Enable this test for service workers? -INSTANTIATE_TEST_SUITE_P(BackgroundPage, +INSTANTIATE_TEST_SUITE_P(EventPage, ExtensionContextMenuBrowserLazyTest, - ::testing::Values(ContextType::kBackgroundPage)); + ::testing::Values(ContextType::kEventPage));
diff --git a/chrome/browser/extensions/extension_disabled_ui_browsertest.cc b/chrome/browser/extensions/extension_disabled_ui_browsertest.cc index 2ac4f6b..26a9bd97a 100644 --- a/chrome/browser/extensions/extension_disabled_ui_browsertest.cc +++ b/chrome/browser/extensions/extension_disabled_ui_browsertest.cc
@@ -58,8 +58,6 @@ void SetUpOnMainThread() override { extensions::ExtensionBrowserTest::SetUpOnMainThread(); EXPECT_TRUE(scoped_temp_dir_.CreateUniqueTempDir()); - service_ = extensions::ExtensionSystem::Get(profile())->extension_service(); - registry_ = ExtensionRegistry::Get(profile()); const base::FilePath test_dir = test_data_dir_.AppendASCII("permissions_increase"); const base::FilePath pem_path = test_dir.AppendASCII("permissions.pem"); @@ -86,11 +84,11 @@ // Install the initial version, which should happen just fine. const Extension* InstallIncreasingPermissionExtensionV1() { - size_t size_before = registry_->enabled_extensions().size(); + size_t size_before = extension_registry()->enabled_extensions().size(); const Extension* extension = InstallExtension(path_v1_, 1); if (!extension) return NULL; - if (registry_->enabled_extensions().size() != size_before + 1) + if (extension_registry()->enabled_extensions().size() != size_before + 1) return NULL; return extension; } @@ -101,16 +99,16 @@ const Extension* extension, const base::FilePath& crx_path, int expected_change) { - size_t size_before = registry_->enabled_extensions().size(); + size_t size_before = extension_registry()->enabled_extensions().size(); if (UpdateExtension(extension->id(), crx_path, expected_change)) return NULL; content::RunAllTasksUntilIdle(); EXPECT_EQ(size_before + expected_change, - registry_->enabled_extensions().size()); - if (registry_->disabled_extensions().size() != 1u) + extension_registry()->enabled_extensions().size()); + if (extension_registry()->disabled_extensions().size() != 1u) return NULL; - return registry_->disabled_extensions().begin()->get(); + return extension_registry()->disabled_extensions().begin()->get(); } // Helper function to install an extension and upgrade it to a version @@ -121,8 +119,6 @@ return extension; } - extensions::ExtensionService* service_; - ExtensionRegistry* registry_; base::ScopedTempDir scoped_temp_dir_; base::FilePath path_v1_; base::FilePath path_v2_; @@ -135,13 +131,13 @@ const Extension* extension = InstallAndUpdateIncreasingPermissionsExtension(); ASSERT_TRUE(extension); ASSERT_TRUE(GetExtensionDisabledGlobalError()); - const size_t size_before = registry_->enabled_extensions().size(); + const size_t size_before = extension_registry()->enabled_extensions().size(); ExtensionTestMessageListener listener("v2.onInstalled", false); listener.set_failure_message("FAILED"); - service_->GrantPermissionsAndEnableExtension(extension); - EXPECT_EQ(size_before + 1, registry_->enabled_extensions().size()); - EXPECT_EQ(0u, registry_->disabled_extensions().size()); + extension_service()->GrantPermissionsAndEnableExtension(extension); + EXPECT_EQ(size_before + 1, extension_registry()->enabled_extensions().size()); + EXPECT_EQ(0u, extension_registry()->disabled_extensions().size()); ASSERT_FALSE(GetExtensionDisabledGlobalError()); // Expect onInstalled event to fire. EXPECT_TRUE(listener.WaitUntilSatisfied()); @@ -152,11 +148,11 @@ const Extension* extension = InstallAndUpdateIncreasingPermissionsExtension(); ASSERT_TRUE(extension); ASSERT_TRUE(GetExtensionDisabledGlobalError()); - const size_t size_before = registry_->enabled_extensions().size(); + const size_t size_before = extension_registry()->enabled_extensions().size(); UninstallExtension(extension->id()); - EXPECT_EQ(size_before, registry_->enabled_extensions().size()); - EXPECT_EQ(0u, registry_->disabled_extensions().size()); + EXPECT_EQ(size_before, extension_registry()->enabled_extensions().size()); + EXPECT_EQ(0u, extension_registry()->disabled_extensions().size()); ASSERT_FALSE(GetExtensionDisabledGlobalError()); } @@ -173,13 +169,13 @@ ASSERT_TRUE(error); // The "cancel" button is the uninstall button on the browser. - extensions::TestExtensionRegistryObserver test_observer(registry_, + extensions::TestExtensionRegistryObserver test_observer(extension_registry(), extension_id); error->BubbleViewCancelButtonPressed(browser()); test_observer.WaitForExtensionUninstalled(); - EXPECT_FALSE(registry_->GetExtensionById(extension_id, - ExtensionRegistry::EVERYTHING)); + EXPECT_FALSE(extension_registry()->GetExtensionById( + extension_id, ExtensionRegistry::EVERYTHING)); EXPECT_FALSE(GetExtensionDisabledGlobalError()); } @@ -253,7 +249,8 @@ syncer::EXTENSIONS, syncer::SyncDataList(), base::WrapUnique(new syncer::FakeSyncChangeProcessor()), base::WrapUnique(new syncer::SyncErrorFactoryMock())); - extensions::TestExtensionRegistryObserver install_observer(registry_); + extensions::TestExtensionRegistryObserver install_observer( + extension_registry()); sync_service->ProcessSyncChanges( FROM_HERE, syncer::SyncChangeList( @@ -262,12 +259,13 @@ install_observer.WaitForExtensionWillBeInstalled(); content::RunAllTasksUntilIdle(); - extension = service_->GetExtensionById(extension_id, true); + extension = extension_registry()->GetExtensionById( + extension_id, ExtensionRegistry::COMPATIBILITY); ASSERT_TRUE(extension); EXPECT_EQ("2", extension->VersionString()); - EXPECT_EQ(1u, registry_->disabled_extensions().size()); + EXPECT_EQ(1u, extension_registry()->disabled_extensions().size()); EXPECT_EQ(extensions::disable_reason::DISABLE_PERMISSIONS_INCREASE, - ExtensionPrefs::Get(service_->profile()) + ExtensionPrefs::Get(extension_service()->profile()) ->GetDisableReasons(extension_id)); EXPECT_TRUE(GetExtensionDisabledGlobalError()); } @@ -311,7 +309,8 @@ syncer::EXTENSIONS, syncer::SyncDataList(), base::WrapUnique(new syncer::FakeSyncChangeProcessor()), base::WrapUnique(new syncer::SyncErrorFactoryMock())); - extensions::TestExtensionRegistryObserver install_observer(registry_); + extensions::TestExtensionRegistryObserver install_observer( + extension_registry()); sync_service->ProcessSyncChanges( FROM_HERE, syncer::SyncChangeList( @@ -321,12 +320,13 @@ install_observer.WaitForExtensionWillBeInstalled(); content::RunAllTasksUntilIdle(); - const Extension* extension = service_->GetExtensionById(extension_id, true); + const Extension* extension = extension_registry()->GetExtensionById( + extension_id, ExtensionRegistry::COMPATIBILITY); ASSERT_TRUE(extension); EXPECT_EQ("2", extension->VersionString()); - EXPECT_EQ(1u, registry_->disabled_extensions().size()); + EXPECT_EQ(1u, extension_registry()->disabled_extensions().size()); EXPECT_EQ(extensions::disable_reason::DISABLE_REMOTE_INSTALL, - ExtensionPrefs::Get(service_->profile()) + ExtensionPrefs::Get(extension_service()->profile()) ->GetDisableReasons(extension_id)); EXPECT_TRUE(GetExtensionDisabledGlobalError()); }
diff --git a/chrome/browser/extensions/extension_nacl_browsertest.cc b/chrome/browser/extensions/extension_nacl_browsertest.cc index 4b08748..ad4b505e 100644 --- a/chrome/browser/extensions/extension_nacl_browsertest.cc +++ b/chrome/browser/extensions/extension_nacl_browsertest.cc
@@ -8,7 +8,6 @@ #include "base/test/bind_test_util.h" #include "chrome/browser/extensions/crx_installer.h" #include "chrome/browser/extensions/extension_browsertest.h" -#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" @@ -21,7 +20,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/common/webplugininfo.h" #include "content/public/test/browser_test_utils.h" -#include "extensions/browser/extension_system.h" +#include "extensions/browser/extension_registry.h" #include "extensions/test/test_extension_dir.h" #include "net/dns/mock_host_resolver.h" #include "net/test/embedded_test_server/embedded_test_server.h" @@ -54,6 +53,7 @@ INSTALL_TYPE_FROM_WEBSTORE, INSTALL_TYPE_NON_WEBSTORE, }; + enum PluginType { PLUGIN_TYPE_NONE = 0, PLUGIN_TYPE_EMBED = 1, @@ -62,40 +62,41 @@ PLUGIN_TYPE_CONTENT_HANDLER, }; - const Extension* InstallExtension(const base::FilePath& file_path, InstallType install_type) { - extensions::ExtensionService* service = - extensions::ExtensionSystem::Get(browser()->profile()) - ->extension_service(); - const Extension* extension = NULL; + extensions::ExtensionRegistry* registry = extension_registry(); + const Extension* extension = nullptr; switch (install_type) { case INSTALL_TYPE_COMPONENT: if (LoadExtensionAsComponent(file_path)) { - extension = service->GetExtensionById(kExtensionId, false); + extension = registry->GetExtensionById( + kExtensionId, extensions::ExtensionRegistry::ENABLED); } break; case INSTALL_TYPE_UNPACKED: // Install the extension from a folder so it's unpacked. if (LoadExtension(file_path)) { - extension = service->GetExtensionById(kExtensionId, false); + extension = registry->GetExtensionById( + kExtensionId, extensions::ExtensionRegistry::ENABLED); } break; case INSTALL_TYPE_FROM_WEBSTORE: // Install native_client.crx from the webstore. if (InstallExtensionFromWebstore(file_path, 1)) { - extension = service->GetExtensionById(last_loaded_extension_id(), - false); + extension = registry->GetExtensionById( + last_loaded_extension_id(), + extensions::ExtensionRegistry::ENABLED); } break; case INSTALL_TYPE_NON_WEBSTORE: // Install native_client.crx but not from the webstore. if (extensions::ExtensionBrowserTest::InstallExtension(file_path, 1)) { - extension = service->GetExtensionById(last_loaded_extension_id(), - false); + extension = registry->GetExtensionById( + last_loaded_extension_id(), + extensions::ExtensionRegistry::ENABLED); } break; }
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index 84e0ec8..3c32077 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc
@@ -212,7 +212,8 @@ info.extension_id); } - const Extension* extension = GetExtensionById(info.extension_id, true); + const Extension* extension = registry_->GetExtensionById( + info.extension_id, ExtensionRegistry::COMPATIBILITY); if (extension) { // Already installed. Skip this install if the current location has higher // priority than |info.download_location|, and we aren't doing a @@ -380,19 +381,6 @@ this); } -const Extension* ExtensionService::GetExtensionById( - const std::string& id, bool include_disabled) const { - int include_mask = ExtensionRegistry::ENABLED; - if (include_disabled) { - // Include blacklisted and blocked extensions here because there are - // hundreds of callers of this function, and many might assume that this - // includes those that have been disabled due to blacklisting or blocking. - include_mask |= ExtensionRegistry::DISABLED | - ExtensionRegistry::BLACKLISTED | ExtensionRegistry::BLOCKED; - } - return registry_->GetExtensionById(id, include_mask); -} - void ExtensionService::Init() { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); TRACE_EVENT0("browser,startup", "ExtensionService::Init"); @@ -769,7 +757,8 @@ Manifest::IsComponentLocation(source_extension->location())); } - const Extension* extension = GetExtensionById(extension_id, true); + const Extension* extension = registry_->GetExtensionById( + extension_id, ExtensionRegistry::COMPATIBILITY); CHECK(system_->management_policy()->ExtensionMayModifySettings( source_extension, extension, nullptr)); extension_registrar_.DisableExtension(extension_id, disable_reasons); @@ -1154,7 +1143,7 @@ void ExtensionService::RemoveComponentExtension( const std::string& extension_id) { scoped_refptr<const Extension> extension( - GetExtensionById(extension_id, false)); + registry_->GetExtensionById(extension_id, ExtensionRegistry::ENABLED)); UnloadExtension(extension_id, UnloadedExtensionReason::UNINSTALL); if (extension.get()) { ExtensionRegistry::Get(profile_)->TriggerOnUninstalled( @@ -1703,7 +1692,8 @@ // Before even bothering to unpack, check and see if we already have this // version. This is important because these extensions are going to get // installed on every startup. - const Extension* existing = GetExtensionById(info.extension_id, true); + const Extension* existing = registry_->GetExtensionById( + info.extension_id, ExtensionRegistry::COMPATIBILITY); if (existing) { // The default apps will have the location set as INTERNAL. Since older @@ -1821,7 +1811,8 @@ // idle to update. Check all imports of these extensions, too. std::set<std::string> import_ids; for (auto it = extension_ids.begin(); it != extension_ids.end(); ++it) { - const Extension* extension = GetExtensionById(*it, true); + const Extension* extension = registry_->GetExtensionById( + *it, ExtensionRegistry::COMPATIBILITY); if (!extension) continue; const std::vector<SharedModuleInfo::ImportInfo>& imports =
diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h index 2c88f65d..8564a67 100644 --- a/chrome/browser/extensions/extension_service.h +++ b/chrome/browser/extensions/extension_service.h
@@ -89,27 +89,6 @@ bool file_ownership_passed, CrxInstaller** out_crx_installer) = 0; - // DEPRECATED. Use ExtensionRegistry instead. - // - // Looks up an extension by its ID. - // - // If |include_disabled| is false then this will only include enabled - // extensions. Use instead: - // - // ExtensionRegistry::enabled_extensions().GetByID(id). - // - // If |include_disabled| is true then this will also include disabled and - // blacklisted extensions (not terminated extensions). Use instead: - // - // ExtensionRegistry::GetExtensionById( - // id, ExtensionRegistry::ENABLED | - // ExtensionRegistry::DISABLED | - // ExtensionRegistry::BLACKLISTED) - // - // Or don't, because it's probably not something you ever need to know. - virtual const Extension* GetExtensionById(const std::string& id, - bool include_disabled) const = 0; - // DEPRECATED: Use ExtensionRegistry instead. // // Looks up an extension by ID, regardless of whether it's enabled, @@ -199,8 +178,6 @@ // // NOTE: Many of these methods are DEPRECATED. See the interface for details. PendingExtensionManager* pending_extension_manager() override; - const Extension* GetExtensionById(const std::string& id, - bool include_disabled) const override; const Extension* GetInstalledExtension(const std::string& id) const override; bool UpdateExtension(const CRXFileInfo& file, bool file_ownership_passed,
diff --git a/chrome/browser/extensions/extension_service_sync_unittest.cc b/chrome/browser/extensions/extension_service_sync_unittest.cc index 163b4b9..b7e69b88 100644 --- a/chrome/browser/extensions/extension_service_sync_unittest.cc +++ b/chrome/browser/extensions/extension_service_sync_unittest.cc
@@ -73,15 +73,16 @@ #include "chrome/common/pref_names.h" #endif -using extensions::api_test_utils::RunFunctionAndReturnSingleResult; using extensions::AppSorting; using extensions::Extension; using extensions::ExtensionPrefs; +using extensions::ExtensionRegistry; using extensions::ExtensionSyncData; using extensions::ExtensionSystem; using extensions::Manifest; using extensions::PermissionSet; using extensions::WebstorePrivateIsPendingCustodianApprovalFunction; +using extensions::api_test_utils::RunFunctionAndReturnSingleResult; using syncer::SyncChange; using syncer::SyncChangeList; using testing::Mock; @@ -361,7 +362,8 @@ ASSERT_EQ(3u, loaded_.size()); // We start enabled. - const Extension* extension = service()->GetExtensionById(good0, true); + const Extension* extension = + registry()->GetExtensionById(good0, ExtensionRegistry::COMPATIBILITY); ASSERT_TRUE(extension); ASSERT_TRUE(service()->IsExtensionEnabled(good0)); @@ -560,8 +562,10 @@ extensions::disable_reason::DISABLE_USER_ACTION); ASSERT_FALSE(service()->IsExtensionEnabled(good2)); - const Extension* extension0 = service()->GetExtensionById(good0, true); - const Extension* extension2 = service()->GetExtensionById(good2, true); + const Extension* extension0 = + registry()->GetExtensionById(good0, ExtensionRegistry::COMPATIBILITY); + const Extension* extension2 = + registry()->GetExtensionById(good2, ExtensionRegistry::COMPATIBILITY); ASSERT_TRUE(extensions::sync_helper::IsSyncable(extension0)); ASSERT_TRUE(extensions::sync_helper::IsSyncable(extension2)); @@ -619,7 +623,8 @@ // any outgoing changes. { - const Extension* extension = service()->GetExtensionById(good0, true); + const Extension* extension = + registry()->GetExtensionById(good0, ExtensionRegistry::COMPATIBILITY); ASSERT_TRUE(extension); // Disable the extension. @@ -634,7 +639,8 @@ } { - const Extension* extension = service()->GetExtensionById(good0, true); + const Extension* extension = + registry()->GetExtensionById(good0, ExtensionRegistry::COMPATIBILITY); ASSERT_TRUE(extension); // Set incognito enabled to true. @@ -649,7 +655,8 @@ } { - const Extension* extension = service()->GetExtensionById(good0, true); + const Extension* extension = + registry()->GetExtensionById(good0, ExtensionRegistry::COMPATIBILITY); ASSERT_TRUE(extension); // Add another disable reason. @@ -666,7 +673,8 @@ } { - const Extension* extension = service()->GetExtensionById(good0, true); + const Extension* extension = + registry()->GetExtensionById(good0, ExtensionRegistry::COMPATIBILITY); ASSERT_TRUE(extension); // Uninstall the extension. @@ -1073,20 +1081,24 @@ // Should do nothing. extension_sync_service()->ProcessSyncChanges(FROM_HERE, list); - EXPECT_FALSE(service()->GetExtensionById(good_crx, true)); + EXPECT_FALSE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY)); // Install the extension. base::FilePath extension_path = data_dir().AppendASCII("good.crx"); InstallCRX(extension_path, INSTALL_NEW); - EXPECT_TRUE(service()->GetExtensionById(good_crx, true)); + EXPECT_TRUE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY)); // Should uninstall the extension. extension_sync_service()->ProcessSyncChanges(FROM_HERE, list); - EXPECT_FALSE(service()->GetExtensionById(good_crx, true)); + EXPECT_FALSE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY)); // Should again do nothing. extension_sync_service()->ProcessSyncChanges(FROM_HERE, list); - EXPECT_FALSE(service()->GetExtensionById(good_crx, true)); + EXPECT_FALSE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY)); } TEST_F(ExtensionServiceSyncTest, ProcessSyncDataWrongType) { @@ -1097,7 +1109,8 @@ // Install the extension. base::FilePath extension_path = data_dir().AppendASCII("good.crx"); InstallCRX(extension_path, INSTALL_NEW); - EXPECT_TRUE(service()->GetExtensionById(good_crx, true)); + EXPECT_TRUE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY)); sync_pb::EntitySpecifics specifics; sync_pb::AppSpecifics* app_specifics = specifics.mutable_app(); @@ -1115,7 +1128,8 @@ // Should do nothing extension_sync_service()->ProcessSyncChanges(FROM_HERE, list); - EXPECT_TRUE(service()->GetExtensionById(good_crx, true)); + EXPECT_TRUE(registry()->GetExtensionById(good_crx, + ExtensionRegistry::COMPATIBILITY)); } { @@ -1126,7 +1140,8 @@ // Should again do nothing. extension_sync_service()->ProcessSyncChanges(FROM_HERE, list); - EXPECT_TRUE(service()->GetExtensionById(good_crx, false)); + EXPECT_TRUE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); } }
diff --git a/chrome/browser/extensions/extension_service_test_with_install.cc b/chrome/browser/extensions/extension_service_test_with_install.cc index 4409829..762ca33a 100644 --- a/chrome/browser/extensions/extension_service_test_with_install.cc +++ b/chrome/browser/extensions/extension_service_test_with_install.cc
@@ -226,7 +226,8 @@ EXPECT_EQ(expected_extensions_count_, actual_extension_count) << path.value(); extension = loaded_[0].get(); - EXPECT_TRUE(service()->GetExtensionById(extension->id(), false)) + EXPECT_TRUE(registry()->GetExtensionById(extension->id(), + ExtensionRegistry::ENABLED)) << path.value(); }
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 5ef1873..1696559 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -841,7 +841,8 @@ EXPECT_EQ(std::string("The first extension that I made."), loaded_[0]->description()); EXPECT_EQ(Manifest::INTERNAL, loaded_[0]->location()); - EXPECT_TRUE(service()->GetExtensionById(loaded_[0]->id(), false)); + EXPECT_TRUE(registry()->GetExtensionById(loaded_[0]->id(), + ExtensionRegistry::ENABLED)); EXPECT_EQ(expected_num_extensions, registry()->enabled_extensions().size()); ValidatePrefKeyCount(3); @@ -1212,7 +1213,8 @@ provider->UpdateOrAddExtension(std::move(info)); WaitForExternalExtensionInstalled(); - const Extension* extension = service()->GetExtensionById(good_crx, false); + const Extension* extension = + registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED); ASSERT_TRUE(extension); ASSERT_TRUE(extension->from_bookmark()); ASSERT_TRUE(ValidateBooleanPref(good_crx, kPrefFromBookmark, true)); @@ -1221,7 +1223,8 @@ path = data_dir().AppendASCII("good2.crx"); UpdateExtension(good_crx, path, ENABLED); ASSERT_TRUE(ValidateBooleanPref(good_crx, kPrefFromBookmark, true)); - extension = service()->GetExtensionById(good_crx, false); + extension = + registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED); ASSERT_TRUE(extension); ASSERT_TRUE(extension->from_bookmark()); } @@ -1242,7 +1245,8 @@ provider->UpdateOrAddExtension(std::move(info)); WaitForExternalExtensionInstalled(); - ASSERT_TRUE(service()->GetExtensionById(good_crx, false)); + ASSERT_TRUE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); // Uninstall it and check that its killbit gets set. UninstallExtension(good_crx); @@ -1254,7 +1258,8 @@ Manifest::EXTERNAL_PREF, Extension::NO_FLAGS); provider->UpdateOrAddExtension(std::move(info)); content::RunAllTasksUntilIdle(); - ASSERT_FALSE(service()->GetExtensionById(good_crx, false)); + ASSERT_FALSE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); EXPECT_TRUE(prefs->IsExternalExtensionUninstalled(good_crx)); std::string newer_version = "1.0.0.1"; @@ -1264,7 +1269,8 @@ Manifest::EXTERNAL_PREF, Extension::NO_FLAGS); provider->UpdateOrAddExtension(std::move(info)); content::RunAllTasksUntilIdle(); - ASSERT_FALSE(service()->GetExtensionById(good_crx, false)); + ASSERT_FALSE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); EXPECT_TRUE(prefs->IsExternalExtensionUninstalled(good_crx)); // Try adding the same extension from an external update URL. @@ -1338,14 +1344,16 @@ Manifest::EXTERNAL_PREF, Extension::NO_FLAGS); provider->UpdateOrAddExtension(std::move(info)); WaitForExternalExtensionInstalled(); - ASSERT_FALSE(service()->GetExtensionById(good_crx, false)); + ASSERT_FALSE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); // Try again with the right ID. Expect success. info = CreateExternalExtension(correct_id, version_str, path, Manifest::EXTERNAL_PREF, Extension::NO_FLAGS); provider->UpdateOrAddExtension(std::move(info)); WaitForExternalExtensionInstalled(); - ASSERT_TRUE(service()->GetExtensionById(good_crx, false)); + ASSERT_TRUE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); } // Test that external extensions with incorrect versions are not installed. @@ -1363,7 +1371,8 @@ Manifest::EXTERNAL_PREF, Extension::NO_FLAGS); provider->UpdateOrAddExtension(std::move(wrong_info)); WaitForExternalExtensionInstalled(); - ASSERT_FALSE(service()->GetExtensionById(good_crx, false)); + ASSERT_FALSE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); // Try again with the right version. Expect success. service()->pending_extension_manager()->Remove(good_crx); @@ -1372,7 +1381,8 @@ Manifest::EXTERNAL_PREF, Extension::NO_FLAGS); provider->UpdateOrAddExtension(std::move(correct_info)); WaitForExternalExtensionInstalled(); - ASSERT_TRUE(service()->GetExtensionById(good_crx, false)); + ASSERT_TRUE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); } // Install a user script (they get converted automatically to an extension) @@ -1398,7 +1408,8 @@ EXPECT_EQ(0u, errors.size()) << "There were errors: " << base::JoinString(errors, base::ASCIIToUTF16(",")); - EXPECT_TRUE(service()->GetExtensionById(loaded_[0]->id(), false)) + EXPECT_TRUE(registry()->GetExtensionById(loaded_[0]->id(), + ExtensionRegistry::ENABLED)) << path.value(); installed_ = NULL; @@ -2462,7 +2473,10 @@ extensions_path.AppendASCII("v2.crx"), ENABLED); ASSERT_EQ(std::string("2"), - service()->GetExtensionById(id, false)->version().GetString()); + registry() + ->GetExtensionById(id, ExtensionRegistry::ENABLED) + ->version() + .GetString()); } // Verifies that the NTP page and launch ordinals are kept when updating apps. @@ -2490,7 +2504,10 @@ // Now try updating to v2. UpdateExtension(id, extensions_path.AppendASCII("v2.crx"), ENABLED); ASSERT_EQ(std::string("2"), - service()->GetExtensionById(id, false)->version().GetString()); + registry() + ->GetExtensionById(id, ExtensionRegistry::ENABLED) + ->version() + .GetString()); // Verify that the ordinals match. ASSERT_TRUE(new_page_ordinal.Equals(sorting->GetPageOrdinal(id))); @@ -2641,7 +2658,7 @@ // Reload so extension gets reinitialized with new value. service()->ReloadExtensionsForTest(); - extension = service()->GetExtensionById(id, false); + extension = registry()->GetExtensionById(id, ExtensionRegistry::ENABLED); ASSERT_TRUE(extension->from_webstore()); // Upgrade to version 2.0 @@ -2666,7 +2683,7 @@ // Also test that the extension's old and new title are correctly retrieved. path = data_dir().AppendASCII("good2.crx"); InstallCRX(path, INSTALL_UPDATED, Extension::NO_FLAGS, "My extension 1"); - extension = service()->GetExtensionById(id, false); + extension = registry()->GetExtensionById(id, ExtensionRegistry::ENABLED); ASSERT_EQ("1.0.0.1", extension->version().GetString()); ASSERT_EQ("My updated extension 1", extension->name()); @@ -2698,9 +2715,11 @@ path = data_dir().AppendASCII("good2.crx"); UpdateExtension(good_crx, path, ENABLED); - ASSERT_EQ( - "1.0.0.1", - service()->GetExtensionById(good_crx, false)->version().GetString()); + ASSERT_EQ("1.0.0.1", + registry() + ->GetExtensionById(good_crx, ExtensionRegistry::ENABLED) + ->version() + .GetString()); } // Extensions should not be updated during browser shutdown. @@ -2720,9 +2739,11 @@ bool updated = service()->UpdateExtension( CRXFileInfo(good_crx, GetTestVerifierFormat(), path), true, NULL); ASSERT_FALSE(updated); - ASSERT_EQ( - "1.0.0.0", - service()->GetExtensionById(good_crx, false)->version().GetString()); + ASSERT_EQ("1.0.0.0", + registry() + ->GetExtensionById(good_crx, ExtensionRegistry::ENABLED) + ->version() + .GetString()); } // Test updating a not-already-installed extension - this should fail @@ -2751,9 +2772,11 @@ // Change path from good2.crx -> good.crx path = data_dir().AppendASCII("good.crx"); UpdateExtension(good_crx, path, FAILED); - ASSERT_EQ( - "1.0.0.1", - service()->GetExtensionById(good_crx, false)->version().GetString()); + ASSERT_EQ("1.0.0.1", + registry() + ->GetExtensionById(good_crx, ExtensionRegistry::ENABLED) + ->version() + .GetString()); } // Make sure calling update with an identical version does nothing @@ -2785,7 +2808,8 @@ path = data_dir().AppendASCII("good2.crx"); UpdateExtension(good_crx, path, INSTALLED); ASSERT_EQ(1u, registry()->disabled_extensions().size()); - const Extension* good2 = service()->GetExtensionById(good_crx, true); + const Extension* good2 = + registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY); ASSERT_EQ("1.0.0.1", good2->version().GetString()); EXPECT_TRUE(util::IsIncognitoEnabled(good2->id(), profile())); EXPECT_EQ(disable_reason::DISABLE_USER_ACTION, @@ -2805,7 +2829,8 @@ path = data_dir().AppendASCII("good2.crx"); UpdateExtension(good_crx, path, ENABLED); - const Extension* good2 = service()->GetExtensionById(good_crx, false); + const Extension* good2 = + registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED); ASSERT_EQ("1.0.0.1", good2->version().GetString()); EXPECT_EQ(good2->location(), Manifest::EXTERNAL_PREF); } @@ -2936,7 +2961,8 @@ EXPECT_FALSE(service()->pending_extension_manager()->IsIdPending(kGoodId)); - const Extension* extension = service()->GetExtensionById(kGoodId, true); + const Extension* extension = + registry()->GetExtensionById(kGoodId, ExtensionRegistry::COMPATIBILITY); EXPECT_TRUE(extension); } @@ -2965,7 +2991,8 @@ // It should still have been installed though. EXPECT_FALSE(service()->pending_extension_manager()->IsIdPending(kGoodId)); - const Extension* extension = service()->GetExtensionById(kGoodId, true); + const Extension* extension = + registry()->GetExtensionById(kGoodId, ExtensionRegistry::COMPATIBILITY); EXPECT_TRUE(extension); } @@ -2989,7 +3016,8 @@ EXPECT_FALSE(service()->pending_extension_manager()->IsIdPending(theme_crx)); - const Extension* extension = service()->GetExtensionById(theme_crx, true); + const Extension* extension = + registry()->GetExtensionById(theme_crx, ExtensionRegistry::COMPATIBILITY); ASSERT_TRUE(extension); EXPECT_FALSE( @@ -3017,7 +3045,8 @@ EXPECT_FALSE(service()->pending_extension_manager()->IsIdPending(theme_crx)); - const Extension* extension = service()->GetExtensionById(theme_crx, true); + const Extension* extension = + registry()->GetExtensionById(theme_crx, ExtensionRegistry::COMPATIBILITY); ASSERT_TRUE(extension); EXPECT_FALSE( @@ -3094,7 +3123,8 @@ EXPECT_FALSE(service()->pending_extension_manager()->IsIdPending(theme_crx)); - const Extension* extension = service()->GetExtensionById(theme_crx, true); + const Extension* extension = + registry()->GetExtensionById(theme_crx, ExtensionRegistry::COMPATIBILITY); ASSERT_FALSE(extension); } @@ -3789,12 +3819,12 @@ // Extension should be installed despite blacklist. ASSERT_EQ(1u, registry()->enabled_extensions().size()); - EXPECT_TRUE(service()->GetExtensionById(good0, false)); + EXPECT_TRUE(registry()->GetExtensionById(good0, ExtensionRegistry::ENABLED)); // Poke external providers and make sure the extension is still present. service()->CheckForExternalUpdates(); ASSERT_EQ(1u, registry()->enabled_extensions().size()); - EXPECT_TRUE(service()->GetExtensionById(good0, false)); + EXPECT_TRUE(registry()->GetExtensionById(good0, ExtensionRegistry::ENABLED)); // Extension should not be uninstalled on blacklist changes. { @@ -3803,7 +3833,7 @@ } content::RunAllTasksUntilIdle(); ASSERT_EQ(1u, registry()->enabled_extensions().size()); - EXPECT_TRUE(service()->GetExtensionById(good0, false)); + EXPECT_TRUE(registry()->GetExtensionById(good0, ExtensionRegistry::ENABLED)); } // Tests that active permissions are not revoked from component extensions @@ -3824,8 +3854,8 @@ service()->Init(); // Extension should have the "tabs" permission. - EXPECT_TRUE(service() - ->GetExtensionById(good0, false) + EXPECT_TRUE(registry() + ->GetExtensionById(good0, ExtensionRegistry::ENABLED) ->permissions_data() ->active_permissions() .HasAPIPermission(APIPermission::kTab)); @@ -3838,8 +3868,8 @@ service()->OnExtensionManagementSettingsChanged(); content::RunAllTasksUntilIdle(); - EXPECT_TRUE(service() - ->GetExtensionById(good0, false) + EXPECT_TRUE(registry() + ->GetExtensionById(good0, ExtensionRegistry::ENABLED) ->permissions_data() ->active_permissions() .HasAPIPermission(APIPermission::kTab)); @@ -3870,7 +3900,8 @@ // Extension should be installed despite blacklist. ASSERT_EQ(1u, registry()->enabled_extensions().size()); - EXPECT_TRUE(service()->GetExtensionById(good_crx, false)); + EXPECT_TRUE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); // Blacklist update should not uninstall the extension. { @@ -3879,7 +3910,8 @@ } content::RunAllTasksUntilIdle(); ASSERT_EQ(1u, registry()->enabled_extensions().size()); - EXPECT_TRUE(service()->GetExtensionById(good_crx, false)); + EXPECT_TRUE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); } // Tests that extensions cannot be installed if the policy provider prohibits @@ -3952,7 +3984,8 @@ service()->DisableExtension(good_crx, disable_reason::DISABLE_USER_ACTION); EXPECT_EQ(1u, registry()->enabled_extensions().size()); - EXPECT_TRUE(service()->GetExtensionById(good_crx, false)); + EXPECT_TRUE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); EXPECT_EQ(0u, registry()->disabled_extensions().size()); EXPECT_EQ(disable_reason::DISABLE_NONE, ExtensionPrefs::Get(profile())->GetDisableReasons(good_crx)); @@ -3964,8 +3997,10 @@ EXPECT_EQ(0u, registry()->enabled_extensions().size()); EXPECT_EQ(1u, registry()->disabled_extensions().size()); - EXPECT_TRUE(service()->GetExtensionById(good_crx, true)); - EXPECT_FALSE(service()->GetExtensionById(good_crx, false)); + EXPECT_TRUE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY)); + EXPECT_FALSE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); EXPECT_EQ(disable_reason::DISABLE_CORRUPTED, ExtensionPrefs::Get(profile())->GetDisableReasons(good_crx)); } @@ -3988,7 +4023,8 @@ good_crx, UNINSTALL_REASON_FOR_TESTING, NULL)); EXPECT_EQ(1u, registry()->enabled_extensions().size()); - EXPECT_TRUE(service()->GetExtensionById(good_crx, false)); + EXPECT_TRUE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); } // Tests that previously installed extensions that are now prohibited from @@ -4190,7 +4226,8 @@ PackAndInstallCRX(path2, pem_path, INSTALL_FAILED); // Verify that the old version is still enabled. - updated = service()->GetExtensionById(permissions_blocklist, false); + updated = registry()->GetExtensionById(permissions_blocklist, + ExtensionRegistry::ENABLED); ASSERT_TRUE(updated); EXPECT_EQ(old_version, updated->VersionString()); } @@ -4298,8 +4335,10 @@ observer.Wait(); ASSERT_EQ(2u, registry()->enabled_extensions().size()); - EXPECT_TRUE(service()->GetExtensionById(good_crx, false)); - EXPECT_TRUE(service()->GetExtensionById(page_action, false)); + EXPECT_TRUE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); + EXPECT_TRUE( + registry()->GetExtensionById(page_action, ExtensionRegistry::ENABLED)); ExtensionPrefs* prefs = ExtensionPrefs::Get(profile()); ASSERT_TRUE(!prefs->IsExternalExtensionAcknowledged(good_crx)); ASSERT_TRUE(prefs->IsExternalExtensionAcknowledged(page_action)); @@ -4477,8 +4516,10 @@ WaitForExternalExtensionInstalled(); ASSERT_EQ(1u, registry()->enabled_extensions().size()); - EXPECT_TRUE(service()->GetExtensionById(good_crx, false)); - const Extension* extension = service()->GetExtensionById(good_crx, false); + EXPECT_TRUE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); + const Extension* extension = + registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED); EXPECT_TRUE(extension->from_webstore()); EXPECT_TRUE(extension->was_installed_by_default()); } @@ -4517,7 +4558,8 @@ path = data_dir().AppendASCII("good2.crx"); UpdateExtension(good_crx, path, ENABLED); ASSERT_TRUE(ValidateBooleanPref(good_crx, kPrefFromBookmark, true)); - const Extension* extension = service()->GetExtensionById(good_crx, false); + const Extension* extension = + registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED); ASSERT_TRUE(extension); ASSERT_TRUE(extension->from_bookmark()); } @@ -4527,8 +4569,10 @@ InitializeEmptyExtensionService(); InstallCRX(data_dir().AppendASCII("good.crx"), INSTALL_NEW); - EXPECT_TRUE(service()->GetExtensionById(good_crx, true)); - EXPECT_TRUE(service()->GetExtensionById(good_crx, false)); + EXPECT_TRUE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY)); + EXPECT_TRUE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); EXPECT_EQ(1u, registry()->enabled_extensions().size()); EXPECT_EQ(0u, registry()->disabled_extensions().size()); @@ -4538,8 +4582,10 @@ // Disable it. service()->DisableExtension(good_crx, disable_reason::DISABLE_USER_ACTION); - EXPECT_TRUE(service()->GetExtensionById(good_crx, true)); - EXPECT_FALSE(service()->GetExtensionById(good_crx, false)); + EXPECT_TRUE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY)); + EXPECT_FALSE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED)); EXPECT_EQ(0u, registry()->enabled_extensions().size()); EXPECT_EQ(1u, registry()->disabled_extensions().size()); EXPECT_EQ(0u, registry()->terminated_extensions().size()); @@ -4576,7 +4622,8 @@ EXPECT_FALSE( registry()->GetExtensionById(good_crx, ExtensionRegistry::TERMINATED)); - EXPECT_TRUE(service()->GetExtensionById(good_crx, true)); + EXPECT_TRUE( + registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY)); EXPECT_EQ(0u, registry()->enabled_extensions().size()); EXPECT_EQ(1u, registry()->disabled_extensions().size()); @@ -4622,7 +4669,8 @@ service()->ReloadExtensionsForTest(); // The creation flags should not change when reloading the extension. - const Extension* extension = service()->GetExtensionById(good_crx, true); + const Extension* extension = + registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY); EXPECT_TRUE(extension->from_webstore()); EXPECT_TRUE(extension->was_installed_by_default()); EXPECT_FALSE(extension->from_bookmark()); @@ -6374,7 +6422,8 @@ // Is an extension installed? bool IsCrxInstalled() { - return (service()->GetExtensionById(crx_id_, true) != NULL); + return (registry()->GetExtensionById( + crx_id_, ExtensionRegistry::COMPATIBILITY) != nullptr); } protected:
diff --git a/chrome/browser/extensions/external_provider_impl.cc b/chrome/browser/extensions/external_provider_impl.cc index 8e9ffd2..ed3461e 100644 --- a/chrome/browser/extensions/external_provider_impl.cc +++ b/chrome/browser/extensions/external_provider_impl.cc
@@ -27,7 +27,6 @@ #include "chrome/browser/browser_process_platform_part.h" #include "chrome/browser/extensions/extension_management.h" #include "chrome/browser/extensions/extension_migrator.h" -#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/external_component_loader.h" #include "chrome/browser/extensions/external_policy_loader.h" #include "chrome/browser/extensions/external_pref_loader.h" @@ -41,7 +40,7 @@ #include "components/crx_file/id_util.h" #include "components/prefs/pref_service.h" #include "content/public/browser/browser_thread.h" -#include "extensions/browser/extension_system.h" +#include "extensions/browser/extension_registry.h" #include "extensions/browser/external_install_info.h" #include "extensions/browser/external_provider_interface.h" #include "extensions/common/extension.h" @@ -339,10 +338,12 @@ bool keep_if_present = false; if (extension->GetBoolean(kKeepIfPresent, &keep_if_present) && keep_if_present && profile_) { - ExtensionServiceInterface* extension_service = - ExtensionSystem::Get(profile_)->extension_service(); - const Extension* extension = extension_service ? - extension_service->GetExtensionById(extension_id, true) : NULL; + ExtensionRegistry* extension_registry = ExtensionRegistry::Get(profile_); + const Extension* extension = + extension_registry + ? extension_registry->GetExtensionById( + extension_id, ExtensionRegistry::COMPATIBILITY) + : nullptr; if (!extension) { unsupported_extensions.insert(extension_id); InstallationReporter::ReportFailure(
diff --git a/chrome/browser/extensions/navigation_observer.cc b/chrome/browser/extensions/navigation_observer.cc index d4831ad..2e3782e 100644 --- a/chrome/browser/extensions/navigation_observer.cc +++ b/chrome/browser/extensions/navigation_observer.cc
@@ -121,10 +121,9 @@ if (in_progress_prompt_extension_id_.empty()) return; - ExtensionService* extension_service = - extensions::ExtensionSystem::Get(profile_)->extension_service(); - const Extension* extension = extension_service->GetExtensionById( - in_progress_prompt_extension_id_, true); + ExtensionRegistry* extension_registry = ExtensionRegistry::Get(profile_); + const Extension* extension = extension_registry->GetExtensionById( + in_progress_prompt_extension_id_, ExtensionRegistry::COMPATIBILITY); CHECK(extension); if (result == ExtensionInstallPrompt::Result::ACCEPTED) { @@ -132,6 +131,8 @@ in_progress_prompt_navigation_controller_; CHECK(nav_controller); + ExtensionService* extension_service = + ExtensionSystem::Get(profile_)->extension_service(); // Grant permissions, re-enable the extension, and then reload the tab. extension_service->GrantPermissionsAndEnableExtension(extension); nav_controller->Reload(content::ReloadType::NORMAL, true); @@ -148,7 +149,7 @@ histogram_name.c_str()); } - in_progress_prompt_extension_id_ = std::string(); + in_progress_prompt_extension_id_.clear(); in_progress_prompt_navigation_controller_ = nullptr; extension_install_prompt_.reset(); }
diff --git a/chrome/browser/extensions/service_worker_apitest.cc b/chrome/browser/extensions/service_worker_apitest.cc index 9327fb7..9248c6e 100644 --- a/chrome/browser/extensions/service_worker_apitest.cc +++ b/chrome/browser/extensions/service_worker_apitest.cc
@@ -15,6 +15,7 @@ #include "base/test/bind_test_util.h" #include "base/threading/thread_restrictions.h" #include "build/build_config.h" +#include "chrome/browser/extensions/api/permissions/permissions_api.h" #include "chrome/browser/extensions/browsertest_util.h" #include "chrome/browser/extensions/crx_installer.h" #include "chrome/browser/extensions/extension_action_runner.h" @@ -62,6 +63,7 @@ #include "extensions/browser/process_manager.h" #include "extensions/browser/service_worker_task_queue.h" #include "extensions/common/api/test.h" +#include "extensions/common/permissions/permissions_data.h" #include "extensions/common/value_builder.h" #include "extensions/common/verifier_formats.h" #include "extensions/test/background_page_watcher.h" @@ -1915,6 +1917,41 @@ EXPECT_TRUE(catcher.GetNextResult()) << message_; } +// Tests chrome.permissions.request API. +IN_PROC_BROWSER_TEST_F(ServiceWorkerBasedBackgroundTest, PermissionsAPI) { + // First, load |extension| first so that it has browserAction.onClicked + // listener registered. + ExtensionTestMessageListener worker_listener("ready", false); + const Extension* extension = LoadExtension(test_data_dir_.AppendASCII( + "service_worker/worker_based_background/permissions_api")); + ASSERT_TRUE(extension); + const ExtensionId extension_id = extension->id(); + EXPECT_TRUE(worker_listener.WaitUntilSatisfied()); + + // "storage" permission is optional in |extension|, and isn't available right + // away. + EXPECT_FALSE( + extension->permissions_data()->HasAPIPermission(APIPermission::kStorage)); + + PermissionsRequestFunction::SetAutoConfirmForTests(true); + + ResultCatcher catcher; + // Click on browser action to start the test. + { + content::WebContents* web_contents = + browsertest_util::AddTab(browser(), GURL("about:blank")); + ASSERT_TRUE(web_contents); + ExtensionActionRunner::GetForWebContents( + browser()->tab_strip_model()->GetActiveWebContents()) + ->RunAction(extension, true); + } + EXPECT_TRUE(catcher.GetNextResult()) << message_; + + // Expect the permission ("storage") to be available now. + EXPECT_TRUE( + extension->permissions_data()->HasAPIPermission(APIPermission::kStorage)); +} + // Tests that console messages logged by extension service workers, both via // the typical console.* methods and via our custom bindings console, are // passed through the normal ServiceWorker console messaging and are
diff --git a/chrome/browser/extensions/test_extension_service.cc b/chrome/browser/extensions/test_extension_service.cc index c70f75c..f81a8d1 100644 --- a/chrome/browser/extensions/test_extension_service.cc +++ b/chrome/browser/extensions/test_extension_service.cc
@@ -24,12 +24,6 @@ return false; } -const Extension* TestExtensionService::GetExtensionById( - const std::string& id, bool include_disabled) const { - ADD_FAILURE(); - return NULL; -} - const Extension* TestExtensionService::GetInstalledExtension( const std::string& id) const { ADD_FAILURE();
diff --git a/chrome/browser/extensions/test_extension_service.h b/chrome/browser/extensions/test_extension_service.h index 42a65073..0e43c76 100644 --- a/chrome/browser/extensions/test_extension_service.h +++ b/chrome/browser/extensions/test_extension_service.h
@@ -28,9 +28,6 @@ bool UpdateExtension(const extensions::CRXFileInfo& file, bool file_ownership_passed, extensions::CrxInstaller** out_crx_installer) override; - const extensions::Extension* GetExtensionById( - const std::string& id, - bool include_disabled) const override; const extensions::Extension* GetInstalledExtension( const std::string& id) const override; const extensions::Extension* GetPendingExtensionUpdate(
diff --git a/chrome/browser/extensions/unpacked_installer.cc b/chrome/browser/extensions/unpacked_installer.cc index 8102059..c4ab305 100644 --- a/chrome/browser/extensions/unpacked_installer.cc +++ b/chrome/browser/extensions/unpacked_installer.cc
@@ -26,6 +26,7 @@ #include "extensions/browser/api/declarative_net_request/ruleset_source.h" #include "extensions/browser/extension_file_task_runner.h" #include "extensions/browser/extension_prefs.h" +#include "extensions/browser/extension_registry.h" #include "extensions/browser/install_flag.h" #include "extensions/browser/path_util.h" #include "extensions/browser/policy_check.h" @@ -168,10 +169,11 @@ const std::vector<SharedModuleInfo::ImportInfo>& imports = SharedModuleInfo::GetImports(extension()); std::vector<SharedModuleInfo::ImportInfo>::const_iterator i; + ExtensionRegistry* registry = ExtensionRegistry::Get(service->profile()); for (i = imports.begin(); i != imports.end(); ++i) { base::Version version_required(i->minimum_version); - const Extension* imported_module = - service->GetExtensionById(i->extension_id, true); + const Extension* imported_module = registry->GetExtensionById( + i->extension_id, ExtensionRegistry::COMPATIBILITY); if (!imported_module) { ReportExtensionLoadError(kImportMissing); return;
diff --git a/chrome/browser/extensions/updater/extension_updater.cc b/chrome/browser/extensions/updater/extension_updater.cc index 45ece00..2646817 100644 --- a/chrome/browser/extensions/updater/extension_updater.cc +++ b/chrome/browser/extensions/updater/extension_updater.cc
@@ -145,6 +145,7 @@ extension_prefs_(extension_prefs), prefs_(prefs), profile_(profile), + registry_(ExtensionRegistry::Get(profile)), next_request_id_(0), crx_install_is_running_(false), extension_cache_(cache) { @@ -179,6 +180,7 @@ DCHECK(prefs_); DCHECK(profile_); DCHECK(!weak_ptr_factory_.HasWeakPtrs()); + DCHECK(registry_); alive_ = true; // Check soon, and set up the first delayed check. if (!g_skip_scheduled_checks_for_tests) { @@ -190,13 +192,14 @@ void ExtensionUpdater::Stop() { weak_ptr_factory_.InvalidateWeakPtrs(); alive_ = false; - service_ = NULL; - extension_prefs_ = NULL; - prefs_ = NULL; - profile_ = NULL; + service_ = nullptr; + extension_prefs_ = nullptr; + prefs_ = nullptr; + profile_ = nullptr; will_check_soon_ = false; downloader_.reset(); update_service_ = nullptr; + registry_ = nullptr; } void ExtensionUpdater::ScheduleNextCheck() { @@ -338,14 +341,14 @@ } } - ExtensionRegistry* registry = ExtensionRegistry::Get(profile_); - AddToDownloader(®istry->enabled_extensions(), pending_ids, request_id, + AddToDownloader(®istry_->enabled_extensions(), pending_ids, request_id, params.fetch_priority, &update_check_params); - AddToDownloader(®istry->disabled_extensions(), pending_ids, request_id, + AddToDownloader(®istry_->disabled_extensions(), pending_ids, request_id, params.fetch_priority, &update_check_params); } else { for (const std::string& id : params.ids) { - const Extension* extension = service_->GetExtensionById(id, true); + const Extension* extension = registry_->GetExtensionById( + id, extensions::ExtensionRegistry::COMPATIBILITY); if (extension) { if (update_service_->CanUpdate(id)) { update_check_params.update_info[id] = ExtensionUpdateData(); @@ -521,7 +524,8 @@ bool ExtensionUpdater::GetExtensionExistingVersion(const std::string& id, std::string* version) { DCHECK(alive_); - const Extension* extension = service_->GetExtensionById(id, true); + const Extension* extension = registry_->GetExtensionById( + id, extensions::ExtensionRegistry::COMPATIBILITY); if (!extension) return false; const Extension* update = service_->GetPendingExtensionUpdate(id);
diff --git a/chrome/browser/extensions/updater/extension_updater.h b/chrome/browser/extensions/updater/extension_updater.h index 7eb875e0..d09c9a2 100644 --- a/chrome/browser/extensions/updater/extension_updater.h +++ b/chrome/browser/extensions/updater/extension_updater.h
@@ -34,6 +34,7 @@ class ExtensionCache; class ExtensionPrefs; +class ExtensionRegistry; class ExtensionServiceInterface; class ExtensionSet; struct ExtensionUpdateCheckParams; @@ -270,6 +271,8 @@ PrefService* prefs_; Profile* profile_; + ExtensionRegistry* registry_; + std::map<int, InProgressCheck> requests_in_progress_; int next_request_id_;
diff --git a/chrome/browser/extensions/updater/extension_updater_unittest.cc b/chrome/browser/extensions/updater/extension_updater_unittest.cc index cc7a34b..1170374 100644 --- a/chrome/browser/extensions/updater/extension_updater_unittest.cc +++ b/chrome/browser/extensions/updater/extension_updater_unittest.cc
@@ -400,14 +400,6 @@ ~ServiceForManifestTests() override {} - const Extension* GetExtensionById(const std::string& id, - bool include_disabled) const override { - const Extension* result = registry_->enabled_extensions().GetByID(id); - if (result || !include_disabled) - return result; - return registry_->disabled_extensions().GetByID(id); - } - PendingExtensionManager* pending_extension_manager() override { return &pending_extension_manager_; } @@ -469,12 +461,6 @@ return &pending_extension_manager_; } - const Extension* GetExtensionById(const std::string& id, - bool) const override { - last_inquired_extension_id_ = id; - return NULL; - } - const std::string& extension_id() const { return extension_id_; } const base::FilePath& install_path() const { return install_path_; } @@ -488,12 +474,6 @@ std::string extension_id_; base::FilePath install_path_; GURL download_url_; - - // The last extension ID that GetExtensionById was called with. - // Mutable because the method that sets it (GetExtensionById) is const - // in the actual extension service, but must record the last extension - // ID in this test class. - mutable std::string last_inquired_extension_id_; }; static const int kUpdateFrequencySecs = 15; @@ -2554,7 +2534,8 @@ ASSERT_EQ(1u, tmp.size()); ExtensionId id = tmp.front()->id(); - ASSERT_TRUE(service.GetExtensionById(id, false)); + ExtensionRegistry* registry = ExtensionRegistry::Get(service.profile()); + ASSERT_TRUE(registry->GetExtensionById(id, ExtensionRegistry::ENABLED)); ExtensionUpdater updater(&service, service.extension_prefs(), @@ -2569,7 +2550,7 @@ updater.CheckNow(std::move(params)); service.set_extensions(ExtensionList(), ExtensionList()); - ASSERT_FALSE(service.GetExtensionById(id, false)); + ASSERT_FALSE(registry->GetExtensionById(id, ExtensionRegistry::ENABLED)); // RunUntilIdle is needed to make sure that the UpdateService instance that // runs the extension update process has a chance to exit gracefully; without
diff --git a/chrome/browser/extensions/webstore_standalone_installer.cc b/chrome/browser/extensions/webstore_standalone_installer.cc index 3ea8fa9..85726d21 100644 --- a/chrome/browser/extensions/webstore_standalone_installer.cc +++ b/chrome/browser/extensions/webstore_standalone_installer.cc
@@ -192,14 +192,15 @@ std::unique_ptr<WebstoreInstaller::Approval> approval = CreateApproval(); - ExtensionService* extension_service = - ExtensionSystem::Get(profile_)->extension_service(); - const Extension* installed_extension = - extension_service->GetExtensionById(id_, true /* include disabled */); + ExtensionRegistry* extension_registry = ExtensionRegistry::Get(profile_); + const Extension* installed_extension = extension_registry->GetExtensionById( + id_, ExtensionRegistry::COMPATIBILITY); if (installed_extension) { std::string install_message; webstore_install::Result install_result = webstore_install::SUCCESS; + ExtensionService* extension_service = + ExtensionSystem::Get(profile_)->extension_service(); if (ExtensionPrefs::Get(profile_)->IsExtensionBlacklisted(id_)) { // Don't install a blacklisted extension. install_result = webstore_install::BLACKLISTED;
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 018284fd..88b4cc1 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -346,6 +346,11 @@ "expiry_milestone": 82 }, { + "name": "enable-force-dark", + "owners": [ "gilmanmh@google.com" ], + "expiry_milestone": 80 + }, + { "name": "background-task-component-update", "owners": [ "sorin", "waffles", "tiborg" ], "expiry_milestone": 76
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 4e6e19af9..9e4ca3f 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -1531,6 +1531,10 @@ const char kPasswordImportDescription[] = "Import functionality in password settings."; +const char kForceWebContentsDarkModeName[] = "Force Dark Mode for Web Contents"; +const char kForceWebContentsDarkModeDescription[] = + "Automatically render all web contents using a dark theme."; + const char kPeriodicBackgroundSyncName[] = "Periodic Background Sync"; const char kPeriodicBackgroundSyncDescription[] = "If enabled, web apps can periodically sync content in the background."; @@ -2133,10 +2137,6 @@ const char kAndroidSurfaceControlDescription[] = "Use the SurfaceControl API for supporting overlays on Android"; -const char kAndroidWebContentsDarkMode[] = "Android web contents dark mode"; -const char kAndroidWebContentsDarkModeDescription[] = - "Enable dark mode on web contents in Android"; - const char kAppNotificationStatusMessagingName[] = "App notification status messaging"; const char kAppNotificationStatusMessagingDescription[] =
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index 650c7beb..7031feb 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -918,6 +918,9 @@ extern const char kPasswordImportName[]; extern const char kPasswordImportDescription[]; +extern const char kForceWebContentsDarkModeName[]; +extern const char kForceWebContentsDarkModeDescription[]; + extern const char kPeriodicBackgroundSyncName[]; extern const char kPeriodicBackgroundSyncDescription[]; @@ -1264,9 +1267,6 @@ extern const char kAndroidSurfaceControl[]; extern const char kAndroidSurfaceControlDescription[]; -extern const char kAndroidWebContentsDarkMode[]; -extern const char kAndroidWebContentsDarkModeDescription[]; - extern const char kAppNotificationStatusMessagingName[]; extern const char kAppNotificationStatusMessagingDescription[];
diff --git a/chrome/browser/global_keyboard_shortcuts_mac_browsertest.mm b/chrome/browser/global_keyboard_shortcuts_mac_browsertest.mm index b917cd9..ba3f1c1 100644 --- a/chrome/browser/global_keyboard_shortcuts_mac_browsertest.mm +++ b/chrome/browser/global_keyboard_shortcuts_mac_browsertest.mm
@@ -230,10 +230,10 @@ // this code can't modify it. NSMenu* main_menu = [NSApp mainMenu]; ASSERT_NE(nil, main_menu); - NSMenuItem* window_menu = [main_menu itemWithTitle:@"Window"]; - ASSERT_NE(nil, window_menu); - ASSERT_TRUE(window_menu.hasSubmenu); - NSMenuItem* next_item = [window_menu.submenu itemWithTag:IDC_SELECT_NEXT_TAB]; + NSMenuItem* tab_menu = [main_menu itemWithTitle:@"Tab"]; + ASSERT_NE(nil, tab_menu); + ASSERT_TRUE(tab_menu.hasSubmenu); + NSMenuItem* next_item = [tab_menu.submenu itemWithTag:IDC_SELECT_NEXT_TAB]; ASSERT_NE(nil, next_item); [next_item setKeyEquivalent:@"2"]; [next_item setKeyEquivalentModifierMask:NSCommandKeyMask];
diff --git a/chrome/browser/io_thread_browsertest.cc b/chrome/browser/io_thread_browsertest.cc deleted file mode 100644 index d807c88..0000000 --- a/chrome/browser/io_thread_browsertest.cc +++ /dev/null
@@ -1,228 +0,0 @@ -// Copyright 2017 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 <map> -#include <memory> - -#include "base/bind.h" -#include "base/command_line.h" -#include "base/files/file_path.h" -#include "base/files/file_util.h" -#include "base/files/scoped_temp_dir.h" -#include "base/metrics/field_trial.h" -#include "base/run_loop.h" -#include "base/strings/stringprintf.h" -#include "base/values.h" -#include "chrome/browser/browser_process.h" -#include "chrome/browser/net/system_network_context_manager.h" -#include "chrome/common/chrome_switches.h" -#include "chrome/common/pref_names.h" -#include "chrome/test/base/in_process_browser_test.h" -#include "components/prefs/pref_service.h" -#include "components/variations/variations_associated_data.h" -#include "content/public/browser/browser_thread.h" -#include "net/base/features.h" -#include "net/base/filename_util.h" -#include "net/base/host_port_pair.h" -#include "net/cert/ct_verifier.h" -#include "net/http/http_auth_preferences.h" -#include "net/nqe/network_quality_estimator.h" -#include "net/test/embedded_test_server/embedded_test_server.h" -#include "net/test/embedded_test_server/simple_connection_listener.h" -#include "net/traffic_annotation/network_traffic_annotation_test_helper.h" -#include "services/network/public/cpp/network_quality_tracker.h" -#include "services/network/public/cpp/simple_url_loader.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "url/gurl.h" - -namespace { - -class TestNetworkQualityObserver - : public network::NetworkQualityTracker::EffectiveConnectionTypeObserver { - public: - explicit TestNetworkQualityObserver(network::NetworkQualityTracker* tracker) - : run_loop_wait_effective_connection_type_( - net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN), - tracker_(tracker), - effective_connection_type_(net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN) { - tracker_->AddEffectiveConnectionTypeObserver(this); - } - - ~TestNetworkQualityObserver() override { - tracker_->RemoveEffectiveConnectionTypeObserver(this); - } - - // NetworkQualityTracker::EffectiveConnectionTypeObserver implementation: - void OnEffectiveConnectionTypeChanged( - net::EffectiveConnectionType type) override { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - - net::EffectiveConnectionType queried_type = - tracker_->GetEffectiveConnectionType(); - EXPECT_EQ(type, queried_type); - - effective_connection_type_ = type; - if (effective_connection_type_ != run_loop_wait_effective_connection_type_) - return; - if (run_loop_) - run_loop_->Quit(); - } - - void WaitForNotification( - net::EffectiveConnectionType run_loop_wait_effective_connection_type) { - if (effective_connection_type_ == run_loop_wait_effective_connection_type) - return; - ASSERT_NE(net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN, - run_loop_wait_effective_connection_type); - run_loop_.reset(new base::RunLoop()); - run_loop_wait_effective_connection_type_ = - run_loop_wait_effective_connection_type; - run_loop_->Run(); - run_loop_.reset(); - } - - private: - net::EffectiveConnectionType run_loop_wait_effective_connection_type_; - std::unique_ptr<base::RunLoop> run_loop_; - network::NetworkQualityTracker* tracker_; - net::EffectiveConnectionType effective_connection_type_; - - DISALLOW_COPY_AND_ASSIGN(TestNetworkQualityObserver); -}; - -void CheckEffectiveConnectionType(net::EffectiveConnectionType expected) { - TestNetworkQualityObserver network_quality_observer( - g_browser_process->network_quality_tracker()); - network_quality_observer.WaitForNotification(expected); -} - -class IOThreadBrowserTest : public InProcessBrowserTest { - public: - IOThreadBrowserTest() {} - ~IOThreadBrowserTest() override {} - - void SetUp() override { - // Must start listening (And get a port for the proxy) before calling - // SetUp(). Use two phase EmbeddedTestServer setup for proxy tests. - ASSERT_TRUE(embedded_test_server()->InitializeAndListen()); - InProcessBrowserTest::SetUp(); - } - - void SetUpOnMainThread() override { - embedded_test_server()->StartAcceptingConnections(); - } - - void TearDown() override { - // Need to stop this before |connection_listener_| is destroyed. - EXPECT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); - InProcessBrowserTest::TearDown(); - } -}; - -class IOThreadEctCommandLineBrowserTest : public IOThreadBrowserTest { - public: - IOThreadEctCommandLineBrowserTest() {} - ~IOThreadEctCommandLineBrowserTest() override {} - - void SetUpCommandLine(base::CommandLine* command_line) override { - command_line->AppendSwitchASCII("--force-effective-connection-type", - "Slow-2G"); - } -}; - -IN_PROC_BROWSER_TEST_F(IOThreadEctCommandLineBrowserTest, - ForceECTFromCommandLine) { - CheckEffectiveConnectionType(net::EFFECTIVE_CONNECTION_TYPE_SLOW_2G); -} - -class IOThreadEctFieldTrialBrowserTest : public IOThreadBrowserTest { - public: - IOThreadEctFieldTrialBrowserTest() {} - ~IOThreadEctFieldTrialBrowserTest() override {} - - void SetUpCommandLine(base::CommandLine* command_line) override { - variations::testing::ClearAllVariationParams(); - std::map<std::string, std::string> variation_params; - variation_params["force_effective_connection_type"] = "2G"; - scoped_feature_list_.InitAndEnableFeatureWithParameters( - net::features::kNetworkQualityEstimator, variation_params); - } - - private: - base::test::ScopedFeatureList scoped_feature_list_; -}; - -IN_PROC_BROWSER_TEST_F(IOThreadEctFieldTrialBrowserTest, - ForceECTUsingFieldTrial) { - CheckEffectiveConnectionType(net::EFFECTIVE_CONNECTION_TYPE_2G); -} - -class IOThreadEctFieldTrialAndCommandLineBrowserTest - : public IOThreadEctFieldTrialBrowserTest { - public: - IOThreadEctFieldTrialAndCommandLineBrowserTest() {} - ~IOThreadEctFieldTrialAndCommandLineBrowserTest() override {} - - void SetUpCommandLine(base::CommandLine* command_line) override { - IOThreadEctFieldTrialBrowserTest::SetUpCommandLine(command_line); - command_line->AppendSwitchASCII("--force-effective-connection-type", - "Slow-2G"); - } -}; - -IN_PROC_BROWSER_TEST_F(IOThreadEctFieldTrialAndCommandLineBrowserTest, - ECTFromCommandLineOverridesFieldTrial) { - CheckEffectiveConnectionType(net::EFFECTIVE_CONNECTION_TYPE_SLOW_2G); -} - -class IOThreadBrowserTestWithHangingPacRequest : public IOThreadBrowserTest { - public: - IOThreadBrowserTestWithHangingPacRequest() {} - ~IOThreadBrowserTestWithHangingPacRequest() override {} - - void SetUpOnMainThread() override { - // This must be created after the main message loop has been set up. - // Waits for one connection. Additional connections are fine. - connection_listener_ = - std::make_unique<net::test_server::SimpleConnectionListener>( - 1, net::test_server::SimpleConnectionListener:: - ALLOW_ADDITIONAL_CONNECTIONS); - - embedded_test_server()->SetConnectionListener(connection_listener_.get()); - - IOThreadBrowserTest::SetUpOnMainThread(); - } - - void SetUpCommandLine(base::CommandLine* command_line) override { - command_line->AppendSwitchASCII( - switches::kProxyPacUrl, embedded_test_server()->GetURL("/hung").spec()); - } - - protected: - std::unique_ptr<net::test_server::SimpleConnectionListener> - connection_listener_; -}; - -// Make sure that the SystemURLRequestContext is shut down correctly when -// there's an in-progress PAC script fetch. -IN_PROC_BROWSER_TEST_F(IOThreadBrowserTestWithHangingPacRequest, Shutdown) { - // Request that should hang while trying to request the PAC script. - // Enough requests are created on startup that this probably isn't needed, but - // best to be safe. - auto resource_request = std::make_unique<network::ResourceRequest>(); - resource_request->url = GURL("http://blah/"); - auto simple_loader = network::SimpleURLLoader::Create( - std::move(resource_request), TRAFFIC_ANNOTATION_FOR_TESTS); - - auto* context_manager = g_browser_process->system_network_context_manager(); - simple_loader->DownloadToStringOfUnboundedSizeUntilCrashAndDie( - context_manager->GetURLLoaderFactory(), - base::BindOnce([](std::unique_ptr<std::string> body) { - ADD_FAILURE() << "This request should never complete."; - })); - - connection_listener_->WaitForConnections(); -} - -} // namespace
diff --git a/chrome/browser/lifetime/browser_close_manager_browsertest.cc b/chrome/browser/lifetime/browser_close_manager_browsertest.cc index 813fb304..c9243da6 100644 --- a/chrome/browser/lifetime/browser_close_manager_browsertest.cc +++ b/chrome/browser/lifetime/browser_close_manager_browsertest.cc
@@ -77,12 +77,14 @@ // trying to close it, to avoid flakiness. https://crbug.com/519646 void AcceptClose() { GetNextDialog()->AcceptAppModalDialog(); + base::RunLoop().RunUntilIdle(); } // Note: call |PrepareForDialog| on the relevant WebContents or Browser before // trying to close it, to avoid flakiness. https://crbug.com/519646 void CancelClose() { GetNextDialog()->CancelAppModalDialog(); + base::RunLoop().RunUntilIdle(); } class RepeatedNotificationObserver : public content::NotificationObserver { @@ -304,7 +306,7 @@ } void WaitForAllBrowsersToClose() { - for (size_t i = 0U; i < browsers_.size(); ++i) + while (!BrowserList::GetInstance()->empty()) ui_test_utils::WaitForBrowserToClose(); } @@ -316,16 +318,13 @@ browser(), embedded_test_server()->GetURL("/beforeunload.html"))); PrepareForDialog(browser()); - RepeatedNotificationObserver cancel_observer( - chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, 1); chrome::CloseAllBrowsersAndQuit(); ASSERT_NO_FATAL_FAILURE(CancelClose()); - cancel_observer.Wait(); EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); EXPECT_EQ(1, browser()->tab_strip_model()->count()); chrome::CloseAllBrowsersAndQuit(); - ASSERT_NO_FATAL_FAILURE(AcceptClose()); + GetNextDialog()->AcceptAppModalDialog(); ui_test_utils::WaitForBrowserToClose(); EXPECT_TRUE(browser_shutdown::IsTryingToQuit()); EXPECT_TRUE(BrowserList::GetInstance()->empty()); @@ -337,18 +336,15 @@ browser(), embedded_test_server()->GetURL("/beforeunload.html"))); PrepareForDialog(browser()); - RepeatedNotificationObserver cancel_observer( - chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, 1); chrome::CloseAllBrowsersAndQuit(); chrome::CloseAllBrowsersAndQuit(); ASSERT_NO_FATAL_FAILURE(CancelClose()); - cancel_observer.Wait(); EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); EXPECT_EQ(1, browser()->tab_strip_model()->count()); chrome::CloseAllBrowsersAndQuit(); chrome::CloseAllBrowsersAndQuit(); - ASSERT_NO_FATAL_FAILURE(AcceptClose()); + GetNextDialog()->AcceptAppModalDialog(); ui_test_utils::WaitForBrowserToClose(); EXPECT_TRUE(browser_shutdown::IsTryingToQuit()); EXPECT_TRUE(BrowserList::GetInstance()->empty()); @@ -362,11 +358,8 @@ ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIAboutURL))); PrepareForDialog(browser()); - RepeatedNotificationObserver cancel_observer( - chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, 1); chrome::CloseAllBrowsersAndQuit(); ASSERT_NO_FATAL_FAILURE(CancelClose()); - cancel_observer.Wait(); EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); browser()->tab_strip_model() @@ -416,11 +409,8 @@ // Cancel shutdown on the first beforeunload event. { - RepeatedNotificationObserver cancel_observer( - chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, 1); chrome::CloseAllBrowsersAndQuit(); ASSERT_NO_FATAL_FAILURE(CancelClose()); - cancel_observer.Wait(); } EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); EXPECT_EQ(1, browsers_[0]->tab_strip_model()->count()); @@ -428,12 +418,9 @@ // Cancel shutdown on the second beforeunload event. { - RepeatedNotificationObserver cancel_observer( - chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, 2); chrome::CloseAllBrowsersAndQuit(); ASSERT_NO_FATAL_FAILURE(AcceptClose()); ASSERT_NO_FATAL_FAILURE(CancelClose()); - cancel_observer.Wait(); } EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); EXPECT_EQ(1, browsers_[0]->tab_strip_model()->count()); @@ -465,17 +452,14 @@ // the dialog is guaranteed to show. PrepareForDialog(browsers_[0]->tab_strip_model()->GetWebContentsAt(1)); - RepeatedNotificationObserver cancel_observer( - chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, 1); chrome::CloseAllBrowsersAndQuit(); ASSERT_NO_FATAL_FAILURE(CancelClose()); - cancel_observer.Wait(); EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); // All tabs should still be open. EXPECT_EQ(3, browsers_[0]->tab_strip_model()->count()); chrome::CloseAllBrowsersAndQuit(); - ASSERT_NO_FATAL_FAILURE(AcceptClose()); + GetNextDialog()->AcceptAppModalDialog(); ui_test_utils::WaitForBrowserToClose(); EXPECT_TRUE(browser_shutdown::IsTryingToQuit()); EXPECT_TRUE(BrowserList::GetInstance()->empty()); @@ -498,11 +482,8 @@ // the dialog is guaranteed to show. PrepareForDialog(browsers_[1]); - RepeatedNotificationObserver cancel_observer( - chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, 2); chrome::CloseAllBrowsersAndQuit(); ASSERT_NO_FATAL_FAILURE(CancelClose()); - cancel_observer.Wait(); EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); // All windows should still be open. EXPECT_EQ(1, browsers_[0]->tab_strip_model()->count()); @@ -546,11 +527,8 @@ PrepareForDialog( browsers_[0]->tab_strip_model()->GetWebContentsAt(kResposiveTabIndex)); - RepeatedNotificationObserver cancel_observer( - chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, 1); chrome::CloseAllBrowsersAndQuit(); ASSERT_NO_FATAL_FAILURE(CancelClose()); - cancel_observer.Wait(); EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); // All tabs should still be open. @@ -558,7 +536,7 @@ // Quit, this time accepting close confirmation dialog. chrome::CloseAllBrowsersAndQuit(); - ASSERT_NO_FATAL_FAILURE(AcceptClose()); + GetNextDialog()->AcceptAppModalDialog(); ui_test_utils::WaitForBrowserToClose(); EXPECT_TRUE(browser_shutdown::IsTryingToQuit()); EXPECT_TRUE(BrowserList::GetInstance()->empty()); @@ -579,7 +557,7 @@ IN_PROC_BROWSER_TEST_F(BrowserCloseManagerBrowserTest, MAYBE_TestBeforeUnloadMultipleSlowWindows) { const int kBrowserCount = 5; - const int kResposiveBrowserIndex = 2; + const int kResponsiveBrowserIndex = 2; // Create multiple browsers with all tabs except one responding after // RenderViewHostImpl::kUnloadTimeoutMS . // Minimum configuration is just one browser with slow tab and then @@ -591,19 +569,16 @@ browsers_.push_back(CreateBrowser(browser()->profile())); ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL( browsers_[i], - embedded_test_server()->GetURL((i == kResposiveBrowserIndex) + embedded_test_server()->GetURL((i == kResponsiveBrowserIndex) ? "/beforeunload.html" : "/beforeunload_slow.html"))); } // Disable the hang monitor in the tab that is not expected to hang, so that // the dialog is guaranteed to show. - PrepareForDialog(browsers_[kResposiveBrowserIndex]); + PrepareForDialog(browsers_[kResponsiveBrowserIndex]); - RepeatedNotificationObserver cancel_observer( - chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, kResposiveBrowserIndex + 1); chrome::CloseAllBrowsersAndQuit(); ASSERT_NO_FATAL_FAILURE(CancelClose()); - cancel_observer.Wait(); EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); // All windows should still be open. @@ -648,8 +623,6 @@ browsers_[0], embedded_test_server()->GetURL("/beforeunload.html"))); PrepareForDialog(browsers_[0]); - RepeatedNotificationObserver cancel_observer( - chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, 2); chrome::CloseAllBrowsersAndQuit(); browsers_.push_back(CreateBrowser(browser()->profile())); ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL( @@ -657,7 +630,6 @@ PrepareForDialog(browsers_[1]); ASSERT_NO_FATAL_FAILURE(AcceptClose()); ASSERT_NO_FATAL_FAILURE(CancelClose()); - cancel_observer.Wait(); EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); EXPECT_EQ(1, browsers_[0]->tab_strip_model()->count()); EXPECT_EQ(1, browsers_[1]->tab_strip_model()->count()); @@ -705,8 +677,6 @@ PrepareForDialog(browsers_[0]); PrepareForDialog(browsers_[1]); - RepeatedNotificationObserver cancel_observer( - chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, 2); chrome::CloseAllBrowsersAndQuit(); ASSERT_NO_FATAL_FAILURE(AcceptClose()); AddBlankTabAndShow(browsers_[0]); @@ -719,7 +689,6 @@ PrepareForDialog(browsers_[1]); ASSERT_NO_FATAL_FAILURE(AcceptClose()); ASSERT_NO_FATAL_FAILURE(CancelClose()); - cancel_observer.Wait(); EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); EXPECT_EQ(2, browsers_[0]->tab_strip_model()->count()); EXPECT_EQ(2, browsers_[1]->tab_strip_model()->count()); @@ -783,7 +752,7 @@ chrome::CloseWindow(browser2); // Just to be sure CloseWindow doesn't have asynchronous tasks // that could have an impact. - content::RunAllPendingInMessageLoop(); + base::RunLoop().RunUntilIdle(); // Closing browser shouldn't happen because of beforeunload handler. EXPECT_EQ(2u, BrowserList::GetInstance()->size()); @@ -798,14 +767,11 @@ ->NeedToFireBeforeUnload()); // Accept closing the first tab. ASSERT_NO_FATAL_FAILURE(AcceptClose()); - // Just to be sure accepting a dialog doesn't have asynchronous tasks - // that could have an impact. - content::RunAllPendingInMessageLoop(); // It shouldn't close the whole window/browser. EXPECT_EQ(2u, BrowserList::GetInstance()->size()); EXPECT_EQ(2, browser2->tab_strip_model()->count()); // Accept closing the second tab. - ASSERT_NO_FATAL_FAILURE(AcceptClose()); + GetNextDialog()->AcceptAppModalDialog(); ui_test_utils::WaitForBrowserToClose(); // Now the second window/browser should be closed. EXPECT_EQ(1u, BrowserList::GetInstance()->size()); @@ -833,8 +799,6 @@ browsers_[0], embedded_test_server()->GetURL("/beforeunload.html"))); PrepareForDialog(browsers_[0]); - RepeatedNotificationObserver cancel_observer( - chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, 1); chrome::CloseAllBrowsersAndQuit(); browsers_.push_back(CreateBrowser(browser()->profile())); @@ -844,7 +808,6 @@ browsers_[1]->tab_strip_model()->CloseAllTabs(); ASSERT_NO_FATAL_FAILURE(CancelClose()); ASSERT_NO_FATAL_FAILURE(CancelClose()); - cancel_observer.Wait(); EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); EXPECT_EQ(1, browsers_[0]->tab_strip_model()->count()); EXPECT_EQ(1, browsers_[1]->tab_strip_model()->count()); @@ -865,8 +828,6 @@ browsers_[0], embedded_test_server()->GetURL("/beforeunload.html"))); PrepareForDialog(browsers_[0]); - RepeatedNotificationObserver cancel_observer( - chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, 2); chrome::CloseAllBrowsersAndQuit(); browsers_.push_back(CreateBrowser(browser()->profile())); @@ -876,7 +837,6 @@ ASSERT_FALSE(browsers_[1]->ShouldCloseWindow()); ASSERT_NO_FATAL_FAILURE(CancelClose()); ASSERT_NO_FATAL_FAILURE(CancelClose()); - cancel_observer.Wait(); EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); EXPECT_EQ(1, browsers_[0]->tab_strip_model()->count()); EXPECT_EQ(1, browsers_[1]->tab_strip_model()->count()); @@ -901,13 +861,10 @@ PrepareForDialog(browsers_[0]); PrepareForDialog(browsers_[1]); - RepeatedNotificationObserver cancel_observer( - chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, 1); chrome::CloseAllBrowsersAndQuit(); ASSERT_FALSE(browsers_[0]->ShouldCloseWindow()); ASSERT_NO_FATAL_FAILURE(CancelClose()); - cancel_observer.Wait(); EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); EXPECT_EQ(1, browsers_[0]->tab_strip_model()->count()); EXPECT_EQ(1, browsers_[1]->tab_strip_model()->count()); @@ -1139,13 +1096,9 @@ browser(), embedded_test_server()->GetURL("/beforeunload.html"))); PrepareForDialog(browser()); - content::WindowedNotificationObserver cancel_observer( - chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, - content::NotificationService::AllSources()); TestBrowserCloseManager::AttemptClose( TestBrowserCloseManager::USER_CHOICE_USER_CANCELS_CLOSE); ASSERT_NO_FATAL_FAILURE(AcceptClose()); - cancel_observer.Wait(); EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); TestBrowserCloseManager::AttemptClose(
diff --git a/chrome/browser/media/webrtc/native_desktop_media_list.cc b/chrome/browser/media/webrtc/native_desktop_media_list.cc index d284c0e6..dca0ffdf 100644 --- a/chrome/browser/media/webrtc/native_desktop_media_list.cc +++ b/chrome/browser/media/webrtc/native_desktop_media_list.cc
@@ -237,9 +237,9 @@ #if defined(OS_WIN) || defined(OS_MACOSX) // On Windows/OSX the thread must be a UI thread. - base::MessagePumpType thread_type = base::MessagePump::Type::UI; + base::MessagePumpType thread_type = base::MessagePumpType::UI; #else - base::MessagePumpType thread_type = base::MessagePump::Type::DEFAULT; + base::MessagePumpType thread_type = base::MessagePumpType::DEFAULT; #endif thread_.StartWithOptions(base::Thread::Options(thread_type, 0));
diff --git a/chrome/browser/media/webrtc/webrtc_logging_handler_host.cc b/chrome/browser/media/webrtc/webrtc_logging_handler_host.cc index a99a049..a0dd38c4 100644 --- a/chrome/browser/media/webrtc/webrtc_logging_handler_host.cc +++ b/chrome/browser/media/webrtc/webrtc_logging_handler_host.cc
@@ -16,11 +16,9 @@ #include "base/task_runner_util.h" #include "base/threading/sequenced_task_runner_handle.h" #include "build/build_config.h" -#include "chrome/browser/chrome_service.h" #include "chrome/browser/media/webrtc/webrtc_event_log_manager.h" #include "chrome/browser/media/webrtc/webrtc_log_uploader.h" #include "chrome/browser/media/webrtc/webrtc_rtp_dump_handler.h" -#include "chrome/common/constants.mojom.h" #include "components/webrtc_logging/browser/text_log_list.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/render_process_host.h" @@ -89,17 +87,10 @@ content::RenderProcessHost::FromID(render_process_id_); // OK for this to replace an existing logging_agent_ connection. - ChromeService::GetInstance()->connector()->Connect( - service_manager::ServiceFilter::ByNameWithIdInGroup( - chrome::mojom::kRendererServiceName, - host->GetChildIdentity().instance_id(), - host->GetChildIdentity().instance_group()), - logging_agent_.BindNewPipeAndPassReceiver()); - + host->BindReceiver(logging_agent_.BindNewPipeAndPassReceiver()); logging_agent_.set_disconnect_handler( base::BindOnce(&WebRtcLoggingHandlerHost::OnAgentDisconnected, weak_factory_.GetWeakPtr())); - logging_agent_->Start(receiver_.BindNewPipeAndPassRemote()); } }
diff --git a/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc b/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc index aa6b3732..cd8f37b 100644 --- a/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc +++ b/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc
@@ -21,19 +21,19 @@ #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/media_galleries/fileapi/media_file_validator_factory.h" #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" #include "chrome/browser/media_galleries/fileapi/native_media_file_util.h" #include "chrome/browser/media_galleries/media_file_system_registry.h" #include "chrome/browser/media_galleries/media_galleries_histograms.h" #include "chrome/browser/profiles/profile.h" +#include "components/prefs/pref_service.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" -#include "extensions/browser/extension_system.h" +#include "extensions/browser/extension_registry.h" #include "net/url_request/url_request.h" #include "storage/browser/fileapi/copy_or_move_file_validator.h" #include "storage/browser/fileapi/file_stream_reader.h" @@ -93,11 +93,11 @@ Profile* profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); - extensions::ExtensionService* extension_service = - extensions::ExtensionSystem::Get(profile)->extension_service(); + extensions::ExtensionRegistry* extension_registry = + extensions::ExtensionRegistry::Get(profile); const extensions::Extension* extension = - extension_service->GetExtensionById(storage_domain, - false /*include disabled*/); + extension_registry->GetExtensionById( + storage_domain, extensions::ExtensionRegistry::ENABLED); std::string expected_mount_prefix = MediaFileSystemBackend::ConstructMountName( profile->GetPath(), storage_domain, kInvalidMediaGalleryPrefId);
diff --git a/chrome/browser/net/network_quality_estimator_browsertest.cc b/chrome/browser/net/network_quality_estimator_browsertest.cc new file mode 100644 index 0000000..e521ef3 --- /dev/null +++ b/chrome/browser/net/network_quality_estimator_browsertest.cc
@@ -0,0 +1,170 @@ +// Copyright 2017 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 <map> +#include <memory> + +#include "base/command_line.h" +#include "base/metrics/field_trial.h" +#include "base/run_loop.h" +#include "base/values.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/net/system_network_context_manager.h" +#include "chrome/common/chrome_switches.h" +#include "chrome/test/base/in_process_browser_test.h" +#include "components/variations/variations_associated_data.h" +#include "content/public/browser/browser_thread.h" +#include "net/base/features.h" +#include "net/nqe/network_quality_estimator.h" +#include "net/test/embedded_test_server/embedded_test_server.h" +#include "net/traffic_annotation/network_traffic_annotation_test_helper.h" +#include "services/network/public/cpp/network_quality_tracker.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "url/gurl.h" + +namespace { + +class TestNetworkQualityObserver + : public network::NetworkQualityTracker::EffectiveConnectionTypeObserver { + public: + explicit TestNetworkQualityObserver(network::NetworkQualityTracker* tracker) + : run_loop_wait_effective_connection_type_( + net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN), + tracker_(tracker), + effective_connection_type_(net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN) { + tracker_->AddEffectiveConnectionTypeObserver(this); + } + + ~TestNetworkQualityObserver() override { + tracker_->RemoveEffectiveConnectionTypeObserver(this); + } + + // NetworkQualityTracker::EffectiveConnectionTypeObserver implementation: + void OnEffectiveConnectionTypeChanged( + net::EffectiveConnectionType type) override { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + + net::EffectiveConnectionType queried_type = + tracker_->GetEffectiveConnectionType(); + EXPECT_EQ(type, queried_type); + + effective_connection_type_ = type; + if (effective_connection_type_ != run_loop_wait_effective_connection_type_) + return; + if (run_loop_) + run_loop_->Quit(); + } + + void WaitForNotification( + net::EffectiveConnectionType run_loop_wait_effective_connection_type) { + if (effective_connection_type_ == run_loop_wait_effective_connection_type) + return; + ASSERT_NE(net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN, + run_loop_wait_effective_connection_type); + run_loop_.reset(new base::RunLoop()); + run_loop_wait_effective_connection_type_ = + run_loop_wait_effective_connection_type; + run_loop_->Run(); + run_loop_.reset(); + } + + private: + net::EffectiveConnectionType run_loop_wait_effective_connection_type_; + std::unique_ptr<base::RunLoop> run_loop_; + network::NetworkQualityTracker* tracker_; + net::EffectiveConnectionType effective_connection_type_; + + DISALLOW_COPY_AND_ASSIGN(TestNetworkQualityObserver); +}; + +void CheckEffectiveConnectionType(net::EffectiveConnectionType expected) { + TestNetworkQualityObserver network_quality_observer( + g_browser_process->network_quality_tracker()); + network_quality_observer.WaitForNotification(expected); +} + +class NetworkQualityEstimatorBrowserTest : public InProcessBrowserTest { + public: + NetworkQualityEstimatorBrowserTest() {} + ~NetworkQualityEstimatorBrowserTest() override {} + + void SetUp() override { + // Must start listening (And get a port for the proxy) before calling + // SetUp(). Use two phase EmbeddedTestServer setup for proxy tests. + ASSERT_TRUE(embedded_test_server()->InitializeAndListen()); + InProcessBrowserTest::SetUp(); + } + + void SetUpOnMainThread() override { + embedded_test_server()->StartAcceptingConnections(); + } + + void TearDown() override { + // Need to stop this before |connection_listener_| is destroyed. + EXPECT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); + InProcessBrowserTest::TearDown(); + } +}; + +class NetworkQualityEstimatorEctCommandLineBrowserTest + : public NetworkQualityEstimatorBrowserTest { + public: + NetworkQualityEstimatorEctCommandLineBrowserTest() {} + ~NetworkQualityEstimatorEctCommandLineBrowserTest() override {} + + void SetUpCommandLine(base::CommandLine* command_line) override { + command_line->AppendSwitchASCII("--force-effective-connection-type", + "Slow-2G"); + } +}; + +IN_PROC_BROWSER_TEST_F(NetworkQualityEstimatorEctCommandLineBrowserTest, + ForceECTFromCommandLine) { + CheckEffectiveConnectionType(net::EFFECTIVE_CONNECTION_TYPE_SLOW_2G); +} + +class NetworkQualityEstimatorEctFieldTrialBrowserTest + : public NetworkQualityEstimatorBrowserTest { + public: + NetworkQualityEstimatorEctFieldTrialBrowserTest() {} + ~NetworkQualityEstimatorEctFieldTrialBrowserTest() override {} + + void SetUpCommandLine(base::CommandLine* command_line) override { + variations::testing::ClearAllVariationParams(); + std::map<std::string, std::string> variation_params; + variation_params["force_effective_connection_type"] = "2G"; + scoped_feature_list_.InitAndEnableFeatureWithParameters( + net::features::kNetworkQualityEstimator, variation_params); + } + + private: + base::test::ScopedFeatureList scoped_feature_list_; +}; + +IN_PROC_BROWSER_TEST_F(NetworkQualityEstimatorEctFieldTrialBrowserTest, + ForceECTUsingFieldTrial) { + CheckEffectiveConnectionType(net::EFFECTIVE_CONNECTION_TYPE_2G); +} + +class NetworkQualityEstimatorEctFieldTrialAndCommandLineBrowserTest + : public NetworkQualityEstimatorEctFieldTrialBrowserTest { + public: + NetworkQualityEstimatorEctFieldTrialAndCommandLineBrowserTest() {} + ~NetworkQualityEstimatorEctFieldTrialAndCommandLineBrowserTest() override {} + + void SetUpCommandLine(base::CommandLine* command_line) override { + NetworkQualityEstimatorEctFieldTrialBrowserTest::SetUpCommandLine( + command_line); + command_line->AppendSwitchASCII("--force-effective-connection-type", + "Slow-2G"); + } +}; + +IN_PROC_BROWSER_TEST_F( + NetworkQualityEstimatorEctFieldTrialAndCommandLineBrowserTest, + ECTFromCommandLineOverridesFieldTrial) { + CheckEffectiveConnectionType(net::EFFECTIVE_CONNECTION_TYPE_SLOW_2G); +} + +} // namespace
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index 4259f49b..35376ff 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc
@@ -876,6 +876,10 @@ return system->extension_service(); } + extensions::ExtensionRegistry* extension_registry() { + return extensions::ExtensionRegistry::Get(browser()->profile()); + } + const extensions::Extension* InstallExtension( const base::FilePath::StringType& name) { base::FilePath extension_path(ui_test_utils::GetTestFilePath( @@ -925,8 +929,7 @@ void UninstallExtension(const std::string& id, bool expect_success) { if (expect_success) { - extensions::TestExtensionRegistryObserver observer( - extensions::ExtensionRegistry::Get(browser()->profile())); + extensions::TestExtensionRegistryObserver observer(extension_registry()); extension_service()->UninstallExtension( id, extensions::UNINSTALL_REASON_FOR_TESTING, NULL); observer.WaitForExtensionUninstalled(); @@ -943,8 +946,7 @@ } void DisableExtension(const std::string& id) { - extensions::TestExtensionRegistryObserver observer( - extensions::ExtensionRegistry::Get(browser()->profile())); + extensions::TestExtensionRegistryObserver observer(extension_registry()); extension_service()->DisableExtension( id, extensions::disable_reason::DISABLE_USER_ACTION); observer.WaitForExtensionUnloaded(); @@ -2144,9 +2146,11 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionInstallBlacklistSelective) { // Verifies that blacklisted extensions can't be installed. - extensions::ExtensionService* service = extension_service(); - ASSERT_FALSE(service->GetExtensionById(kGoodCrxId, true)); - ASSERT_FALSE(service->GetExtensionById(kSimpleWithIconCrxId, true)); + extensions::ExtensionRegistry* registry = extension_registry(); + ASSERT_FALSE(registry->GetExtensionById( + kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + ASSERT_FALSE(registry->GetExtensionById( + kSimpleWithIconCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); base::ListValue blacklist; blacklist.AppendString(kGoodCrxId); PolicyMap policies; @@ -2157,15 +2161,18 @@ // "good.crx" is blacklisted. EXPECT_FALSE(InstallExtension(kGoodCrxName)); - EXPECT_FALSE(service->GetExtensionById(kGoodCrxId, true)); + EXPECT_FALSE(registry->GetExtensionById( + kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); // "simple_with_icon.crx" is not. const extensions::Extension* simple_with_icon = InstallExtension(kSimpleWithIconCrxName); ASSERT_TRUE(simple_with_icon); EXPECT_EQ(kSimpleWithIconCrxId, simple_with_icon->id()); - EXPECT_EQ(simple_with_icon, - service->GetExtensionById(kSimpleWithIconCrxId, true)); + EXPECT_EQ( + simple_with_icon, + registry->GetExtensionById(kSimpleWithIconCrxId, + extensions::ExtensionRegistry::COMPATIBILITY)); } // Ensure that bookmark apps are not blocked by the ExtensionInstallBlacklist @@ -2208,8 +2215,7 @@ policies.Set(key::kExtensionSettings, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, dict_value.CreateDeepCopy(), nullptr); - extensions::TestExtensionRegistryObserver observer( - extensions::ExtensionRegistry::Get(browser()->profile())); + extensions::TestExtensionRegistryObserver observer(extension_registry()); UpdateProviderPolicy(policies); observer.WaitForExtensionUnloaded(); @@ -2233,8 +2239,7 @@ policies.Set(key::kExtensionSettings, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, dict_value.CreateDeepCopy(), nullptr); - extensions::TestExtensionRegistryObserver observer( - extensions::ExtensionRegistry::Get(browser()->profile())); + extensions::TestExtensionRegistryObserver observer(extension_registry()); UpdateProviderPolicy(policies); observer.WaitForExtensionUnloaded(); @@ -2328,8 +2333,11 @@ // Verify that a wildcard blacklist takes effect. EXPECT_TRUE(InstallExtension(kSimpleWithIconCrxName)); extensions::ExtensionService* service = extension_service(); - ASSERT_FALSE(service->GetExtensionById(kGoodCrxId, true)); - ASSERT_TRUE(service->GetExtensionById(kSimpleWithIconCrxId, true)); + extensions::ExtensionRegistry* registry = extension_registry(); + ASSERT_FALSE(registry->GetExtensionById( + kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + ASSERT_TRUE(registry->GetExtensionById( + kSimpleWithIconCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); base::ListValue blacklist; blacklist.AppendString("*"); PolicyMap policies; @@ -2339,7 +2347,8 @@ UpdateProviderPolicy(policies); // "simple_with_icon" should be disabled. - EXPECT_TRUE(service->GetExtensionById(kSimpleWithIconCrxId, true)); + EXPECT_TRUE(registry->GetExtensionById( + kSimpleWithIconCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); EXPECT_FALSE(service->IsExtensionEnabled(kSimpleWithIconCrxId)); // It shouldn't be possible to re-enable "simple_with_icon", until it @@ -2349,7 +2358,8 @@ // It shouldn't be possible to install good.crx. EXPECT_FALSE(InstallExtension(kGoodCrxName)); - EXPECT_FALSE(service->GetExtensionById(kGoodCrxId, true)); + EXPECT_FALSE(registry->GetExtensionById( + kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); } IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionInstallBlacklistSharedModules) { @@ -2378,8 +2388,11 @@ // Verify that the extensions are not installed initially. extensions::ExtensionService* service = extension_service(); - ASSERT_FALSE(service->GetExtensionById(kImporterId, true)); - ASSERT_FALSE(service->GetExtensionById(kSharedModuleId, true)); + extensions::ExtensionRegistry* registry = extension_registry(); + ASSERT_FALSE(registry->GetExtensionById( + kImporterId, extensions::ExtensionRegistry::COMPATIBILITY)); + ASSERT_FALSE(registry->GetExtensionById( + kSharedModuleId, extensions::ExtensionRegistry::COMPATIBILITY)); // Mock the webstore update URL. This is where the shared module extension // will be installed from. @@ -2402,8 +2415,6 @@ POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, forcelist.CreateDeepCopy(), nullptr); - extensions::ExtensionRegistry* registry = - extensions::ExtensionRegistry::Get(browser()->profile()); extensions::TestExtensionRegistryObserver observe_importer( registry, kImporterId); extensions::TestExtensionRegistryObserver observe_shared_module( @@ -2413,12 +2424,12 @@ observe_shared_module.WaitForExtensionLoaded(); // Verify that both extensions got installed. - const extensions::Extension* importer = - service->GetExtensionById(kImporterId, true); + const extensions::Extension* importer = registry->GetExtensionById( + kImporterId, extensions::ExtensionRegistry::COMPATIBILITY); ASSERT_TRUE(importer); EXPECT_EQ(kImporterId, importer->id()); - const extensions::Extension* shared_module = - service->GetExtensionById(kSharedModuleId, true); + const extensions::Extension* shared_module = registry->GetExtensionById( + kSharedModuleId, extensions::ExtensionRegistry::COMPATIBILITY); ASSERT_TRUE(shared_module); EXPECT_EQ(kSharedModuleId, shared_module->id()); EXPECT_TRUE(shared_module->is_shared_module()); @@ -2438,9 +2449,11 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionInstallWhitelist) { // Verifies that the whitelist can open exceptions to the blacklist. - extensions::ExtensionService* service = extension_service(); - ASSERT_FALSE(service->GetExtensionById(kGoodCrxId, true)); - ASSERT_FALSE(service->GetExtensionById(kSimpleWithIconCrxId, true)); + extensions::ExtensionRegistry* registry = extension_registry(); + ASSERT_FALSE(registry->GetExtensionById( + kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + ASSERT_FALSE(registry->GetExtensionById( + kSimpleWithIconCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); base::ListValue blacklist; blacklist.AppendString("*"); base::ListValue whitelist; @@ -2455,12 +2468,15 @@ UpdateProviderPolicy(policies); // "simple_with_icon.crx" is blacklisted. EXPECT_FALSE(InstallExtension(kSimpleWithIconCrxName)); - EXPECT_FALSE(service->GetExtensionById(kSimpleWithIconCrxId, true)); + EXPECT_FALSE(registry->GetExtensionById( + kSimpleWithIconCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); // "good.crx" has a whitelist exception. const extensions::Extension* good = InstallExtension(kGoodCrxName); ASSERT_TRUE(good); EXPECT_EQ(kGoodCrxId, good->id()); - EXPECT_EQ(good, service->GetExtensionById(kGoodCrxId, true)); + EXPECT_EQ(good, + registry->GetExtensionById( + kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); // The user can also remove this extension. UninstallExtension(kGoodCrxId, true); } @@ -2525,7 +2541,9 @@ ExtensionRequestInterceptor interceptor; extensions::ExtensionService* service = extension_service(); - ASSERT_FALSE(service->GetExtensionById(kGoodCrxId, true)); + extensions::ExtensionRegistry* registry = extension_registry(); + ASSERT_FALSE(registry->GetExtensionById( + kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); // Extensions that are force-installed come from an update URL, which defaults // to the webstore. Use a test URL for this test with an update manifest @@ -2542,15 +2560,15 @@ policies.Set(key::kExtensionInstallForcelist, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, forcelist.CreateDeepCopy(), nullptr); - extensions::TestExtensionRegistryObserver observer( - extensions::ExtensionRegistry::Get(browser()->profile())); + extensions::TestExtensionRegistryObserver observer(extension_registry()); UpdateProviderPolicy(policies); observer.WaitForExtensionWillBeInstalled(); // Note: Cannot check that the notification details match the expected // exception, since the details object has already been freed prior to // the completion of observer.WaitForExtensionWillBeInstalled(). - EXPECT_TRUE(service->GetExtensionById(kGoodCrxId, true)); + EXPECT_TRUE(registry->GetExtensionById( + kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); // The user is not allowed to uninstall force-installed extensions. UninstallExtension(kGoodCrxId, false); @@ -2574,7 +2592,11 @@ ASSERT_TRUE(extension); const std::string old_version_number = - service->GetExtensionById(kGoodCrxId, true)->version().GetString(); + registry + ->GetExtensionById(kGoodCrxId, + extensions::ExtensionRegistry::COMPATIBILITY) + ->version() + .GetString(); content::WindowedNotificationObserver new_process_observer( content::NOTIFICATION_RENDERER_PROCESS_CREATED, @@ -2585,12 +2607,15 @@ extensions::ExtensionUpdater::CheckParams params; params.install_immediately = true; extensions::TestExtensionRegistryObserver update_observer( - extensions::ExtensionRegistry::Get(browser()->profile())); + extension_registry()); updater->CheckNow(std::move(params)); update_observer.WaitForExtensionWillBeInstalled(); const base::Version& new_version = - service->GetExtensionById(kGoodCrxId, true)->version(); + registry + ->GetExtensionById(kGoodCrxId, + extensions::ExtensionRegistry::COMPATIBILITY) + ->version(); ASSERT_TRUE(new_version.IsValid()); base::Version old_version(old_version_number); ASSERT_TRUE(old_version.IsValid()); @@ -2630,7 +2655,7 @@ extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, content::NotificationService::AllSources()); extensions::TestExtensionRegistryObserver extension_loaded_observer( - extensions::ExtensionRegistry::Get(browser()->profile()), kGoodCrxId); + extension_registry(), kGoodCrxId); extensions::ExtensionHost* extension_host = extensions::ProcessManager::Get(browser()->profile()) ->GetBackgroundHostForExtension(kGoodCrxId); @@ -2649,8 +2674,9 @@ ExtensionRequestInterceptor interceptor; - extensions::ExtensionService* service = extension_service(); - ASSERT_FALSE(service->GetExtensionById(kGoodCrxId, true)); + extensions::ExtensionRegistry* registry = extension_registry(); + ASSERT_FALSE(registry->GetExtensionById( + kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); // Setting the forcelist extension should install "good_v1.crx". base::ListValue forcelist; @@ -2659,12 +2685,12 @@ policies.Set(key::kExtensionInstallForcelist, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, forcelist.CreateDeepCopy(), nullptr); - extensions::TestExtensionRegistryObserver observer( - extensions::ExtensionRegistry::Get(browser()->profile())); + extensions::TestExtensionRegistryObserver observer(registry); UpdateProviderPolicy(policies); observer.WaitForExtensionWillBeInstalled(); - EXPECT_TRUE(service->GetExtensionById(kGoodCrxId, true)); + EXPECT_TRUE(registry->GetExtensionById( + kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); } IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionRecommendedInstallationMode) { @@ -2686,7 +2712,9 @@ #endif extensions::ExtensionService* service = extension_service(); - ASSERT_FALSE(service->GetExtensionById(kGoodCrxId, true)); + extensions::ExtensionRegistry* registry = extension_registry(); + ASSERT_FALSE(registry->GetExtensionById( + kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); // Setting the forcelist extension should install "good_v1.crx". base::DictionaryValue dict_value; @@ -2700,12 +2728,12 @@ policies.Set(key::kExtensionSettings, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, dict_value.CreateDeepCopy(), nullptr); - extensions::TestExtensionRegistryObserver observer( - extensions::ExtensionRegistry::Get(browser()->profile())); + extensions::TestExtensionRegistryObserver observer(registry); UpdateProviderPolicy(policies); observer.WaitForExtensionWillBeInstalled(); - EXPECT_TRUE(service->GetExtensionById(kGoodCrxId, true)); + EXPECT_TRUE(registry->GetExtensionById( + kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); // The user is not allowed to uninstall recommended-installed extensions. UninstallExtension(kGoodCrxId, false); @@ -2722,9 +2750,11 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionAllowedTypes) { // Verifies that extensions are blocked if policy specifies an allowed types // list and the extension's type is not on that list. - extensions::ExtensionService* service = extension_service(); - ASSERT_FALSE(service->GetExtensionById(kGoodCrxId, true)); - ASSERT_FALSE(service->GetExtensionById(kHostedAppCrxId, true)); + extensions::ExtensionRegistry* registry = extension_registry(); + ASSERT_FALSE(registry->GetExtensionById( + kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + ASSERT_FALSE(registry->GetExtensionById( + kHostedAppCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); base::ListValue allowed_types; allowed_types.AppendString("hosted_app"); @@ -2736,13 +2766,16 @@ // "good.crx" is blocked. EXPECT_FALSE(InstallExtension(kGoodCrxName)); - EXPECT_FALSE(service->GetExtensionById(kGoodCrxId, true)); + EXPECT_FALSE(registry->GetExtensionById( + kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); // "hosted_app.crx" is of a whitelisted type. const extensions::Extension* hosted_app = InstallExtension(kHostedAppCrxName); ASSERT_TRUE(hosted_app); EXPECT_EQ(kHostedAppCrxId, hosted_app->id()); - EXPECT_EQ(hosted_app, service->GetExtensionById(kHostedAppCrxId, true)); + EXPECT_EQ(hosted_app, + registry->GetExtensionById( + kHostedAppCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); // The user can remove the extension. UninstallExtension(kHostedAppCrxId, true); @@ -2789,8 +2822,7 @@ install_sources.CreateDeepCopy(), nullptr); UpdateProviderPolicy(policies); - extensions::TestExtensionRegistryObserver observer( - extensions::ExtensionRegistry::Get(browser()->profile())); + extensions::TestExtensionRegistryObserver observer(extension_registry()); PerformClick(1, 0); observer.WaitForExtensionWillBeInstalled(); // Note: Cannot check that the notification details match the expected @@ -2798,9 +2830,10 @@ // the completion of observer.WaitForExtensionWillBeInstalled(). // The first extension shouldn't be present, the second should be there. - EXPECT_FALSE(extension_service()->GetExtensionById(kGoodCrxId, true)); - EXPECT_TRUE( - extension_service()->GetExtensionById(kSimpleWithIconCrxId, false)); + EXPECT_FALSE(extension_registry()->GetExtensionById( + kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY)); + EXPECT_TRUE(extension_registry()->GetExtensionById( + kSimpleWithIconCrxId, extensions::ExtensionRegistry::ENABLED)); } // Verifies that extensions with version older than the minimum version required @@ -2834,8 +2867,7 @@ })); extensions::ExtensionService* service = extension_service(); - extensions::ExtensionRegistry* registry = - extensions::ExtensionRegistry::Get(browser()->profile()); + extensions::ExtensionRegistry* registry = extension_registry(); extensions::ExtensionPrefs* extension_prefs = extensions::ExtensionPrefs::Get(browser()->profile()); @@ -2871,8 +2903,7 @@ // via the update URL in the manifest of the older version. EXPECT_TRUE(update_extension_count.IsOne()); { - extensions::TestExtensionRegistryObserver update_observer( - extensions::ExtensionRegistry::Get(browser()->profile())); + extensions::TestExtensionRegistryObserver update_observer(registry); service->updater()->CheckSoon(); update_observer.WaitForExtensionWillBeInstalled(); } @@ -2904,8 +2935,7 @@ })); extensions::ExtensionService* service = extension_service(); - extensions::ExtensionRegistry* registry = - extensions::ExtensionRegistry::Get(browser()->profile()); + extensions::ExtensionRegistry* registry = extension_registry(); extensions::ExtensionPrefs* extension_prefs = extensions::ExtensionPrefs::Get(browser()->profile()); @@ -2927,8 +2957,7 @@ // An extension management policy update should trigger an update as well. EXPECT_TRUE(update_extension_count.IsZero()); { - extensions::TestExtensionRegistryObserver update_observer( - extensions::ExtensionRegistry::Get(browser()->profile())); + extensions::TestExtensionRegistryObserver update_observer(registry); { // Set a higher minimum version, just intend to trigger a policy update. extensions::ExtensionManagementPolicyUpdater management_policy( @@ -2969,8 +2998,7 @@ #if defined(OS_WIN) base::win::ScopedDomainStateForTesting scoped_domain(true); #endif - extensions::ExtensionRegistry* registry = - extensions::ExtensionRegistry::Get(browser()->profile()); + extensions::ExtensionRegistry* registry = extension_registry(); extensions::ExtensionPrefs* extension_prefs = extensions::ExtensionPrefs::Get(browser()->profile()); @@ -2981,8 +3009,7 @@ // Set policy to force-install the extension, it should be installed and // enabled. - extensions::TestExtensionRegistryObserver install_observer( - extensions::ExtensionRegistry::Get(browser()->profile())); + extensions::TestExtensionRegistryObserver install_observer(registry); EXPECT_FALSE(registry->enabled_extensions().Contains(kGoodCrxId)); { extensions::ExtensionManagementPolicyUpdater management_policy(&provider_); @@ -6616,8 +6643,7 @@ }; IN_PROC_BROWSER_TEST_F(WebAppInstallForceListPolicyTest, StartUpInstallation) { - extensions::TestExtensionRegistryObserver observer( - extensions::ExtensionRegistry::Get(browser()->profile())); + extensions::TestExtensionRegistryObserver observer(extension_registry()); const extensions::Extension* installed_extension = observer.WaitForExtensionWillBeInstalled();
diff --git a/chrome/browser/prefs/tracked/pref_hash_browsertest.cc b/chrome/browser/prefs/tracked/pref_hash_browsertest.cc index eb1fcc7..949f5c1e 100644 --- a/chrome/browser/prefs/tracked/pref_hash_browsertest.cc +++ b/chrome/browser/prefs/tracked/pref_hash_browsertest.cc
@@ -22,7 +22,6 @@ #include "base/values.h" #include "build/build_config.h" #include "chrome/browser/extensions/extension_browsertest.h" -#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/prefs/chrome_pref_service_factory.h" #include "chrome/browser/prefs/profile_pref_store_manager.h" #include "chrome/browser/prefs/session_startup_pref.h" @@ -32,6 +31,8 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" +#include "components/prefs/pref_service.h" +#include "components/prefs/scoped_user_pref_update.h" #include "components/search_engines/default_search_manager.h" #include "components/search_engines/template_url_data.h" #include "content/public/test/test_launcher.h" @@ -175,7 +176,7 @@ // verify preferenes throughout the tests provided by this fixture. // 2) Instantiate their test via the PREF_HASH_BROWSER_TEST macro above. // Based on top of ExtensionBrowserTest to allow easy interaction with the -// ExtensionService. +// ExtensionRegistry. class PrefHashBrowserTestBase : public extensions::ExtensionBrowserTest, public testing::WithParamInterface<std::string> { @@ -540,7 +541,8 @@ EXPECT_EQ("http://example.com", profile()->GetPrefs()->GetString(prefs::kHomePage)); - EXPECT_TRUE(extension_service()->GetExtensionById(kGoodCrxId, false)); + EXPECT_TRUE(extension_registry()->GetExtensionById( + kGoodCrxId, extensions::ExtensionRegistry::ENABLED)); // Reaction should be identical to unattacked default prefs. PrefHashBrowserTestUnchangedDefault::VerifyReactionToPrefAttack(); @@ -924,7 +926,9 @@ BEGIN_ALLOW_SINGLE_BUCKET + 5)); EXPECT_EQ(protection_level_ < PROTECTION_ENABLED_EXTENSIONS, - extension_service()->GetExtensionById(kGoodCrxId, true) != NULL); + extension_registry()->GetExtensionById( + kGoodCrxId, extensions::ExtensionRegistry::COMPATIBILITY) != + nullptr); // Nothing else should have triggered. EXPECT_EQ(
diff --git a/chrome/browser/previews/hints_fetcher_browsertest.cc b/chrome/browser/previews/hints_fetcher_browsertest.cc index 01ff5af..24f6308d8 100644 --- a/chrome/browser/previews/hints_fetcher_browsertest.cc +++ b/chrome/browser/previews/hints_fetcher_browsertest.cc
@@ -203,9 +203,9 @@ ->GetActiveWebContents() ->GetBrowserContext()) ->GetPrefs() - ->SetInteger( - optimization_guide::prefs::kHintsFetcherTopHostBlacklistState, - static_cast<int>(blacklist_state)); + ->SetInteger(optimization_guide::prefs:: + kHintsFetcherDataSaverTopHostBlacklistState, + static_cast<int>(blacklist_state)); } void LoadHintsForUrl(const GURL& url) { @@ -347,7 +347,7 @@ DISALLOW_COPY_AND_ASSIGN(HintsFetcherWithResponseBrowserTest); }; -// Issues with multiple profiles likely cause the site enagement service-based +// Issues with multiple profiles likely cause the site engagement service-based // tests to flake. #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS) #define DISABLE_ON_WIN_MAC_CHROMESOS(x) DISABLED_##x @@ -385,6 +385,8 @@ histogram_tester->ExpectBucketCount( "OptimizationGuide.HintsFetcher.GetHintsRequest.NetErrorCode", net::OK, 1); + histogram_tester->ExpectUniqueSample( + "OptimizationGuide.HintsFetcher.GetHintsRequest.HintCount", 1, 1); } IN_PROC_BROWSER_TEST_F(HintsFetcherDisabledBrowserTest, HintsFetcherDisabled) { @@ -448,6 +450,10 @@ histogram_tester, "OptimizationGuide.HintsFetcher.GetHintsRequest.Status", 1), 1); + EXPECT_GE(RetryForHistogramUntilCountReached( + histogram_tester, + "OptimizationGuide.HintsFetcher.GetHintsRequest.HintCount", 1), + 1); LoadHintsForUrl(https_url()); @@ -498,10 +504,14 @@ histogram_tester->ExpectBucketCount( "OptimizationGuide.HintsFetcher.GetHintsRequest.NetErrorCode", net::OK, 1); + histogram_tester->ExpectUniqueSample( + "OptimizationGuide.HintsFetcher.GetHintsRequest.HintCount", 1, 1); } else if (response_type == HintsFetcherRemoteResponseType::kUnsuccessful) { histogram_tester->ExpectBucketCount( "OptimizationGuide.HintsFetcher.GetHintsRequest.Status", net::HTTP_NOT_FOUND, 1); + histogram_tester->ExpectTotalCount( + "OptimizationGuide.HintsFetcher.GetHintsRequest.HintCount", 0); } else if (response_type == HintsFetcherRemoteResponseType::kMalformed) { // A malformed GetHintsResponse will still register as successful fetch with // respect to the network. @@ -511,6 +521,8 @@ histogram_tester->ExpectBucketCount( "OptimizationGuide.HintsFetcher.GetHintsRequest.NetErrorCode", net::OK, 1); + histogram_tester->ExpectTotalCount( + "OptimizationGuide.HintsFetcher.GetHintsRequest.HintCount", 0); LoadHintsForUrl(https_url()); @@ -561,6 +573,10 @@ histogram_tester, "OptimizationGuide.HintsFetcher.GetHintsRequest.Status", 1), 1); + EXPECT_GE(RetryForHistogramUntilCountReached( + histogram_tester, + "OptimizationGuide.HintsFetcher.GetHintsRequest.HintCount", 1), + 1); LoadHintsForUrl(https_url()); @@ -639,6 +655,9 @@ histogram_tester, "OptimizationGuide.HintsFetcher.GetHintsRequest.Status", 1), 1); + // There should have been 1 hint returned in the response. + histogram_tester->ExpectUniqueSample( + "OptimizationGuide.HintsFetcher.GetHintsRequest.HintCount", 1, 1); LoadHintsForUrl(https_url());
diff --git a/chrome/browser/previews/previews_service.cc b/chrome/browser/previews/previews_service.cc index 16613fa6..df51730 100644 --- a/chrome/browser/previews/previews_service.cc +++ b/chrome/browser/previews/previews_service.cc
@@ -10,9 +10,9 @@ #include "base/task/post_task.h" #include "base/time/default_clock.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/data_saver/data_saver_top_host_provider.h" #include "chrome/browser/previews/previews_lite_page_decider.h" #include "chrome/browser/previews/previews_offline_helper.h" -#include "chrome/browser/previews/previews_top_host_provider.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_constants.h" #include "components/blacklist/opt_out_blacklist/opt_out_store.h" @@ -110,7 +110,7 @@ PreviewsService::PreviewsService(content::BrowserContext* browser_context) : top_host_provider_( - std::make_unique<PreviewsTopHostProvider>(browser_context)), + std::make_unique<DataSaverTopHostProvider>(browser_context)), previews_lite_page_decider_( std::make_unique<PreviewsLitePageDecider>(browser_context)), previews_offline_helper_(
diff --git a/chrome/browser/previews/previews_service.h b/chrome/browser/previews/previews_service.h index 647f707..52c39bd2 100644 --- a/chrome/browser/previews/previews_service.h +++ b/chrome/browser/previews/previews_service.h
@@ -42,7 +42,7 @@ } class PreviewsOfflineHelper; -class PreviewsTopHostProvider; +class DataSaverTopHostProvider; // Keyed service that owns a previews::PreviewsUIService. PreviewsService lives // on the UI thread. @@ -95,7 +95,7 @@ private: // The top site provider for use with the Previews Optimization Guide's Hints // Fetcher. - std::unique_ptr<PreviewsTopHostProvider> top_host_provider_; + std::unique_ptr<DataSaverTopHostProvider> top_host_provider_; // The previews UI thread service. std::unique_ptr<previews::PreviewsUIService> previews_ui_service_;
diff --git a/chrome/browser/previews/previews_ui_tab_helper.cc b/chrome/browser/previews/previews_ui_tab_helper.cc index 8c9d290..d411ef0 100644 --- a/chrome/browser/previews/previews_ui_tab_helper.cc +++ b/chrome/browser/previews/previews_ui_tab_helper.cc
@@ -13,11 +13,11 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings.h" #include "chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings_factory.h" +#include "chrome/browser/data_saver/data_saver_top_host_provider.h" #include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h" #include "chrome/browser/previews/previews_content_util.h" #include "chrome/browser/previews/previews_service.h" #include "chrome/browser/previews/previews_service_factory.h" -#include "chrome/browser/previews/previews_top_host_provider.h" #include "chrome/browser/profiles/profile.h" #include "chrome/grit/generated_resources.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h" @@ -285,7 +285,7 @@ MaybeRecordPreviewReload(navigation_handle); - PreviewsTopHostProvider::MaybeUpdateTopHostBlacklist(navigation_handle); + DataSaverTopHostProvider::MaybeUpdateTopHostBlacklist(navigation_handle); MaybeShowInfoBarForHintsFetcher(); }
diff --git a/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc b/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc index d8a90a0..495eab8 100644 --- a/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc +++ b/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc
@@ -186,7 +186,7 @@ // determine the failure. int CloudPrintMockService_Main(SetExpectationsCallback set_expectations) { base::PlatformThread::SetName("Main Thread"); - base::SingleThreadTaskExecutor executor(base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor executor(base::MessagePumpType::UI); base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); content::RegisterPathProvider();
diff --git a/chrome/browser/profiles/off_the_record_profile_io_data.cc b/chrome/browser/profiles/off_the_record_profile_io_data.cc index 5149ceb0..62856a20 100644 --- a/chrome/browser/profiles/off_the_record_profile_io_data.cc +++ b/chrome/browser/profiles/off_the_record_profile_io_data.cc
@@ -35,7 +35,6 @@ #include "net/cookies/cookie_store.h" #include "net/http/http_cache.h" #include "net/http/http_network_session.h" -#include "net/http/http_server_properties_impl.h" #include "net/net_buildflags.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_builder.h"
diff --git a/chrome/browser/profiles/profile_activity_metrics_recorder.cc b/chrome/browser/profiles/profile_activity_metrics_recorder.cc index 971ed0a..8d6a802 100644 --- a/chrome/browser/profiles/profile_activity_metrics_recorder.cc +++ b/chrome/browser/profiles/profile_activity_metrics_recorder.cc
@@ -65,6 +65,18 @@ } } +void RecordUserAction(Profile* profile) { + if (!profile) + return; + + int profile_bucket = GetMetricsBucketIndex(profile); + + if (0 <= profile_bucket && profile_bucket <= kMaxProfileBucket) { + UMA_HISTOGRAM_EXACT_LINEAR("Profile.UserAction.PerProfile", profile_bucket, + kMaxProfileBucket); + } +} + } // namespace // static @@ -80,16 +92,6 @@ g_profile_activity_metrics_recorder = nullptr; } -ProfileActivityMetricsRecorder::ProfileActivityMetricsRecorder() { - BrowserList::AddObserver(this); - metrics::DesktopSessionDurationTracker::Get()->AddObserver(this); -} - -ProfileActivityMetricsRecorder::~ProfileActivityMetricsRecorder() { - BrowserList::RemoveObserver(this); - metrics::DesktopSessionDurationTracker::Get()->RemoveObserver(this); -} - void ProfileActivityMetricsRecorder::OnBrowserSetLastActive(Browser* browser) { Profile* active_profile = browser->profile()->GetOriginalProfile(); @@ -112,3 +114,21 @@ session_end - profile_session_start_); last_active_profile_ = nullptr; } + +ProfileActivityMetricsRecorder::ProfileActivityMetricsRecorder() { + BrowserList::AddObserver(this); + metrics::DesktopSessionDurationTracker::Get()->AddObserver(this); + action_callback_ = base::Bind(&ProfileActivityMetricsRecorder::OnUserAction, + base::Unretained(this)); + base::AddActionCallback(action_callback_); +} + +ProfileActivityMetricsRecorder::~ProfileActivityMetricsRecorder() { + BrowserList::RemoveObserver(this); + metrics::DesktopSessionDurationTracker::Get()->RemoveObserver(this); + base::RemoveActionCallback(action_callback_); +} + +void ProfileActivityMetricsRecorder::OnUserAction(const std::string& action) { + RecordUserAction(last_active_profile_); +}
diff --git a/chrome/browser/profiles/profile_activity_metrics_recorder.h b/chrome/browser/profiles/profile_activity_metrics_recorder.h index ac61f06..073d60c 100644 --- a/chrome/browser/profiles/profile_activity_metrics_recorder.h +++ b/chrome/browser/profiles/profile_activity_metrics_recorder.h
@@ -8,6 +8,7 @@ #include <stddef.h> #include "base/macros.h" +#include "base/metrics/user_metrics.h" #include "base/time/time.h" #include "chrome/browser/metrics/desktop_session_duration/desktop_session_duration_tracker.h" #include "chrome/browser/ui/browser_list_observer.h" @@ -37,9 +38,13 @@ ProfileActivityMetricsRecorder(); ~ProfileActivityMetricsRecorder() override; + void OnUserAction(const std::string& action); + Profile* last_active_profile_ = nullptr; base::TimeTicks profile_session_start_; + base::ActionCallback action_callback_; + DISALLOW_COPY_AND_ASSIGN(ProfileActivityMetricsRecorder); };
diff --git a/chrome/browser/profiles/profile_activity_metrics_recorder_unittest.cc b/chrome/browser/profiles/profile_activity_metrics_recorder_unittest.cc index 70e5721..265cfbe 100644 --- a/chrome/browser/profiles/profile_activity_metrics_recorder_unittest.cc +++ b/chrome/browser/profiles/profile_activity_metrics_recorder_unittest.cc
@@ -5,6 +5,7 @@ #include <string> #include <vector> +#include "base/metrics/user_metrics.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_task_environment.h" #include "base/time/time.h" @@ -31,7 +32,9 @@ ProfileActivityMetricsRecorderTest() : thread_bundle_( base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME_AND_NOW), - profile_manager_(TestingBrowserProcess::GetGlobal()) {} + profile_manager_(TestingBrowserProcess::GetGlobal()) { + base::SetRecordActionTaskRunner(thread_bundle_.GetMainThreadTaskRunner()); + } void SetUp() override { Test::SetUp(); @@ -65,6 +68,17 @@ metrics::DesktopSessionDurationTracker::Get()->OnUserEvent(); } + // Method to test the recording of the Profile.UserAction.PerProfile + // histogram. + void SimulateUserActionAndExpectRecording(int bucket) { + // A new |base::HistogramTester| has to be created, because other methods + // could've already triggered user actions. + base::HistogramTester histograms; + base::RecordAction(base::UserMetricsAction("Test_Action")); + histograms.ExpectBucketCount("Profile.UserAction.PerProfile", bucket, + /*count=*/1); + } + TestingProfileManager* profile_manager() { return &profile_manager_; } base::HistogramTester* histograms() { return &histogram_tester_; } content::TestBrowserThreadBundle* thread_bundle() { return &thread_bundle_; } @@ -85,17 +99,19 @@ Profile* guest_profile = profile_manager()->CreateGuestProfile(); histograms()->ExpectTotalCount("Profile.BrowserActive.PerProfile", 0); - // Check whether the regular profile is counted in bucket 2. (Bucket 1 is + // Check whether the regular profile is counted in bucket 1. (Bucket 0 is // reserved for the guest profile.) ActivateBrowser(regular_profile); histograms()->ExpectBucketCount("Profile.BrowserActive.PerProfile", /*bucket=*/1, /*count=*/1); + SimulateUserActionAndExpectRecording(/*bucket=*/1); // Activate an incognito browser instance of the guest profile. // Note: Creating a non-incognito guest browser instance is not possible. ActivateIncognitoBrowser(guest_profile); histograms()->ExpectBucketCount("Profile.BrowserActive.PerProfile", /*bucket=*/0, /*count=*/1); + SimulateUserActionAndExpectRecording(/*bucket=*/0); histograms()->ExpectTotalCount("Profile.BrowserActive.PerProfile", 2); } @@ -127,6 +143,7 @@ ActivateBrowser(profile1); histograms()->ExpectBucketCount("Profile.BrowserActive.PerProfile", /*bucket=*/1, /*count=*/1); + SimulateUserActionAndExpectRecording(/*bucket=*/1); // Profile 3: Profile is created. This does not affect the histogram. Profile* profile3 = profile_manager()->CreateTestingProfile("p3"); @@ -136,6 +153,7 @@ ActivateBrowser(profile1); histograms()->ExpectBucketCount("Profile.BrowserActive.PerProfile", /*bucket=*/1, /*count=*/2); + SimulateUserActionAndExpectRecording(/*bucket=*/1); // Profile 1: Session lasts 2 minutes. thread_bundle()->FastForwardBy(base::TimeDelta::FromMinutes(2)); @@ -145,6 +163,8 @@ ActivateBrowser(profile3); histograms()->ExpectBucketCount("Profile.BrowserActive.PerProfile", /*bucket=*/2, /*count=*/1); + SimulateUserActionAndExpectRecording(/*bucket=*/2); + // Profile 1: Session ended. The duration(2 minutes) is recorded. histograms()->ExpectBucketCount("Profile.SessionDuration.PerProfile", /*bucket=*/1, /*count=*/2); @@ -157,6 +177,8 @@ ActivateBrowser(profile2); histograms()->ExpectBucketCount("Profile.BrowserActive.PerProfile", /*bucket=*/3, /*count=*/1); + SimulateUserActionAndExpectRecording(/*bucket=*/3); + // Profile 3: Session ended. The duration(2 minutes) is recorded. histograms()->ExpectBucketCount("Profile.SessionDuration.PerProfile", /*bucket=*/2, /*count=*/2);
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc index 7af7d439..3326cbc 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc +++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -33,6 +33,7 @@ #include "chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings_factory.h" #include "chrome/browser/devtools/devtools_window.h" #include "chrome/browser/download/download_stats.h" +#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_util.h" #include "chrome/browser/language/language_model_manager_factory.h" #include "chrome/browser/media/router/media_router_dialog_controller.h" @@ -126,6 +127,8 @@ #include "content/public/browser/web_contents.h" #include "content/public/common/menu_item.h" #include "content/public/common/url_utils.h" +#include "extensions/browser/extension_registry.h" +#include "extensions/browser/extension_system.h" #include "extensions/buildflags/buildflags.h" #include "media/base/media_switches.h" #include "net/base/escape.h" @@ -685,10 +688,8 @@ void RenderViewContextMenu::AppendAllExtensionItems() { extension_items_.Clear(); - extensions::ExtensionService* service = - extensions::ExtensionSystem::Get(browser_context_)->extension_service(); - if (!service) - return; // In unit-tests, we may not have an ExtensionService. + extensions::ExtensionRegistry* registry = + extensions::ExtensionRegistry::Get(browser_context_); MenuManager* menu_manager = MenuManager::Get(browser_context_); if (!menu_manager) @@ -704,8 +705,8 @@ std::map<base::string16, std::vector<const Extension*>> title_to_extensions_map; for (auto iter = ids.begin(); iter != ids.end(); ++iter) { - const Extension* extension = - service->GetExtensionById(iter->extension_id, false); + const Extension* extension = registry->GetExtensionById( + iter->extension_id, extensions::ExtensionRegistry::ENABLED); // Platform apps have their context menus created directly in // AppendPlatformAppItems. if (extension && !extension->is_platform_app()) {
diff --git a/chrome/browser/resources/settings/icons.html b/chrome/browser/resources/settings/icons.html index 816bb70c..95339f3 100644 --- a/chrome/browser/resources/settings/icons.html +++ b/chrome/browser/resources/settings/icons.html
@@ -12,6 +12,7 @@ <g id="googleg"><path d="M16.58 8H9v2.75h4.47c-.24 1.2-1.42 3.27-4.47 3.27-2.72 0-4.93-2.25-4.93-5.02S6.28 3.98 9 3.98c1.54 0 2.57.66 3.17 1.22l2.19-2.12C12.97 1.79 11.16 1 9 1 4.58 1 1 4.58 1 9s3.58 8 8 8c4.62 0 7.68-3.25 7.68-7.82 0-.46-.04-.83-.1-1.18z"></path></g> <g id="location-on"><path d="M10,2 C6.95928571,2 4.5,4.504 4.5,7.6 C4.5,11.8 10,18 10,18 C10,18 15.5,11.8 15.5,7.6 C15.5,4.504 13.0407143,2 10,2 Z M10,9.5 C8.896,9.5 8,8.604 8,7.5 C8,6.396 8.896,5.5 10,5.5 C11.104,5.5 12,6.396 12,7.5 C12,8.604 11.104,9.5 10,9.5 Z"></path></g> <g id="vpn-key"><path d="M10.4727273,8 C9.87272727,6.2525 8.26181818,5 6.36363636,5 C3.95272727,5 2,7.01375 2,9.5 C2,11.98625 3.95272727,14 6.36363636,14 C8.26181818,14 9.87272727,12.7475 10.4727273,11 L13.6363636,11 L13.6363636,14 L16.5454545,14 L16.5454545,11 L18,11 L18,8 L10.4727273,8 Z M6.36363636,11 C5.56,11 4.90909091,10.32875 4.90909091,9.5 C4.90909091,8.67125 5.56,8 6.36363636,8 C7.16727273,8 7.81818182,8.67125 7.81818182,9.5 C7.81818182,10.32875 7.16727273,11 6.36363636,11 Z"></path></g> + <g id="cloud_off"><path d="M14.8713111,16.0002 L6,16.0002 C3.239,16.0002 1,13.7622 1,11.0002 C1,8.58475294 2.71868905,6.59044755 4.99627833,6.12516722 L2,3.12888889 L3.12888889,2 L18,16.8711111 L16.8711111,18 L14.8713111,16.0002 Z M17.8921876,14.7632987 L7.33083687,4.20194798 C8.11843435,3.75577808 9.02717677,3.5002 10,3.5002 C12.71,3.5002 14.957,5.4612 15.411,8.0412 C17.424,8.2502 19,9.9312 19,12.0002 C19,13.0718701 18.5784721,14.0451601 17.8921876,14.7632987 Z"></path></g> </defs> </svg> </iron-iconset-svg>
diff --git a/chrome/browser/resources/settings/printing_page/cups_printers.html b/chrome/browser/resources/settings/printing_page/cups_printers.html index 7f23152..1db332ad 100644 --- a/chrome/browser/resources/settings/printing_page/cups_printers.html +++ b/chrome/browser/resources/settings/printing_page/cups_printers.html
@@ -10,6 +10,8 @@ <link rel="import" href="chrome://resources/html/assert.html"> <link rel="import" href="chrome://resources/html/chromeos/onc_mojo.html"> <link rel="import" href="chrome://resources/html/cr/ui/focus_without_ink.html"> +<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html"> +<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> <link rel="import" href="cups_add_printer_dialog.html"> <link rel="import" href="cups_edit_printer_dialog.html"> <link rel="import" href="cups_printer_shared_css.html"> @@ -19,11 +21,10 @@ <dom-module id="settings-cups-printers"> <template> - <style include="cups-printer-shared action-link"> + <style include="cups-printer-shared action-link iron-flex + iron-flex-alignment"> .custom-list-item { - align-items: center; border-bottom: var(--cr-separator-line); - display: flex; min-height: var(--settings-row-min-height); } @@ -42,6 +43,20 @@ flex: 1; } + #cloudOffIcon { + --iron-icon-fill-color: rgb(95, 99, 104); + margin-bottom: 16px; + } + + #connectionMessage { + text-align: center; + width: 250px; + } + + #noConnectivityContentContainer { + margin-top: 32px; + } + #noSearchResultsMessage { color: var(--md-loading-message-color); font-size: 16px; @@ -102,9 +117,6 @@ <a href="$i18n{printingCUPSPrintLearnMoreUrl}" target="_blank"> $i18n{learnMore} </a> - <div class="secondary" hidden="[[canAddPrinter_]]"> - $i18n{requireNetworkMessage} - </div> <template is="dom-if" if="[[!addPrinterButtonActive_(canAddPrinter_, prefs.native_printing.user_native_printers_allowed.value)]]"> <cr-policy-pref-indicator @@ -114,21 +126,33 @@ </template> </div> - <div id="addPrinterSection"> - <div class="custom-list-item"> - <div id="addPrinterText">$i18n{addCupsPrinter}</div> - <cr-button class="action-button" id="addPrinter" - on-click="onAddPrinterTap_" - disabled="[[!addPrinterButtonActive_(canAddPrinter_, - prefs.native_printing.user_native_printers_allowed.value)]]"> - $i18n{addCupsPrinter} - </cr-button> + <template is="dom-if" if="[[canAddPrinter_]]"> + <div id="addPrinterSection"> + <div class="layout horizontal center custom-list-item"> + <div id="addPrinterText">$i18n{addCupsPrinter}</div> + <cr-button class="action-button" id="addPrinter" + on-click="onAddPrinterTap_" + disabled="[[!addPrinterButtonActive_(canAddPrinter_, + prefs.native_printing.user_native_printers_allowed.value)]]" + > + $i18n{addCupsPrinter} + </cr-button> + </div> </div> - </div> + <settings-cups-nearby-printers search-term="[[searchTerm]]" + active-printer="{{activePrinter}}"> + </settings-cups-nearby-printers> + </template> - <settings-cups-nearby-printers search-term="[[searchTerm]]" - active-printer="{{activePrinter}}"> - </settings-cups-nearby-printers> + <template is="dom-if" if="[[!canAddPrinter_]]"> + <div id="noConnectivityContentContainer" + class="layout vertical center"> + <iron-icon id="cloudOffIcon" icon="settings20:cloud_off"></iron-icon> + <div id="connectionMessage" class="secondary"> + $i18n{checkNetworkMessage} + </div> + </div> + </template> </template> <settings-cups-add-printer-dialog id="addPrinterDialog"
diff --git a/chrome/browser/resources/settings/printing_page/cups_printers.js b/chrome/browser/resources/settings/printing_page/cups_printers.js index 7e41ed4..e37e3e4 100644 --- a/chrome/browser/resources/settings/printing_page/cups_printers.js +++ b/chrome/browser/resources/settings/printing_page/cups_printers.js
@@ -108,7 +108,11 @@ */ onActiveNetworksChanged: function(networks) { this.canAddPrinter_ = networks.some(function(network) { - return OncMojo.connectionStateIsConnected(network.connectionState); + // Note: Check for kOnline rather than using + // OncMojo.connectionStateIsConnected() since the latter could return true + // for networks without connectivity (e.g., captive portals). + return network.connectionState == + chromeos.networkConfig.mojom.ConnectionStateType.kOnline; }); },
diff --git a/chrome/browser/safe_browsing/certificate_reporting_service_unittest.cc b/chrome/browser/safe_browsing/certificate_reporting_service_unittest.cc index 104970b..a588e6f 100644 --- a/chrome/browser/safe_browsing/certificate_reporting_service_unittest.cc +++ b/chrome/browser/safe_browsing/certificate_reporting_service_unittest.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/safe_browsing/certificate_reporting_service.h" +#include <memory> #include <string> #include "base/atomic_sequence_num.h" @@ -14,6 +15,7 @@ #include "base/single_thread_task_runner.h" #include "base/task/post_task.h" #include "base/test/metrics/histogram_tester.h" +#include "base/test/scoped_task_environment.h" #include "base/test/simple_test_clock.h" #include "base/test/thread_test_helper.h" #include "base/time/clock.h" @@ -167,7 +169,6 @@ base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( &test_url_loader_factory_); - message_loop_.reset(new base::MessageLoopForIO()); event_histogram_tester_.reset(new EventHistogramTester()); } @@ -195,8 +196,8 @@ } private: - std::unique_ptr<base::MessageLoopForIO> message_loop_; - std::unique_ptr<content::TestBrowserThread> io_thread_; + base::test::ScopedTaskEnvironment scoped_task_environment_{ + base::test::ScopedTaskEnvironment::MainThreadType::IO}; network::TestURLLoaderFactory test_url_loader_factory_; scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory_;
diff --git a/chrome/browser/safe_browsing/client_side_detection_service.cc b/chrome/browser/safe_browsing/client_side_detection_service.cc index 9d3a2fdc..3a25c639 100644 --- a/chrome/browser/safe_browsing/client_side_detection_service.cc +++ b/chrome/browser/safe_browsing/client_side_detection_service.cc
@@ -19,10 +19,8 @@ #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chrome_service.h" #include "chrome/browser/policy/chrome_browser_policy_connector.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/common/constants.mojom.h" #include "chrome/common/pref_names.h" #include "chrome/common/safe_browsing/client_model.pb.h" #include "components/prefs/pref_service.h" @@ -36,6 +34,7 @@ #include "content/public/browser/render_process_host.h" #include "crypto/sha2.h" #include "google_apis/google_api_keys.h" +#include "mojo/public/cpp/bindings/remote.h" #include "net/base/escape.h" #include "net/base/ip_address.h" #include "net/base/load_flags.h" @@ -44,7 +43,6 @@ #include "net/traffic_annotation/network_traffic_annotation.h" #include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/public/cpp/simple_url_loader.h" -#include "services/service_manager/public/cpp/connector.h" #include "url/gurl.h" using content::BrowserThread; @@ -250,17 +248,9 @@ DVLOG(2) << "Disabling client-side phishing detection for " << "RenderProcessHost @" << process; } - safe_browsing::mojom::PhishingModelSetterPtr phishing; - // Null in unit tests. - if (!ChromeService::GetInstance()->connector()) { - return; - } - ChromeService::GetInstance()->connector()->BindInterface( - service_manager::ServiceFilter::ByNameWithIdInGroup( - chrome::mojom::kRendererServiceName, - process->GetChildIdentity().instance_id(), - process->GetChildIdentity().instance_group()), - &phishing); + + mojo::Remote<safe_browsing::mojom::PhishingModelSetter> phishing; + process->BindReceiver(phishing.BindNewPipeAndPassReceiver()); phishing->SetPhishingModel(model); }
diff --git a/chrome/browser/safe_browsing/download_protection/multipart_uploader.cc b/chrome/browser/safe_browsing/download_protection/multipart_uploader.cc index d7a51d23..228afc8 100644 --- a/chrome/browser/safe_browsing/download_protection/multipart_uploader.cc +++ b/chrome/browser/safe_browsing/download_protection/multipart_uploader.cc
@@ -110,7 +110,7 @@ std::unique_ptr<std::string> response_body) { // TODO(drubery): Add metrics for success rates here. if (net_error == net::OK && response_code == net::HTTP_OK) { - std::move(callback_).Run(net::OK, net::HTTP_OK, *response_body.get()); + std::move(callback_).Run(/*success=*/true, *response_body.get()); } else { if (retry_count_ < kMaxRetryAttempts) { base::PostDelayedTask(FROM_HERE, {content::BrowserThread::UI}, @@ -120,9 +120,30 @@ current_backoff_ *= kBackoffFactor; retry_count_++; } else { - std::move(callback_).Run(net_error, response_code, *response_body.get()); + std::move(callback_).Run(/*success=*/false, *response_body.get()); } } } +// static +MultipartUploadRequestFactory* MultipartUploadRequest::factory_ = nullptr; + +// static +std::unique_ptr<MultipartUploadRequest> MultipartUploadRequest::Create( + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, + const GURL& base_url, + const std::string& metadata, + const std::string& data, + const net::NetworkTrafficAnnotationTag& traffic_annotation, + MultipartUploadRequest::Callback callback) { + if (!factory_) { + return std::make_unique<MultipartUploadRequest>( + url_loader_factory, base_url, metadata, data, traffic_annotation, + std::move(callback)); + } + + return factory_->Create(url_loader_factory, base_url, metadata, data, + traffic_annotation, std::move(callback)); +} + } // namespace safe_browsing
diff --git a/chrome/browser/safe_browsing/download_protection/multipart_uploader.h b/chrome/browser/safe_browsing/download_protection/multipart_uploader.h index 63c95302..97a981c 100644 --- a/chrome/browser/safe_browsing/download_protection/multipart_uploader.h +++ b/chrome/browser/safe_browsing/download_protection/multipart_uploader.h
@@ -23,12 +23,14 @@ namespace safe_browsing { +class MultipartUploadRequestFactory; + // This class encapsulates the upload of a file with metadata using the // multipart protocol. This class is neither movable nor copyable. class MultipartUploadRequest { public: - using Callback = base::OnceCallback< - void(int net_error, int response_code, const std::string& response_data)>; + using Callback = + base::OnceCallback<void(bool success, const std::string& response_data)>; // Creates a MultipartUploadRequest, which will upload |data| to the given // |base_url| with |metadata| attached. @@ -44,11 +46,25 @@ MultipartUploadRequest(MultipartUploadRequest&&) = delete; MultipartUploadRequest& operator=(MultipartUploadRequest&&) = delete; - ~MultipartUploadRequest(); + virtual ~MultipartUploadRequest(); // Start the upload. This must be called on the UI thread. When complete, this // will call |callback_| on the UI thread. - void Start(); + virtual void Start(); + + // Makes the passed |factory| the factory used to instantiate a + // MultipartUploadRequest. Useful for tests. + static void RegisterFactoryForTests(MultipartUploadRequestFactory* factory) { + factory_ = factory; + } + + static std::unique_ptr<MultipartUploadRequest> Create( + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, + const GURL& base_url, + const std::string& metadata, + const std::string& data, + const net::NetworkTrafficAnnotationTag& traffic_annotation, + MultipartUploadRequest::Callback callback); private: FRIEND_TEST_ALL_PREFIXES(MultipartUploadRequestTest, GeneratesCorrectBody); @@ -72,6 +88,8 @@ // Called to send a single request. Is overridden in tests. virtual void SendRequest(); + static MultipartUploadRequestFactory* factory_; + GURL base_url_; std::string metadata_; std::string data_; @@ -88,6 +106,18 @@ base::WeakPtrFactory<MultipartUploadRequest> weak_factory_; }; +class MultipartUploadRequestFactory { + public: + virtual ~MultipartUploadRequestFactory(); + virtual std::unique_ptr<MultipartUploadRequest> Create( + scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, + const GURL& base_url, + const std::string& metadata, + const std::string& data, + const net::NetworkTrafficAnnotationTag& traffic_annotation, + MultipartUploadRequest::Callback callback) = 0; +}; + } // namespace safe_browsing #endif // CHROME_BROWSER_SAFE_BROWSING_DOWNLOAD_PROTECTION_MULTIPART_UPLOADER_H_
diff --git a/chrome/browser/safe_browsing/download_protection/multipart_uploader_unittest.cc b/chrome/browser/safe_browsing/download_protection/multipart_uploader_unittest.cc index bfec3928..741241b5 100644 --- a/chrome/browser/safe_browsing/download_protection/multipart_uploader_unittest.cc +++ b/chrome/browser/safe_browsing/download_protection/multipart_uploader_unittest.cc
@@ -30,23 +30,22 @@ class MockMultipartUploadRequest : public MultipartUploadRequest { public: - MockMultipartUploadRequest(const std::string& metadata, - const std::string& data, - Callback callback) + MockMultipartUploadRequest() : MultipartUploadRequest(nullptr, GURL(), - metadata, - data, + "", + "", TRAFFIC_ANNOTATION_FOR_TESTS, - std::move(callback)) {} + base::DoNothing()) {} - MOCK_METHOD(void, SendRequest, (), (override)); + MOCK_METHOD0(SendRequest, void()); }; TEST_F(MultipartUploadRequestTest, GeneratesCorrectBody) { - MultipartUploadRequest request(nullptr, GURL(), "metadata", "data", - TRAFFIC_ANNOTATION_FOR_TESTS, - base::DoNothing()); + std::unique_ptr<MultipartUploadRequest> request = + MultipartUploadRequest::Create(nullptr, GURL(), "metadata", "data", + TRAFFIC_ANNOTATION_FOR_TESTS, + base::DoNothing()); std::string expected_body = "--boundary\r\n" @@ -59,14 +58,14 @@ "file data\r\n" "--boundary--\r\n"; - request.set_boundary("boundary"); - EXPECT_EQ(request.GenerateRequestBody("metadata", "file data"), + request->set_boundary("boundary"); + EXPECT_EQ(request->GenerateRequestBody("metadata", "file data"), expected_body); } TEST_F(MultipartUploadRequestTest, RetriesCorrectly) { - MockMultipartUploadRequest mock_request("metadata", "data", - base::DoNothing()); + MockMultipartUploadRequest mock_request; + EXPECT_CALL(mock_request, SendRequest()) .Times(3) .WillRepeatedly(Invoke([&mock_request]() {
diff --git a/chrome/browser/sharing/click_to_call/click_to_call_dialog.h b/chrome/browser/sharing/click_to_call/click_to_call_dialog.h deleted file mode 100644 index 528367f0..0000000 --- a/chrome/browser/sharing/click_to_call/click_to_call_dialog.h +++ /dev/null
@@ -1,17 +0,0 @@ -// Copyright 2019 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 CHROME_BROWSER_SHARING_CLICK_TO_CALL_CLICK_TO_CALL_DIALOG_H_ -#define CHROME_BROWSER_SHARING_CLICK_TO_CALL_CLICK_TO_CALL_DIALOG_H_ - -// The cross-platform UI interface which displays the click to call dialog. -// This object is responsible for its own lifetime. -class ClickToCallDialog { - public: - // Called to close the dialog and prevent future callbacks into the - // controller. - virtual void Hide() = 0; -}; - -#endif // CHROME_BROWSER_SHARING_CLICK_TO_CALL_CLICK_TO_CALL_DIALOG_H_
diff --git a/chrome/browser/sharing/click_to_call/click_to_call_sharing_dialog_controller.cc b/chrome/browser/sharing/click_to_call/click_to_call_sharing_dialog_controller.cc index b7381087..1037b94 100644 --- a/chrome/browser/sharing/click_to_call/click_to_call_sharing_dialog_controller.cc +++ b/chrome/browser/sharing/click_to_call/click_to_call_sharing_dialog_controller.cc
@@ -8,8 +8,8 @@ #include "base/strings/utf_string_conversions.h" #include "chrome/browser/external_protocol/external_protocol_handler.h" #include "chrome/browser/sharing/click_to_call/click_to_call_constants.h" -#include "chrome/browser/sharing/click_to_call/click_to_call_dialog.h" #include "chrome/browser/sharing/sharing_device_info.h" +#include "chrome/browser/sharing/sharing_dialog.h" #include "chrome/browser/sharing/sharing_service.h" #include "chrome/browser/sharing/sharing_service_factory.h" #include "chrome/browser/shell_integration.h" @@ -177,8 +177,7 @@ web_contents_); } -void ClickToCallSharingDialogController::OnDialogClosed( - ClickToCallDialog* dialog) { +void ClickToCallSharingDialogController::OnDialogClosed(SharingDialog* dialog) { // Ignore already replaced dialogs. if (dialog != dialog_) return; @@ -192,7 +191,7 @@ GURL(chrome::kSyncLearnMoreURL)); } -ClickToCallDialog* ClickToCallSharingDialogController::GetDialog() const { +SharingDialog* ClickToCallSharingDialogController::GetDialog() const { return dialog_; }
diff --git a/chrome/browser/sharing/click_to_call/click_to_call_sharing_dialog_controller.h b/chrome/browser/sharing/click_to_call/click_to_call_sharing_dialog_controller.h index 6c26b47..57fcab3 100644 --- a/chrome/browser/sharing/click_to_call/click_to_call_sharing_dialog_controller.h +++ b/chrome/browser/sharing/click_to_call/click_to_call_sharing_dialog_controller.h
@@ -19,7 +19,7 @@ class WebContents; } // namespace content -class ClickToCallDialog; +class SharingDialog; class SharingDeviceInfo; class ClickToCallSharingDialogController @@ -45,14 +45,14 @@ void OnAppChosen(const App& app) override; // Called by the ClickToCallDialogView when it is being closed. - void OnDialogClosed(ClickToCallDialog* dialog); + void OnDialogClosed(SharingDialog* dialog); // Called by the ClickToCallDialogView when the help text got clicked. void OnHelpTextClicked(); // Returns the currently open ClickToCallDialog or nullptr if there is no // dialog open. - ClickToCallDialog* GetDialog() const; + SharingDialog* GetDialog() const; bool is_loading() const { return is_loading_; } @@ -82,7 +82,7 @@ SharingService* sharing_service_ = nullptr; GURL phone_url_; - ClickToCallDialog* dialog_ = nullptr; + SharingDialog* dialog_ = nullptr; bool is_loading_ = false; bool send_failed_ = false; bool hide_default_handler_ = false;
diff --git a/chrome/browser/sharing/sharing_dialog.h b/chrome/browser/sharing/sharing_dialog.h new file mode 100644 index 0000000..0f4216b --- /dev/null +++ b/chrome/browser/sharing/sharing_dialog.h
@@ -0,0 +1,17 @@ +// Copyright 2019 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 CHROME_BROWSER_SHARING_SHARING_DIALOG_H_ +#define CHROME_BROWSER_SHARING_SHARING_DIALOG_H_ + +// The cross-platform UI interface which displays the sharing dialog. +// This object is responsible for its own lifetime. +class SharingDialog { + public: + // Called to close the dialog and prevent future callbacks into the + // controller. + virtual void Hide() = 0; +}; + +#endif // CHROME_BROWSER_SHARING_SHARING_DIALOG_H_
diff --git a/chrome/browser/site_isolation/site_per_process_text_input_browsertest.cc b/chrome/browser/site_isolation/site_per_process_text_input_browsertest.cc index 7a200bd8..7e72ec9 100644 --- a/chrome/browser/site_isolation/site_per_process_text_input_browsertest.cc +++ b/chrome/browser/site_isolation/site_per_process_text_input_browsertest.cc
@@ -1377,10 +1377,8 @@ // ContentBrowserClient overrides. void RenderProcessWillLaunch( - content::RenderProcessHost* process_host, - service_manager::mojom::ServiceRequest* service_request) override { - ChromeContentBrowserClient::RenderProcessWillLaunch(process_host, - service_request); + content::RenderProcessHost* process_host) override { + ChromeContentBrowserClient::RenderProcessWillLaunch(process_host); filters_.push_back( new content::TestTextInputClientMessageFilter(process_host)); }
diff --git a/chrome/browser/spellchecker/spellcheck_service_browsertest.cc b/chrome/browser/spellchecker/spellcheck_service_browsertest.cc index 12cf6ad..ec0665d4 100644 --- a/chrome/browser/spellchecker/spellcheck_service_browsertest.cc +++ b/chrome/browser/spellchecker/spellcheck_service_browsertest.cc
@@ -24,7 +24,6 @@ #include "chrome/browser/spellchecker/spellcheck_factory.h" #include "chrome/browser/ui/browser.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/constants.mojom.h" #include "chrome/test/base/in_process_browser_test.h" #include "components/browser_sync/browser_sync_switches.h" #include "components/language/core/browser/pref_names.h"
diff --git a/chrome/browser/ssl/certificate_error_reporter_unittest.cc b/chrome/browser/ssl/certificate_error_reporter_unittest.cc index 948c1ae4..7424e8d 100644 --- a/chrome/browser/ssl/certificate_error_reporter_unittest.cc +++ b/chrome/browser/ssl/certificate_error_reporter_unittest.cc
@@ -13,10 +13,10 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/macros.h" -#include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/strings/string_piece.h" #include "base/test/bind_test_util.h" +#include "base/test/scoped_task_environment.h" #include "components/encrypted_messages/encrypted_message.pb.h" #include "components/encrypted_messages/message_encrypter.h" #include "net/http/http_status_code.h" @@ -49,7 +49,8 @@ ~ErrorReporterTest() override {} protected: - base::MessageLoopForIO loop_; + base::test::ScopedTaskEnvironment scoped_task_environment_{ + base::test::ScopedTaskEnvironment::MainThreadType::IO}; uint8_t server_public_key_[32]; uint8_t server_private_key_[32];
diff --git a/chrome/browser/ssl/ssl_error_handler_unittest.cc b/chrome/browser/ssl/ssl_error_handler_unittest.cc index 67b289c..8950c2f9 100644 --- a/chrome/browser/ssl/ssl_error_handler_unittest.cc +++ b/chrome/browser/ssl/ssl_error_handler_unittest.cc
@@ -602,16 +602,16 @@ tick_clock_(new base::SimpleTestTickClock), test_server_(new net::EmbeddedTestServer) { network_time::NetworkTimeTracker::RegisterPrefs(pref_service_.registry()); + + field_trial_test()->SetNetworkQueriesWithVariationsService( + false, 0.0, + network_time::NetworkTimeTracker::FETCHES_IN_BACKGROUND_ONLY); } void SetUp() override { ChromeRenderViewHostTestHarness::SetUp(); SSLErrorHandler::ResetConfigForTesting(); - field_trial_test()->SetNetworkQueriesWithVariationsService( - false, 0.0, - network_time::NetworkTimeTracker::FETCHES_IN_BACKGROUND_ONLY); - base::RunLoop run_loop; std::unique_ptr<network::SharedURLLoaderFactoryInfo> url_loader_factory_info;
diff --git a/chrome/browser/task_manager/task_manager_browsertest.cc b/chrome/browser/task_manager/task_manager_browsertest.cc index 2cc2f16..0a723991 100644 --- a/chrome/browser/task_manager/task_manager_browsertest.cc +++ b/chrome/browser/task_manager/task_manager_browsertest.cc
@@ -19,7 +19,6 @@ #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/devtools/devtools_window_testing.h" #include "chrome/browser/extensions/extension_browsertest.h" -#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/notifications/notification_test_util.h" #include "chrome/browser/notifications/notification_ui_manager.h" @@ -48,7 +47,7 @@ #include "content/public/test/content_browser_test_utils.h" #include "content/public/test/no_renderer_crashes_assertion.h" #include "content/public/test/test_navigation_observer.h" -#include "extensions/browser/extension_system.h" +#include "extensions/browser/extension_registry.h" #include "extensions/common/extension.h" #include "net/dns/mock_host_resolver.h" #include "net/test/embedded_test_server/embedded_test_server.h" @@ -399,11 +398,9 @@ ShowTaskManager(); ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("packaged_app"))); - extensions::ExtensionService* service = - extensions::ExtensionSystem::Get(browser()->profile()) - ->extension_service(); const extensions::Extension* extension = - service->GetExtensionById(last_loaded_extension_id(), false); + extension_registry()->GetExtensionById( + last_loaded_extension_id(), extensions::ExtensionRegistry::ENABLED); ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAboutBlankTab())); ASSERT_NO_FATAL_FAILURE(WaitForTaskManagerRows(1, MatchAnyTab())); @@ -442,11 +439,9 @@ IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, NoticeAppTab) { ASSERT_TRUE(LoadExtension( test_data_dir_.AppendASCII("packaged_app"))); - extensions::ExtensionService* service = - extensions::ExtensionSystem::Get(browser()->profile()) - ->extension_service(); const extensions::Extension* extension = - service->GetExtensionById(last_loaded_extension_id(), false); + extension_registry()->GetExtensionById( + last_loaded_extension_id(), extensions::ExtensionRegistry::ENABLED); // Open a new tab to the app's launch URL and make sure we notice that. GURL url(extension->GetResourceURL("main.html"));
diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc index 64b9221..0dfb252 100644 --- a/chrome/browser/themes/theme_service.cc +++ b/chrome/browser/themes/theme_service.cc
@@ -932,10 +932,12 @@ } void ThemeService::MigrateTheme() { - extensions::ExtensionService* service = - extensions::ExtensionSystem::Get(profile_)->extension_service(); + extensions::ExtensionRegistry* registry = + extensions::ExtensionRegistry::Get(profile_); const Extension* extension = - service ? service->GetExtensionById(GetThemeID(), false) : nullptr; + registry ? registry->GetExtensionById( + GetThemeID(), extensions::ExtensionRegistry::ENABLED) + : nullptr; if (extension) { DLOG(ERROR) << "Migrating theme"; // Theme migration is done on the UI thread. Blocking the UI from appearing
diff --git a/chrome/browser/themes/theme_syncable_service.cc b/chrome/browser/themes/theme_syncable_service.cc index cf65501..63060de 100644 --- a/chrome/browser/themes/theme_syncable_service.cc +++ b/chrome/browser/themes/theme_syncable_service.cc
@@ -21,6 +21,7 @@ #include "components/sync/protocol/theme_specifics.pb.h" #include "extensions/browser/disable_reason.h" #include "extensions/browser/extension_prefs.h" +#include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" #include "extensions/common/manifest_url_handlers.h" @@ -217,11 +218,15 @@ string id(theme_specifics.custom_theme_id()); GURL update_url(theme_specifics.custom_theme_update_url()); DVLOG(1) << "Applying theme " << id << " with update_url " << update_url; - extensions::ExtensionService* extensions_service = + extensions::ExtensionService* extension_service = extensions::ExtensionSystem::Get(profile_)->extension_service(); - CHECK(extensions_service); + CHECK(extension_service); + extensions::ExtensionRegistry* extension_registry = + extensions::ExtensionRegistry::Get(profile_); + CHECK(extension_registry); const extensions::Extension* extension = - extensions_service->GetExtensionById(id, true); + extension_registry->GetExtensionById( + id, extensions::ExtensionRegistry::COMPATIBILITY); if (extension) { if (!extension->is_theme()) { DVLOG(1) << "Extension " << id << " is not a theme; aborting"; @@ -229,7 +234,7 @@ } int disabled_reasons = extensions::ExtensionPrefs::Get(profile_)->GetDisableReasons(id); - if (!extensions_service->IsExtensionEnabled(id) && + if (!extension_service->IsExtensionEnabled(id) && disabled_reasons != extensions::disable_reason::DISABLE_USER_ACTION) { DVLOG(1) << "Theme " << id << " is disabled with reason " << disabled_reasons << "; aborting"; @@ -243,12 +248,12 @@ // so by adding it as a pending extension and then triggering an // auto-update cycle. const bool kRemoteInstall = false; - if (!extensions_service->pending_extension_manager()->AddFromSync( + if (!extension_service->pending_extension_manager()->AddFromSync( id, update_url, base::Version(), &IsTheme, kRemoteInstall)) { LOG(WARNING) << "Could not add pending extension for " << id; return; } - extensions_service->CheckForUpdatesSoon(); + extension_service->CheckForUpdatesSoon(); } } else if (theme_specifics.has_autogenerated_theme()) { DVLOG(1) << "Applying autogenerated theme"; @@ -268,9 +273,9 @@ const extensions::Extension* current_extension = theme_service_->UsingExtensionTheme() && !theme_service_->UsingDefaultTheme() - ? extensions::ExtensionSystem::Get(profile_) - ->extension_service() - ->GetExtensionById(theme_service_->GetThemeID(), false) + ? extensions::ExtensionRegistry::Get(profile_)->GetExtensionById( + theme_service_->GetThemeID(), + extensions::ExtensionRegistry::ENABLED) : nullptr; if (current_extension && !extensions::sync_helper::IsSyncable(current_extension)) {
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 3381620e..ae3e228 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -2230,6 +2230,8 @@ "cocoa/tab_contents/chrome_web_contents_view_delegate_mac.mm", "cocoa/tab_contents/web_drag_bookmark_handler_mac.h", "cocoa/tab_contents/web_drag_bookmark_handler_mac.mm", + "cocoa/tab_menu_bridge.h", + "cocoa/tab_menu_bridge.mm", "cocoa/task_manager_mac.h", "cocoa/task_manager_mac.mm", "cocoa/touchbar/browser_window_default_touch_bar.h",
diff --git a/chrome/browser/ui/app_list/app_list_syncable_service.cc b/chrome/browser/ui/app_list/app_list_syncable_service.cc index 42b66b0..903ef94 100644 --- a/chrome/browser/ui/app_list/app_list_syncable_service.cc +++ b/chrome/browser/ui/app_list/app_list_syncable_service.cc
@@ -49,6 +49,7 @@ #include "components/sync/model/sync_merge_result.h" #include "components/sync/protocol/sync.pb.h" #include "extensions/browser/extension_prefs.h" +#include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/uninstall_reason.h" #include "extensions/common/constants.h" @@ -1261,8 +1262,10 @@ if (!extension_system_->extension_service()) return false; - const extensions::Extension* extension = - extension_system_->extension_service()->GetExtensionById(id, true); + extensions::ExtensionRegistry* registry = + extensions::ExtensionRegistry::Get(profile_); + const extensions::Extension* extension = registry->GetExtensionById( + id, extensions::ExtensionRegistry::COMPATIBILITY); return extension && extension->was_installed_by_oem(); }
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc index 35ed470..f4adeca 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
@@ -210,10 +210,8 @@ WindowOpenDisposition disposition) { EXPECT_TRUE(LoadExtension(test_data_dir_.AppendASCII(name))); - extensions::ExtensionService* service = - extensions::ExtensionSystem::Get(profile())->extension_service(); - const Extension* extension = - service->GetExtensionById(last_loaded_extension_id(), false); + const Extension* extension = extension_registry()->GetExtensionById( + last_loaded_extension_id(), extensions::ExtensionRegistry::ENABLED); EXPECT_TRUE(extension); apps::LaunchService::Get(profile())->OpenApplication( @@ -223,13 +221,11 @@ } ash::ShelfID CreateShortcut(const char* name) { - extensions::ExtensionService* service = - extensions::ExtensionSystem::Get(profile())->extension_service(); LoadExtension(test_data_dir_.AppendASCII(name)); // First get app_id. - const Extension* extension = - service->GetExtensionById(last_loaded_extension_id(), false); + const Extension* extension = extension_registry()->GetExtensionById( + last_loaded_extension_id(), extensions::ExtensionRegistry::ENABLED); const std::string app_id = extension->id(); // Then create a shortcut.
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc index 17400e8..273b72db 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc
@@ -119,6 +119,7 @@ #include "extensions/browser/app_window/app_window_contents.h" #include "extensions/browser/app_window/app_window_registry.h" #include "extensions/browser/app_window/native_app_window.h" +#include "extensions/browser/extension_registry.h" #include "extensions/common/constants.h" #include "extensions/common/extension.h" #include "extensions/common/manifest_constants.h" @@ -321,6 +322,9 @@ base::CommandLine::ForCurrentProcess(), base::FilePath(), false); extension_service_->Init(); + DCHECK(profile()); + extension_registry_ = extensions::ExtensionRegistry::Get(profile()); + bool flush_app_service_mojo_calls = false; if (app_service_proxy_connector_) { DCHECK(profile()); @@ -750,8 +754,8 @@ } else if (app == extensionYoutubeApp_->id()) { result += "youtube"; } else { - const auto* extension = extension_service_->GetExtensionById( - app, /*include_disabled=*/true); + const auto* extension = extension_registry_->GetExtensionById( + app, extensions::ExtensionRegistry::COMPATIBILITY); if (extension && !extension->name().empty()) { std::string name = extension->name(); name[0] = std::tolower(name[0]); @@ -803,8 +807,8 @@ } } if (!arc_app_found) { - const auto* extension = extension_service_->GetExtensionById( - app, /*include_disabled=*/true); + const auto* extension = extension_registry_->GetExtensionById( + app, extensions::ExtensionRegistry::COMPATIBILITY); if (extension && !extension->name().empty()) { std::string name = extension->name(); name[0] = std::toupper(name[0]); @@ -964,6 +968,8 @@ // |item_delegate_manager_| owns |test_controller_|. ash::ShelfItemDelegate* test_controller_ = nullptr; + extensions::ExtensionRegistry* extension_registry_ = nullptr; + extensions::ExtensionService* extension_service_ = nullptr; app_list::AppListSyncableService* app_list_syncable_service_ = nullptr;
diff --git a/chrome/browser/ui/ash/wallpaper_controller_client.cc b/chrome/browser/ui/ash/wallpaper_controller_client.cc index 2ab8287..45707cc 100644 --- a/chrome/browser/ui/ash/wallpaper_controller_client.cc +++ b/chrome/browser/ui/ash/wallpaper_controller_client.cc
@@ -14,7 +14,6 @@ #include "chrome/browser/chromeos/customization/customization_wallpaper_util.h" #include "chrome/browser/chromeos/login/wizard_controller.h" #include "chrome/browser/chromeos/policy/device_local_account.h" -#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension_constants.h" @@ -22,11 +21,12 @@ #include "chromeos/constants/chromeos_switches.h" #include "chromeos/cryptohome/system_salt_getter.h" #include "chromeos/settings/cros_settings_names.h" +#include "components/prefs/pref_service.h" #include "components/session_manager/core/session_manager.h" #include "components/user_manager/known_user.h" #include "components/user_manager/user_manager.h" #include "content/public/common/service_manager_connection.h" -#include "extensions/browser/extension_system.h" +#include "extensions/browser/extension_registry.h" #include "extensions/common/constants.h" #include "services/service_manager/public/cpp/connector.h" @@ -482,13 +482,12 @@ void WallpaperControllerClient::OpenWallpaperPicker() { Profile* profile = ProfileManager::GetActiveUserProfile(); DCHECK(profile); - extensions::ExtensionService* service = - extensions::ExtensionSystem::Get(profile)->extension_service(); - if (!service) - return; + extensions::ExtensionRegistry* registry = + extensions::ExtensionRegistry::Get(profile); - const extensions::Extension* extension = service->GetExtensionById( - extension_misc::kWallpaperManagerId, false /*include_disabled=*/); + const extensions::Extension* extension = + registry->GetExtensionById(extension_misc::kWallpaperManagerId, + extensions::ExtensionRegistry::ENABLED); if (!extension) return;
diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h index efa2ac0..cb85d507 100644 --- a/chrome/browser/ui/browser_window.h +++ b/chrome/browser/ui/browser_window.h
@@ -32,7 +32,7 @@ #endif class Browser; -class ClickToCallDialog; +class SharingDialog; class ClickToCallSharingDialogController; class DownloadShelf; class ExclusiveAccessContext; @@ -332,7 +332,7 @@ virtual bool IsToolbarShowing() const = 0; // Shows the Click to Call dialog. - virtual ClickToCallDialog* ShowClickToCallDialog( + virtual SharingDialog* ShowClickToCallDialog( content::WebContents* contents, ClickToCallSharingDialogController* controller) = 0;
diff --git a/chrome/browser/ui/cocoa/main_menu_builder.mm b/chrome/browser/ui/cocoa/main_menu_builder.mm index 158d636..cf931785 100644 --- a/chrome/browser/ui/cocoa/main_menu_builder.mm +++ b/chrome/browser/ui/cocoa/main_menu_builder.mm
@@ -365,24 +365,9 @@ .tag(IDC_MAXIMIZE_WINDOW) .action(@selector(performZoom:)), Item().is_separator(), - Item(IDS_NEXT_TAB_MAC) - .command_id(IDC_SELECT_NEXT_TAB) - .remove_if(is_pwa), - Item(IDS_PREV_TAB_MAC) - .command_id(IDC_SELECT_PREVIOUS_TAB) - .remove_if(is_pwa), Item(IDS_SHOW_AS_TAB) .command_id(IDC_SHOW_AS_TAB) .remove_if(is_pwa), - Item(IDS_DUPLICATE_TAB_MAC) - .command_id(IDC_DUPLICATE_TAB) - .remove_if(is_pwa), - Item(IDS_MUTE_SITE_MAC) - .command_id(IDC_WINDOW_MUTE_SITE) - .remove_if(is_pwa), - Item(IDS_PIN_TAB_MAC) - .command_id(IDC_WINDOW_PIN_TAB) - .remove_if(is_pwa), Item().is_separator().remove_if(is_pwa), Item(IDS_SHOW_DOWNLOADS_MAC) .command_id(IDC_SHOW_DOWNLOADS) @@ -404,6 +389,29 @@ return item; } +base::scoped_nsobject<NSMenuItem> BuildTabMenu( + NSApplication* nsapp, + id app_delegate, + const base::string16& product_name, + bool is_pwa) { + if (is_pwa) + return base::scoped_nsobject<NSMenuItem>(); + + base::scoped_nsobject<NSMenuItem> item = + Item(IDS_TAB_MENU_MAC) + .tag(IDC_TAB_MENU) + .submenu({ + Item(IDS_NEXT_TAB_MAC).command_id(IDC_SELECT_NEXT_TAB), + Item(IDS_PREV_TAB_MAC).command_id(IDC_SELECT_PREVIOUS_TAB), + Item(IDS_DUPLICATE_TAB_MAC).command_id(IDC_DUPLICATE_TAB), + Item(IDS_MUTE_SITE_MAC).command_id(IDC_WINDOW_MUTE_SITE), + Item(IDS_PIN_TAB_MAC).command_id(IDC_WINDOW_PIN_TAB), + Item().is_separator(), + }) + .Build(); + return item; +} + base::scoped_nsobject<NSMenuItem> BuildHelpMenu( NSApplication* nsapp, id app_delegate, @@ -438,9 +446,9 @@ using Builder = base::scoped_nsobject<NSMenuItem> (*)( NSApplication*, id, const base::string16&, bool); static const Builder kBuilderFuncs[] = { - &BuildAppMenu, &BuildFileMenu, &BuildEditMenu, - &BuildViewMenu, &BuildHistoryMenu, &BuildBookmarksMenu, - &BuildPeopleMenu, &BuildWindowMenu, &BuildHelpMenu, + &BuildAppMenu, &BuildFileMenu, &BuildEditMenu, &BuildViewMenu, + &BuildHistoryMenu, &BuildBookmarksMenu, &BuildPeopleMenu, &BuildTabMenu, + &BuildWindowMenu, &BuildHelpMenu, }; for (auto* builder : kBuilderFuncs) { auto item = builder(nsapp, app_delegate, product_name, is_pwa);
diff --git a/chrome/browser/ui/cocoa/tab_menu_bridge.h b/chrome/browser/ui/cocoa/tab_menu_bridge.h new file mode 100644 index 0000000..9e037d1 --- /dev/null +++ b/chrome/browser/ui/cocoa/tab_menu_bridge.h
@@ -0,0 +1,72 @@ +// Copyright 2019 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 CHROME_BROWSER_UI_COCOA_TAB_MENU_BRIDGE_H_ +#define CHROME_BROWSER_UI_COCOA_TAB_MENU_BRIDGE_H_ + +#include "base/gtest_prod_util.h" +#include "base/mac/scoped_nsobject.h" +#include "base/macros.h" +#include "chrome/browser/ui/tabs/tab_strip_model_observer.h" + +@class NSMenuItem; +@class TabMenuListener; +class TabStripModel; + +// A TabMenuBridge bidirectionally connects a list of tabs (represented by a +// TabStripModel) to an NSMenu, for use in the system menu bar. Specifically, +// the TabStripBridge appends items to the bottom of the provided NSMenu +// corresponding to tabs in the TabStripModel, and keeps those items +// synchronized with changes to the TabStripModel. Clicking one of these items +// activates the corresponding tab in the TabStripModel. This class assumes +// that: +// 1) It owns the bottom "dynamic" part of of the provided menu +// 2) The number of items not in the "dynamic" part does not change after the +// TabMenuBridge is constructed +// +// To use this class, construct an instance and call BuildMenu() on it. +class TabMenuBridge : public TabStripModelObserver { + public: + // The |menu_item| contains the actual menu this class manages. + TabMenuBridge(TabStripModel* model, NSMenuItem* menu_item); + ~TabMenuBridge() override; + + // It's legal to call this method more than once - it will clear all the + // existing dynamic items added by this instance before adding any new ones, + // so multiple calls are idempotent. + void BuildMenu(); + + private: + FRIEND_TEST_ALL_PREFIXES(TabMenuBridgeTest, ClickingMenuActivatesTab); + + // These methods are used to make batch changes to the menu. + void RemoveAllDynamicItems(); + void AddDynamicItemsFromModel(); + + // This method exists to be called back into from the Cocoa part of this + // bridge class (TabMenuListener). + void OnDynamicItemChosen(NSMenuItem* item); + + // TabStripModelObserver: + void OnTabStripModelChanged( + TabStripModel* tab_strip_model, + const TabStripModelChange& change, + const TabStripSelectionChange& selection) override; + void TabChangedAt(content::WebContents* contents, + int index, + TabChangeType change_type) override; + + TabStripModel* model_; + NSMenuItem* menu_item_; // weak + base::scoped_nsobject<TabMenuListener> menu_listener_; + + // When created, this class remembers how many items were present in the + // non-dynamic section of the menu. This offset is used to map menu items to + // their underlying tabs. + int dynamic_items_start_; + + DISALLOW_COPY_AND_ASSIGN(TabMenuBridge); +}; + +#endif // CHROME_BROWSER_UI_COCOA_TAB_MENU_BRIDGE_H_
diff --git a/chrome/browser/ui/cocoa/tab_menu_bridge.mm b/chrome/browser/ui/cocoa/tab_menu_bridge.mm new file mode 100644 index 0000000..b2f74204 --- /dev/null +++ b/chrome/browser/ui/cocoa/tab_menu_bridge.mm
@@ -0,0 +1,138 @@ +// Copyright 2019 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/ui/cocoa/tab_menu_bridge.h" + +#import <Cocoa/Cocoa.h> + +#include "base/callback.h" +#include "base/mac/scoped_nsobject.h" +#include "base/strings/sys_string_conversions.h" +#include "chrome/browser/ui/tab_ui_helper.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" + +using MenuItemCallback = base::RepeatingCallback<void(NSMenuItem*)>; + +namespace { + +void UpdateItemForWebContents(NSMenuItem* item, + content::WebContents* web_contents) { + TabUIHelper* tab_ui_helper = TabUIHelper::FromWebContents(web_contents); + + item.title = base::SysUTF16ToNSString(tab_ui_helper->GetTitle()); + item.image = tab_ui_helper->GetFavicon().AsNSImage(); +} + +} // namespace + +@interface TabMenuListener : NSObject +- (instancetype)initWithCallback:(MenuItemCallback)callback; +- (void)activateTab:(id)sender; +@end + +@implementation TabMenuListener { + MenuItemCallback callback_; +} + +- (instancetype)initWithCallback:(MenuItemCallback)callback { + if ((self = [super init])) { + callback_ = callback; + } + return self; +} + +- (IBAction)activateTab:(id)sender { + callback_.Run(sender); +} +@end + +TabMenuBridge::TabMenuBridge(TabStripModel* model, NSMenuItem* menu_item) + : model_(model), menu_item_(menu_item) { + menu_listener_.reset([[TabMenuListener alloc] + initWithCallback:base::Bind(&TabMenuBridge::OnDynamicItemChosen, + // Unretained is safe here: this class owns + // MenuListener, which holds the callback + // being constructed here, so the callback + // will be destructed before this class. + base::Unretained(this))]); + model_->AddObserver(this); +} + +TabMenuBridge::~TabMenuBridge() { + model_->RemoveObserver(this); + RemoveAllDynamicItems(); +} + +void TabMenuBridge::BuildMenu() { + RemoveAllDynamicItems(); + AddDynamicItemsFromModel(); +} + +void TabMenuBridge::RemoveAllDynamicItems() { + for (NSMenuItem* item in menu_item_.submenu.itemArray) { + if (item.target == menu_listener_.get()) + [menu_item_.submenu removeItem:item]; + } +} + +void TabMenuBridge::AddDynamicItemsFromModel() { + dynamic_items_start_ = menu_item_.submenu.numberOfItems; + for (int i = 0; i < model_->count(); ++i) { + base::scoped_nsobject<NSMenuItem> item([[NSMenuItem alloc] + initWithTitle:@"" + action:@selector(activateTab:) + keyEquivalent:@""]); + [item setTarget:menu_listener_.get()]; + UpdateItemForWebContents(item, model_->GetWebContentsAt(i)); + [menu_item_.submenu addItem:item.get()]; + } +} + +void TabMenuBridge::OnDynamicItemChosen(NSMenuItem* item) { + DCHECK_EQ(item.target, menu_listener_.get()); + int index = [menu_item_.submenu indexOfItem:item] - dynamic_items_start_; + model_->ActivateTabAt(index, TabStripModel::UserGestureDetails( + TabStripModel::GestureType::kTabMenu)); +} + +void TabMenuBridge::OnTabStripModelChanged( + TabStripModel* tab_strip_model, + const TabStripModelChange& change, + const TabStripSelectionChange& selection) { + DCHECK_EQ(tab_strip_model, model_); + + // Rather than doing clever updating from |change|, just destroy the dynamic + // menu items and re-add them. + RemoveAllDynamicItems(); + AddDynamicItemsFromModel(); +} + +void TabMenuBridge::TabChangedAt(content::WebContents* contents, + int index, + TabChangeType change_type) { + // Ignore loading state changes - they happen very often during page load and + // are used to drive the load spinner, which is not interesting to this menu. + if (change_type == TabChangeType::kLoadingOnly) + return; + + int menu_index = index + dynamic_items_start_; + + // It might seem like this can't happen but actually it can: + // 1) Someone calls TabMenuModel::AddWebContents + // 2) Some other observer (not this) is notified of the add + // 3) That observer responds by doing something that eventually leads into + // UpdateWebContentsStateAt, while this class still hasn't observed the + // OnTabStripModelChanged (but the method that will notify us is on the + // stack) + // 4) That UpdateWebContentsStateAt causes this object to observe a + // TabChangedAt for an index it hasn't yet been informed exists + // As such, this code early-outs instead of DCHECKing. The newly-added + // WebContents will be picked up later anyway when this object does get + // notified of the addition. + if (menu_index < 0 || menu_index >= menu_item_.submenu.numberOfItems) + return; + + NSMenuItem* item = [menu_item_.submenu itemAtIndex:menu_index]; + UpdateItemForWebContents(item, contents); +}
diff --git a/chrome/browser/ui/cocoa/tab_menu_bridge_unittest.mm b/chrome/browser/ui/cocoa/tab_menu_bridge_unittest.mm new file mode 100644 index 0000000..9711b18 --- /dev/null +++ b/chrome/browser/ui/cocoa/tab_menu_bridge_unittest.mm
@@ -0,0 +1,220 @@ +// Copyright 2019 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 "testing/gtest/include/gtest/gtest.h" + +#import <Cocoa/Cocoa.h> + +#include "base/mac/scoped_nsobject.h" +#include "base/strings/sys_string_conversions.h" +#include "base/strings/utf_string_conversions.h" +#include "base/test/scoped_task_environment.h" +#include "chrome/browser/favicon/favicon_utils.h" +#include "chrome/browser/ui/cocoa/tab_menu_bridge.h" +#include "chrome/browser/ui/tab_ui_helper.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" +#include "chrome/browser/ui/tabs/test_tab_strip_model_delegate.h" +#include "chrome/test/base/testing_profile.h" +#include "content/public/test/test_renderer_host.h" +#include "content/public/test/web_contents_tester.h" +#include "testing/gtest_mac.h" + +constexpr int kStaticItemCount = 4; + +class TabStripModelUiHelperDelegate : public TestTabStripModelDelegate { + public: + void WillAddWebContents(content::WebContents* contents) override { + TestTabStripModelDelegate::WillAddWebContents(contents); + + favicon::CreateContentFaviconDriverForWebContents(contents); + TabUIHelper::CreateForWebContents(contents); + } +}; + +class TabMenuBridgeTest : public ::testing::Test { + public: + void SetUp() override { + profile_ = std::make_unique<TestingProfile>(); + rvh_test_enabler_ = std::make_unique<content::RenderViewHostTestEnabler>(); + delegate_ = std::make_unique<TabStripModelUiHelperDelegate>(); + model_ = std::make_unique<TabStripModel>(delegate_.get(), nullptr); + menu_root_.reset(ItemWithTitle(@"Tab")); + menu_.reset([[NSMenu alloc] initWithTitle:@"Tab"]); + menu_root_.get().submenu = menu_.get(); + + AddStaticItems(menu_.get()); + } + + void TearDown() override { model_->CloseAllTabs(); } + + NSMenuItem* menu_root() { return menu_root_.get(); } + NSMenu* menu() { return menu_.get(); } + TabStripModel* model() { return model_.get(); } + TabStripModelDelegate* delegate() { return delegate_.get(); } + + void AddStaticItems(NSMenu* menu) { + [menu_ addItem:ItemWithTitle(@"Static 1")]; + [menu_ addItem:ItemWithTitle(@"Static 2")]; + [menu_ addItem:ItemWithTitle(@"Static 3")]; + [menu_ addItem:SeparatorItem()]; + } + + std::unique_ptr<content::WebContents> CreateWebContents( + const std::string& title) { + std::unique_ptr<content::WebContents> contents = + content::WebContentsTester::CreateTestWebContents(profile_.get(), + nullptr); + content::WebContentsTester::For(contents.get()) + ->SetTitle(base::UTF8ToUTF16(title)); + return contents; + } + + void AddModelTabNamed(const std::string& name) { + model()->AppendWebContents(CreateWebContents(name), true); + } + + int ModelIndexForTabNamed(const std::string& name) { + base::string16 title16 = base::UTF8ToUTF16(name); + for (int i = 0; i < model()->count(); ++i) { + if (model()->GetWebContentsAt(i)->GetTitle() == title16) + return i; + } + return -1; + } + + void RemoveModelTabNamed(const std::string& name) { + int index = ModelIndexForTabNamed(name); + DCHECK(index >= 0); + model()->CloseWebContentsAt(index, TabStripModel::CLOSE_NONE); + } + + void RenameModelTabNamed(const std::string& old_name, + const std::string& new_name) { + int index = ModelIndexForTabNamed(old_name); + if (index >= 0) { + content::WebContents* contents = model()->GetWebContentsAt(index); + content::WebContentsTester::For(contents)->SetTitle( + base::UTF8ToUTF16(new_name)); + // The way WebContentsTester updates the title avoids the usual + // notification mechanism for TabStripModel, so manually synthesize the + // update notification here. + model()->UpdateWebContentsStateAt(index, TabChangeType::kAll); + } + } + + NSMenuItem* MenuItemForTabNamed(const std::string& name) { + return [menu() itemWithTitle:base::SysUTF8ToNSString(name)]; + } + + void ExpectDynamicTabsInMenuAre(const std::vector<std::string>& titles) { + std::vector<std::string> actual_titles; + for (int i = kStaticItemCount; i < menu().numberOfItems; ++i) { + actual_titles.push_back( + base::SysNSStringToUTF8([menu() itemAtIndex:i].title)); + } + + ASSERT_EQ(actual_titles.size(), titles.size()); + for (int i = 0; i < static_cast<int>(titles.size()); ++i) + EXPECT_EQ(actual_titles[i], titles[i]); + } + + std::string ActiveTabName() { + return base::UTF16ToUTF8(model()->GetActiveWebContents()->GetTitle()); + } + + private: + NSMenuItem* ItemWithTitle(NSString* title) { + return [[NSMenuItem alloc] initWithTitle:title + action:nil + keyEquivalent:@""]; + } + + NSMenuItem* SeparatorItem() { return [NSMenuItem separatorItem]; } + + content::TestBrowserThreadBundle test_browser_thread_bundle_; + + std::unique_ptr<TestingProfile> profile_; + std::unique_ptr<content::RenderViewHostTestEnabler> rvh_test_enabler_; + std::unique_ptr<TabStripModelUiHelperDelegate> delegate_; + std::unique_ptr<TabStripModel> model_; + base::scoped_nsobject<NSMenuItem> menu_root_; + base::scoped_nsobject<NSMenu> menu_; +}; + +TEST_F(TabMenuBridgeTest, CreatesBlankMenu) { + TabMenuBridge bridge(model(), menu_root()); + bridge.BuildMenu(); + EXPECT_EQ(menu().numberOfItems, kStaticItemCount); + ExpectDynamicTabsInMenuAre({}); +} + +TEST_F(TabMenuBridgeTest, TracksModelUpdates) { + TabMenuBridge bridge(model(), menu_root()); + bridge.BuildMenu(); + + AddModelTabNamed("Tab 1"); + AddModelTabNamed("Tab 2"); + AddModelTabNamed("Tab 3"); + ExpectDynamicTabsInMenuAre({"Tab 1", "Tab 2", "Tab 3"}); + + RemoveModelTabNamed("Tab 2"); + ExpectDynamicTabsInMenuAre({"Tab 1", "Tab 3"}); + + AddModelTabNamed("Tab 2"); + ExpectDynamicTabsInMenuAre({"Tab 1", "Tab 3", "Tab 2"}); + + RenameModelTabNamed("Tab 1", "Tab 4"); + ExpectDynamicTabsInMenuAre({"Tab 4", "Tab 3", "Tab 2"}); +} + +TEST_F(TabMenuBridgeTest, ClickingMenuActivatesTab) { + TabMenuBridge bridge(model(), menu_root()); + bridge.BuildMenu(); + + AddModelTabNamed("Tab 1"); + AddModelTabNamed("Tab 2"); + EXPECT_EQ(ActiveTabName(), "Tab 2"); + + NSMenuItem* tab1_item = MenuItemForTabNamed("Tab 1"); + + // Don't go through NSMenuItem's normal click-dispatching machinery here - it + // would add flake potential to this test without improving coverage. Instead, + // call straight through to the C++-side callback: + bridge.OnDynamicItemChosen(tab1_item); + EXPECT_EQ(ActiveTabName(), "Tab 1"); + + // Activation does not re-order the menu. + ExpectDynamicTabsInMenuAre({"Tab 1", "Tab 2"}); +} + +// This is a regression test for a bug found during development. Previous +// versions of TabMenuBridge had an RAII-like API where creating a TabMenuBridge +// would fill in the dynamic menu during construction. Combining this with the +// common pattern of: +// tab_menu_bridge_ = std::make_unique<TabMenuBridge>(...); +// in the presence of an existing tab_menu_bridge_ led to there temporarily +// being two TabMenuBridge instances at a time, meaning both of them had their +// dynamic menu items installed. This, in turn, confused the menu index logic in +// the new TabMenuBridge - it counted the old TabMenuBridge's dynamic items as +// static items, and ended up with incorrect indexes. This test exercises that +// behavior. +TEST_F(TabMenuBridgeTest, SwappingBridgeRecreatesMenu) { + auto bridge = std::make_unique<TabMenuBridge>(model(), menu_root()); + bridge->BuildMenu(); + + AddModelTabNamed("Tab 1"); + + auto model2 = std::make_unique<TabStripModel>(delegate(), nullptr); + model2->AppendWebContents(CreateWebContents("Tab 2"), true); + + bridge = std::make_unique<TabMenuBridge>(model2.get(), menu_root()); + bridge->BuildMenu(); + ExpectDynamicTabsInMenuAre({"Tab 2"}); + + // Simulate one of the tabs in the model being updated - if the computed + // indexes are wrong, this call will DCHECK. + model2->UpdateWebContentsStateAt(0, TabChangeType::kAll); + + model2->CloseAllTabs(); +}
diff --git a/chrome/browser/ui/extensions/application_launch.cc b/chrome/browser/ui/extensions/application_launch.cc index ade9f90..5dcf424 100644 --- a/chrome/browser/ui/extensions/application_launch.cc +++ b/chrome/browser/ui/extensions/application_launch.cc
@@ -59,6 +59,7 @@ using extensions::Extension; using extensions::ExtensionPrefs; using extensions::ExtensionRegistry; +using extensions::ExtensionService; namespace { @@ -66,11 +67,13 @@ // This class manages its own lifetime. class EnableViaDialogFlow : public ExtensionEnableFlowDelegate { public: - EnableViaDialogFlow(extensions::ExtensionService* service, + EnableViaDialogFlow(ExtensionService* service, + ExtensionRegistry* registry, Profile* profile, const std::string& extension_id, const base::Closure& callback) : service_(service), + registry_(registry), profile_(profile), extension_id_(extension_id), callback_(callback) {} @@ -87,7 +90,7 @@ // ExtensionEnableFlowDelegate overrides. void ExtensionEnableFlowFinished() override { const Extension* extension = - service_->GetExtensionById(extension_id_, false); + registry_->GetExtensionById(extension_id_, ExtensionRegistry::ENABLED); if (!extension) return; callback_.Run(); @@ -96,7 +99,8 @@ void ExtensionEnableFlowAborted(bool user_initiated) override { delete this; } - extensions::ExtensionService* service_; + ExtensionService* service_; + ExtensionRegistry* registry_; Profile* profile_; std::string extension_id_; base::Closure callback_; @@ -448,19 +452,20 @@ return; Profile* profile = params.profile; - extensions::ExtensionService* service = + ExtensionService* service = extensions::ExtensionSystem::Get(profile)->extension_service(); + ExtensionRegistry* registry = ExtensionRegistry::Get(profile); if (!service->IsExtensionEnabled(extension->id()) || - extensions::ExtensionRegistry::Get(profile)->GetExtensionById( - extension->id(), extensions::ExtensionRegistry::TERMINATED)) { - base::Callback<gfx::NativeWindow(void)> dialog_parent_window_getter; - // TODO(pkotwicz): Figure out which window should be used as the parent for - // the "enable application" dialog in Athena. - (new EnableViaDialogFlow( - service, profile, extension->id(), - base::Bind(base::IgnoreResult(OpenEnabledApplication), params))) - ->Run(); - return; + registry->GetExtensionById(extension->id(), + ExtensionRegistry::TERMINATED)) { + base::Callback<gfx::NativeWindow(void)> dialog_parent_window_getter; + // TODO(pkotwicz): Figure out which window should be used as the parent for + // the "enable application" dialog in Athena. + (new EnableViaDialogFlow( + service, registry, profile, extension->id(), + base::Bind(base::IgnoreResult(OpenEnabledApplication), params))) + ->Run(); + return; } OpenEnabledApplication(params);
diff --git a/chrome/browser/ui/extensions/extension_enable_flow.cc b/chrome/browser/ui/extensions/extension_enable_flow.cc index e3e758c..3315e33 100644 --- a/chrome/browser/ui/extensions/extension_enable_flow.cc +++ b/chrome/browser/ui/extensions/extension_enable_flow.cc
@@ -59,9 +59,12 @@ void ExtensionEnableFlow::Run() { extensions::ExtensionService* service = extensions::ExtensionSystem::Get(profile_)->extension_service(); - const Extension* extension = service->GetExtensionById(extension_id_, true); + extensions::ExtensionRegistry* registry = + extensions::ExtensionRegistry::Get(profile_); + const Extension* extension = registry->GetExtensionById( + extension_id_, extensions::ExtensionRegistry::COMPATIBILITY); if (!extension) { - extension = extensions::ExtensionRegistry::Get(profile_)->GetExtensionById( + extension = registry->GetExtensionById( extension_id_, extensions::ExtensionRegistry::TERMINATED); // It's possible (though unlikely) the app could have been uninstalled since // the user clicked on it. @@ -71,7 +74,8 @@ service->ReloadExtension(extension_id_); // ReloadExtension reallocates the Extension object. - extension = service->GetExtensionById(extension_id_, true); + extension = registry->GetExtensionById( + extension_id_, extensions::ExtensionRegistry::COMPATIBILITY); // |extension| could be NULL for asynchronous load, such as the case of // an unpacked extension. Wait for the load to continue the flow. @@ -88,7 +92,10 @@ extensions::ExtensionSystem* system = extensions::ExtensionSystem::Get(profile_); extensions::ExtensionService* service = system->extension_service(); - const Extension* extension = service->GetExtensionById(extension_id_, true); + extensions::ExtensionRegistry* registry = + extensions::ExtensionRegistry::Get(profile_); + const Extension* extension = registry->GetExtensionById( + extension_id_, extensions::ExtensionRegistry::COMPATIBILITY); bool abort = !extension || @@ -184,10 +191,12 @@ if (result == ExtensionInstallPrompt::Result::ACCEPTED) { extensions::ExtensionService* service = extensions::ExtensionSystem::Get(profile_)->extension_service(); - + extensions::ExtensionRegistry* registry = + extensions::ExtensionRegistry::Get(profile_); // The extension can be uninstalled in another window while the UI was // showing. Treat it as a cancellation and notify |delegate_|. - const Extension* extension = service->GetExtensionById(extension_id_, true); + const Extension* extension = registry->GetExtensionById( + extension_id_, extensions::ExtensionRegistry::COMPATIBILITY); if (!extension) { delegate_->ExtensionEnableFlowAborted(true); return;
diff --git a/chrome/browser/ui/page_info/page_info.cc b/chrome/browser/ui/page_info/page_info.cc index 5454847c..138cd34 100644 --- a/chrome/browser/ui/page_info/page_info.cc +++ b/chrome/browser/ui/page_info/page_info.cc
@@ -129,6 +129,7 @@ CONTENT_SETTINGS_TYPE_USB_GUARD, #if !defined(OS_ANDROID) CONTENT_SETTINGS_TYPE_SERIAL_GUARD, + CONTENT_SETTINGS_TYPE_NATIVE_FILE_SYSTEM_WRITE_GUARD, #endif CONTENT_SETTINGS_TYPE_BLUETOOTH_SCANNING, }; @@ -186,6 +187,10 @@ // gets checked there regardless of default setting on Desktop. if (info.type == CONTENT_SETTINGS_TYPE_GEOLOCATION) return true; + + // The Native File System write permission is desktop only at the moment. + if (info.type == CONTENT_SETTINGS_TYPE_NATIVE_FILE_SYSTEM_WRITE_GUARD) + return false; #else // Flash is shown if the user has ever changed its setting for |site_url|. if (info.type == CONTENT_SETTINGS_TYPE_PLUGINS && @@ -194,12 +199,17 @@ std::string(), nullptr) != nullptr) { return true; } -#endif -#if !defined(OS_ANDROID) // Autoplay is Android-only at the moment. if (info.type == CONTENT_SETTINGS_TYPE_AUTOPLAY) return false; + + // Only display the Native File System write permission if it's currently + // being used. + if (info.type == CONTENT_SETTINGS_TYPE_NATIVE_FILE_SYSTEM_WRITE_GUARD && + web_contents->HasWritableNativeFileSystemHandles()) { + return true; + } #endif // Show the content setting if it has been changed by the user since the last
diff --git a/chrome/browser/ui/page_info/page_info_ui.cc b/chrome/browser/ui/page_info/page_info_ui.cc index 2cdb7e0f..ffd5b70 100644 --- a/chrome/browser/ui/page_info/page_info_ui.cc +++ b/chrome/browser/ui/page_info/page_info_ui.cc
@@ -176,6 +176,8 @@ #if !defined(OS_ANDROID) {CONTENT_SETTINGS_TYPE_SERIAL_GUARD, IDS_PAGE_INFO_TYPE_SERIAL}, #endif + {CONTENT_SETTINGS_TYPE_NATIVE_FILE_SYSTEM_WRITE_GUARD, + IDS_PAGE_INFO_TYPE_NATIVE_FILE_SYSTEM_WRITE}, {CONTENT_SETTINGS_TYPE_BLUETOOTH_SCANNING, IDS_PAGE_INFO_TYPE_BLUETOOTH_SCANNING}, }; @@ -579,6 +581,9 @@ case CONTENT_SETTINGS_TYPE_BLUETOOTH_SCANNING: icon = &vector_icons::kBluetoothScanningIcon; break; + case CONTENT_SETTINGS_TYPE_NATIVE_FILE_SYSTEM_WRITE_GUARD: + icon = &kSaveOriginalFileIcon; + break; default: // All other |ContentSettingsType|s do not have icons on desktop or are // not shown in the Page Info bubble.
diff --git a/chrome/browser/ui/page_info/permission_menu_model.cc b/chrome/browser/ui/page_info/permission_menu_model.cc index e4530165..e83ae4c2 100644 --- a/chrome/browser/ui/page_info/permission_menu_model.cc +++ b/chrome/browser/ui/page_info/permission_menu_model.cc
@@ -74,34 +74,35 @@ } bool PermissionMenuModel::ShouldShowAllow(const GURL& url) { - // Notifications does not support CONTENT_SETTING_ALLOW in incognito. - if (permission_.is_incognito && - permission_.type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { - return false; + switch (permission_.type) { + // Notifications does not support CONTENT_SETTING_ALLOW in incognito. + case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: + return !permission_.is_incognito; + // Media only supports CONTENT_SETTING_ALLOW for secure origins. + case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC: + case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: + return content::IsOriginSecure(url); + // Chooser permissions do not support CONTENT_SETTING_ALLOW. + case CONTENT_SETTINGS_TYPE_SERIAL_GUARD: + case CONTENT_SETTINGS_TYPE_USB_GUARD: + // Bluetooth scanning does not support CONTENT_SETTING_ALLOW. + case CONTENT_SETTINGS_TYPE_BLUETOOTH_SCANNING: + // Native file system write does not support CONTENT_SETTING_ALLOW. + case CONTENT_SETTINGS_TYPE_NATIVE_FILE_SYSTEM_WRITE_GUARD: + return false; + default: + return true; } - - // Media only supports CONTENT_SETTING_ALLOW for secure origins. - if ((permission_.type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || - permission_.type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) && - !content::IsOriginSecure(url)) { - return false; - } - - // Chooser permissions do not support CONTENT_SETTING_ALLOW. - if (permission_.type == CONTENT_SETTINGS_TYPE_SERIAL_GUARD || - permission_.type == CONTENT_SETTINGS_TYPE_USB_GUARD) { - return false; - } - - // Bluetooth scanning permission does not support CONTENT_SETTING_ALLOW. - if (permission_.type == CONTENT_SETTINGS_TYPE_BLUETOOTH_SCANNING) - return false; - - return true; } bool PermissionMenuModel::ShouldShowAsk(const GURL& url) { - return permission_.type == CONTENT_SETTINGS_TYPE_USB_GUARD || - permission_.type == CONTENT_SETTINGS_TYPE_SERIAL_GUARD || - permission_.type == CONTENT_SETTINGS_TYPE_BLUETOOTH_SCANNING; + switch (permission_.type) { + case CONTENT_SETTINGS_TYPE_USB_GUARD: + case CONTENT_SETTINGS_TYPE_SERIAL_GUARD: + case CONTENT_SETTINGS_TYPE_BLUETOOTH_SCANNING: + case CONTENT_SETTINGS_TYPE_NATIVE_FILE_SYSTEM_WRITE_GUARD: + return true; + default: + return false; + } }
diff --git a/chrome/browser/ui/prefs/pref_watcher.cc b/chrome/browser/ui/prefs/pref_watcher.cc index 44cffec..6bad7aae 100644 --- a/chrome/browser/ui/prefs/pref_watcher.cc +++ b/chrome/browser/ui/prefs/pref_watcher.cc
@@ -39,10 +39,10 @@ prefs::kAccessibilityCaptionsBackgroundOpacity, #if defined(OS_ANDROID) prefs::kWebKitFontScaleFactor, - prefs::kWebKitForceDarkModeEnabled, prefs::kWebKitForceEnableZoom, prefs::kWebKitPasswordEchoEnabled, #endif + prefs::kWebKitForceDarkModeEnabled, prefs::kWebKitJavascriptEnabled, prefs::kWebKitLoadsImagesAutomatically, prefs::kWebKitMinimumFontSize,
diff --git a/chrome/browser/ui/prefs/prefs_tab_helper.cc b/chrome/browser/ui/prefs/prefs_tab_helper.cc index 0d27cee..4db5bb4 100644 --- a/chrome/browser/ui/prefs/prefs_tab_helper.cc +++ b/chrome/browser/ui/prefs/prefs_tab_helper.cc
@@ -42,6 +42,7 @@ #include "content/public/common/web_preferences.h" #include "extensions/buildflags/buildflags.h" #include "media/media_buildflags.h" +#include "third_party/blink/public/common/features.h" #include "third_party/blink/public/mojom/renderer_preferences.mojom.h" #include "third_party/icu/source/common/unicode/uchar.h" #include "third_party/icu/source/common/unicode/uscript.h" @@ -359,14 +360,14 @@ pref_defaults.force_enable_zoom); registry->RegisterBooleanPref(prefs::kWebKitPasswordEchoEnabled, pref_defaults.password_echo_enabled); +#endif bool force_dark_mode_enabled = - base::FeatureList::IsEnabled(chrome::android::kAndroidWebContentsDarkMode) + base::FeatureList::IsEnabled(blink::features::kForceWebContentsDarkMode) ? true : pref_defaults.force_dark_mode_enabled; registry->RegisterBooleanPref(prefs::kWebKitForceDarkModeEnabled, force_dark_mode_enabled); -#endif registry->RegisterStringPref( prefs::kDefaultCharset, l10n_util::GetStringUTF8(IDS_DEFAULT_ENCODING),
diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc index c0f9406..bbbb7b7 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
@@ -21,7 +21,6 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/extension_browsertest.h" -#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/launch_util.h" #include "chrome/browser/first_run/first_run.h" #include "chrome/browser/infobars/infobar_service.h" @@ -65,7 +64,7 @@ #include "content/public/common/content_switches.h" #include "content/public/test/test_navigation_observer.h" #include "content/public/test/test_utils.h" -#include "extensions/browser/extension_system.h" +#include "extensions/browser/extension_registry.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -172,11 +171,8 @@ const Extension** out_app_extension) { ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII(app_name.c_str()))); - extensions::ExtensionService* service = - extensions::ExtensionSystem::Get(browser()->profile()) - ->extension_service(); - *out_app_extension = service->GetExtensionById( - last_loaded_extension_id(), false); + *out_app_extension = extension_registry()->GetExtensionById( + last_loaded_extension_id(), extensions::ExtensionRegistry::ENABLED); ASSERT_TRUE(*out_app_extension); // Code that opens a new browser assumes we start with exactly one.
diff --git a/chrome/browser/ui/tabs/tab_strip_model.h b/chrome/browser/ui/tabs/tab_strip_model.h index f67ce57d..6cdf572 100644 --- a/chrome/browser/ui/tabs/tab_strip_model.h +++ b/chrome/browser/ui/tabs/tab_strip_model.h
@@ -206,7 +206,15 @@ // User gesture type that triggers ActivateTabAt. kNone indicates that it was // not triggered by a user gesture, but by a by-product of some other action. - enum class GestureType { kMouse, kTouch, kWheel, kKeyboard, kOther, kNone }; + enum class GestureType { + kMouse, + kTouch, + kWheel, + kKeyboard, + kOther, + kTabMenu, + kNone + }; // Encapsulates user gesture information for tab activation struct UserGestureDetails {
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc index 2746faa..5337cb7 100644 --- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc +++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views_unittest.cc
@@ -18,6 +18,7 @@ #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_header_panel.h" #include "chrome/test/base/browser_with_test_window_test.h" #include "chrome/test/base/testing_profile.h" +#include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" #include "extensions/common/constants.h" #include "testing/gtest/include/gtest/gtest.h" @@ -135,9 +136,8 @@ void ShowAppInfoForProfile(const std::string& app_id, Profile* profile) { const extensions::Extension* extension = - extensions::ExtensionSystem::Get(profile) - ->extension_service() - ->GetExtensionById(app_id, true); + extensions::ExtensionRegistry::Get(profile)->GetExtensionById( + app_id, extensions::ExtensionRegistry::COMPATIBILITY); DCHECK(extension); DCHECK(!widget_);
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.cc index f882522..1e97c39 100644 --- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.cc +++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_panel.cc
@@ -12,13 +12,12 @@ #include "base/callback_forward.h" #include "base/logging.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/launch_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/grit/generated_resources.h" #include "extensions/browser/extension_prefs.h" -#include "extensions/browser/extension_system.h" +#include "extensions/browser/extension_registry.h" #include "extensions/browser/path_util.h" #include "extensions/common/constants.h" #include "extensions/common/extension.h" @@ -309,15 +308,16 @@ return std::vector<GURL>(); std::vector<GURL> license_urls; - extensions::ExtensionService* service = - extensions::ExtensionSystem::Get(profile_)->extension_service(); - DCHECK(service); + extensions::ExtensionRegistry* registry = + extensions::ExtensionRegistry::Get(profile_); + DCHECK(registry); const std::vector<extensions::SharedModuleInfo::ImportInfo>& imports = extensions::SharedModuleInfo::GetImports(app_); for (const auto& shared_module : imports) { - const extensions::Extension* imported_module = - service->GetExtensionById(shared_module.extension_id, true); + const extensions::Extension* imported_module = registry->GetExtensionById( + shared_module.extension_id, + extensions::ExtensionRegistry::COMPATIBILITY); DCHECK(imported_module); GURL about_page = extensions::ManifestURL::GetAboutPage(imported_module);
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index c7caabc..5811a04 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -1401,7 +1401,7 @@ return bubble; } -ClickToCallDialog* BrowserView::ShowClickToCallDialog( +SharingDialog* BrowserView::ShowClickToCallDialog( content::WebContents* web_contents, ClickToCallSharingDialogController* controller) { auto* dialog_view = new ClickToCallDialogView(
diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h index 6dbea2d..e714fc9 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h
@@ -360,7 +360,7 @@ bool IsTabStripEditable() const override; bool IsToolbarVisible() const override; bool IsToolbarShowing() const override; - ClickToCallDialog* ShowClickToCallDialog( + SharingDialog* ShowClickToCallDialog( content::WebContents* contents, ClickToCallSharingDialogController* controller) override; void ShowUpdateChromeDialog() override;
diff --git a/chrome/browser/ui/views/sharing/click_to_call/click_to_call_dialog_view.h b/chrome/browser/ui/views/sharing/click_to_call/click_to_call_dialog_view.h index 6e5a6e0..d822fc3 100644 --- a/chrome/browser/ui/views/sharing/click_to_call/click_to_call_dialog_view.h +++ b/chrome/browser/ui/views/sharing/click_to_call/click_to_call_dialog_view.h
@@ -8,9 +8,9 @@ #include <memory> #include <vector> -#include "chrome/browser/sharing/click_to_call/click_to_call_dialog.h" #include "chrome/browser/sharing/click_to_call/click_to_call_sharing_dialog_controller.h" #include "chrome/browser/sharing/sharing_device_info.h" +#include "chrome/browser/sharing/sharing_dialog.h" #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.h" #include "ui/views/controls/button/button.h" #include "ui/views/controls/styled_label_listener.h" @@ -23,7 +23,7 @@ class Browser; class HoverButton; -class ClickToCallDialogView : public ClickToCallDialog, +class ClickToCallDialogView : public SharingDialog, public views::ButtonListener, public views::StyledLabelListener, public LocationBarBubbleDelegateView {
diff --git a/chrome/browser/ui/views/tooltip/tooltip_aura_interactive_uitest_win.cc b/chrome/browser/ui/views/tooltip/tooltip_aura_interactive_uitest_win.cc index d13e45a6..de9fab33 100644 --- a/chrome/browser/ui/views/tooltip/tooltip_aura_interactive_uitest_win.cc +++ b/chrome/browser/ui/views/tooltip/tooltip_aura_interactive_uitest_win.cc
@@ -29,7 +29,8 @@ } }; -IN_PROC_BROWSER_TEST_F(TooltipAuraUiaTest, TooltipUiaEvents) { +// Flakily tests: http://crbug.com/990214 +IN_PROC_BROWSER_TEST_F(TooltipAuraUiaTest, DISABLED_TooltipUiaEvents) { // Setup accessibility waiter HWND window_handle = GetDesktopWindow(); UiaAccessibilityWaiterInfo opened_info = {
diff --git a/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc b/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc index 8b51693..b270bdb 100644 --- a/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc +++ b/chrome/browser/ui/webui/downloads/downloads_list_tracker.cc
@@ -21,14 +21,13 @@ #include "chrome/browser/download/download_item_model.h" #include "chrome/browser/download/download_query.h" #include "chrome/browser/extensions/api/downloads/downloads_api.h" -#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" #include "components/download/public/common/download_danger_type.h" #include "components/download/public/common/download_item.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/download_item_utils.h" #include "content/public/browser/download_manager.h" -#include "extensions/browser/extension_system.h" +#include "extensions/browser/extension_registry.h" #include "net/base/filename_util.h" #include "third_party/icu/source/i18n/unicode/datefmt.h" #include "ui/base/l10n/time_format.h" @@ -224,13 +223,11 @@ // Lookup the extension's current name() in case the user changed their // language. This won't work if the extension was uninstalled, so the name // might be the wrong language. - bool include_disabled = true; auto* profile = Profile::FromBrowserContext( content::DownloadItemUtils::GetBrowserContext(download_item)); - auto* service = - extensions::ExtensionSystem::Get(profile)->extension_service(); - const extensions::Extension* extension = - service->GetExtensionById(by_ext->id(), include_disabled); + auto* registry = extensions::ExtensionRegistry::Get(profile); + const extensions::Extension* extension = registry->GetExtensionById( + by_ext->id(), extensions::ExtensionRegistry::COMPATIBILITY); if (extension) by_ext_name = extension->name(); }
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc index d3ca7d1..ff10ec31 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -488,8 +488,11 @@ CHECK(launch_bucket >= 0 && launch_bucket < extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); + Profile* profile = extension_service_->profile(); + const Extension* extension = - extension_service_->GetExtensionById(extension_id, false); + extensions::ExtensionRegistry::Get(profile)->GetExtensionById( + extension_id, extensions::ExtensionRegistry::ENABLED); // Prompt the user to re-enable the application if disabled. if (!extension) { @@ -497,8 +500,6 @@ return; } - Profile* profile = extension_service_->profile(); - WindowOpenDisposition disposition = args->GetSize() > 3 ? webui::GetDispositionFromClick(args, 3) : WindowOpenDisposition::CURRENT_TAB; @@ -564,7 +565,9 @@ CHECK(args->GetDouble(1, &launch_type)); const Extension* extension = - extension_service_->GetExtensionById(extension_id, true); + extensions::ExtensionRegistry::Get(extension_service_->profile()) + ->GetExtensionById(extension_id, + extensions::ExtensionRegistry::COMPATIBILITY); if (!extension) return; @@ -616,7 +619,9 @@ CHECK(args->GetString(0, &extension_id)); const Extension* extension = - extension_service_->GetExtensionById(extension_id, true); + extensions::ExtensionRegistry::Get(extension_service_->profile()) + ->GetExtensionById(extension_id, + extensions::ExtensionRegistry::COMPATIBILITY); if (!extension) return; @@ -632,7 +637,9 @@ CHECK(args->GetString(0, &extension_id)); const Extension* extension = - extension_service_->GetExtensionById(extension_id, true); + extensions::ExtensionRegistry::Get(extension_service_->profile()) + ->GetExtensionById(extension_id, + extensions::ExtensionRegistry::COMPATIBILITY); if (!extension) return; @@ -655,7 +662,9 @@ CHECK(args->GetString(0, &extension_id)); const Extension* extension = - extension_service_->GetExtensionById(extension_id, true); + extensions::ExtensionRegistry::Get(extension_service_->profile()) + ->GetExtensionById(extension_id, + extensions::ExtensionRegistry::COMPATIBILITY); if (!extension) return; @@ -863,7 +872,9 @@ // We record the histograms here because ExtensionUninstallCanceled is also // called when the extension uninstall dialog is canceled. const Extension* extension = - extension_service_->GetExtensionById(extension_id_prompting_, true); + extensions::ExtensionRegistry::Get(extension_service_->profile()) + ->GetExtensionById(extension_id_prompting_, + extensions::ExtensionRegistry::COMPATIBILITY); std::string histogram_name = user_initiated ? "ReEnableCancel" : "ReEnableAbort"; extensions::ExtensionService::RecordPermissionMessagesHistogram(
diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc index c8dfecd..9fae327 100644 --- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -2300,6 +2300,8 @@ IDS_SETTINGS_PRINTING_CUPS_EDIT_PRINTER_INVALID_PRINTER_UPDATE}, {"requireNetworkMessage", IDS_SETTINGS_PRINTING_CUPS_PRINTER_REQUIRE_INTERNET_MESSAGE}, + {"checkNetworkMessage", + IDS_SETTINGS_PRINTING_CUPS_PRINTER_CHECK_CONNECTION_MESSAGE}, {"editPrinterDialogTitle", IDS_SETTINGS_PRINTING_CUPS_EDIT_PRINTER_DIALOG_TITLE}, {"editPrinterButtonText", IDS_SETTINGS_PRINTING_CUPS_EDIT_PRINTER_BUTTON},
diff --git a/chrome/browser/ui/webui/sync_file_system_internals/extension_statuses_handler.cc b/chrome/browser/ui/webui/sync_file_system_internals/extension_statuses_handler.cc index cf5c1ba9..d21278e 100644 --- a/chrome/browser/ui/webui/sync_file_system_internals/extension_statuses_handler.cc +++ b/chrome/browser/ui/webui/sync_file_system_internals/extension_statuses_handler.cc
@@ -18,6 +18,7 @@ #include "chrome/browser/sync_file_system/sync_file_system_service_factory.h" #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_data_source.h" +#include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" #include "extensions/common/extension.h" @@ -28,6 +29,10 @@ namespace { +// TODO(crbug.com/989631): Break this and GetExtensionStatusesAsDictionary +// into a separate library, so the callbacks can use weak pointers to the +// calling instances. This will also break the dependency between +// ExtensionStatusesHandler and FileMetadataHandler. void ConvertExtensionStatusToDictionary( const base::WeakPtr<extensions::ExtensionService>& extension_service, const base::Callback<void(const base::ListValue&)>& callback, @@ -37,13 +42,17 @@ return; } + extensions::ExtensionRegistry* extension_registry = + extensions::ExtensionRegistry::Get(extension_service->profile()); + base::ListValue list; for (auto itr = status_map.begin(); itr != status_map.end(); ++itr) { std::string extension_id = itr->first.HostNoBrackets(); // Join with human readable extension name. const extensions::Extension* extension = - extension_service->GetExtensionById(extension_id, true); + extension_registry->GetExtensionById( + extension_id, extensions::ExtensionRegistry::COMPATIBILITY); if (!extension) continue;
diff --git a/chrome/browser/vr/testapp/vr_testapp.cc b/chrome/browser/vr/testapp/vr_testapp.cc index e2d37fb..747cddb 100644 --- a/chrome/browser/vr/testapp/vr_testapp.cc +++ b/chrome/browser/vr/testapp/vr_testapp.cc
@@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/macros.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "base/task/thread_pool/thread_pool.h" @@ -286,8 +287,7 @@ // Build UI thread task executor. This is used by platform // implementations for event polling & running background tasks. - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); base::ThreadPoolInstance::CreateAndStartWithDefaultParams("VrUiViewer"); ui::OzonePlatform::InitParams params;
diff --git a/chrome/browser/webauthn/chrome_authenticator_request_delegate.cc b/chrome/browser/webauthn/chrome_authenticator_request_delegate.cc index a4f0d47..4b267b9 100644 --- a/chrome/browser/webauthn/chrome_authenticator_request_delegate.cc +++ b/chrome/browser/webauthn/chrome_authenticator_request_delegate.cc
@@ -130,8 +130,6 @@ if (!weak_dialog_model_) return false; - DCHECK(authenticator || reason == InterestingFailureReason::kTimeout); - #if defined(OS_WIN) if (authenticator && authenticator->IsWinNativeApiAuthenticator()) { // Do not display a Chrome error dialog if the user cancels out of the
diff --git a/chrome/browser/webauthn/chrome_authenticator_request_delegate_unittest.cc b/chrome/browser/webauthn/chrome_authenticator_request_delegate_unittest.cc index 3bc6a43..3828ee252 100644 --- a/chrome/browser/webauthn/chrome_authenticator_request_delegate_unittest.cc +++ b/chrome/browser/webauthn/chrome_authenticator_request_delegate_unittest.cc
@@ -86,6 +86,17 @@ EXPECT_EQ(kTestPairedDeviceAddress2, second_address_value.GetString()); } +// Checks that DoesBlockRequestOnFailure does not crash if authenticator is +// nullptr and reason is not kTimeout. Regression test for crbug.com/990136. +TEST_F(ChromeAuthenticatorRequestDelegateTest, + DoesBlockRequestOnFailure__NullAuthenticator) { + ChromeAuthenticatorRequestDelegate delegate(main_rfh(), kRelyingPartyID); + EXPECT_TRUE(delegate.DoesBlockRequestOnFailure( + /*authenticator=*/nullptr, + ChromeAuthenticatorRequestDelegate::InterestingFailureReason:: + kUserConsentDenied)); +} + #if defined(OS_MACOSX) API_AVAILABLE(macos(10.12.2)) std::string TouchIdMetadataSecret(
diff --git a/chrome/chrome_cleaner/executables/chrome_cleaner_main.cc b/chrome/chrome_cleaner/executables/chrome_cleaner_main.cc index 29fede5..dbd4822 100644 --- a/chrome/chrome_cleaner/executables/chrome_cleaner_main.cc +++ b/chrome/chrome_cleaner/executables/chrome_cleaner_main.cc
@@ -18,6 +18,7 @@ #include "base/logging.h" #include "base/macros.h" #include "base/memory/ref_counted.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/sequenced_task_runner.h" #include "base/strings/utf_string_conversions.h" @@ -530,8 +531,7 @@ // Many pieces of code below need a task executor to have been instantiated // before them. - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); // The rebooter must be at the outermost scope so it can be called to reboot // before exiting, when appropriate.
diff --git a/chrome/chrome_cleaner/executables/chrome_reporter_main.cc b/chrome/chrome_cleaner/executables/chrome_reporter_main.cc index 2a5c3b4d..86e29c0 100644 --- a/chrome/chrome_cleaner/executables/chrome_reporter_main.cc +++ b/chrome/chrome_cleaner/executables/chrome_reporter_main.cc
@@ -19,6 +19,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h" +#include "base/message_loop/message_pump_type.h" #include "base/sequenced_task_runner.h" #include "base/strings/string16.h" #include "base/strings/string_util.h" @@ -234,8 +235,7 @@ // before them. base::ThreadPoolInstance::CreateAndStartWithDefaultParams( "software reporter"); - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); shutdown_sequence.mojo_task_runner = MojoTaskRunner::Create();
diff --git a/chrome/chrome_watcher/chrome_watcher_main.cc b/chrome/chrome_watcher/chrome_watcher_main.cc index 558fb37..ba97868 100644 --- a/chrome/chrome_watcher/chrome_watcher_main.cc +++ b/chrome/chrome_watcher/chrome_watcher_main.cc
@@ -19,6 +19,7 @@ #include "base/logging_win.h" #include "base/macros.h" #include "base/memory/ref_counted.h" +#include "base/message_loop/message_pump_type.h" #include "base/metrics/statistics_recorder.h" #include "base/path_service.h" #include "base/process/memory.h" @@ -317,7 +318,7 @@ return false; if (!background_thread_.StartWithOptions( - base::Thread::Options(base::MessagePump::Type::IO, 0))) { + base::Thread::Options(base::MessagePumpType::IO, 0))) { return false; } @@ -418,7 +419,7 @@ // Run a UI task executor on the main thread. base::PlatformThread::SetName("WatcherMainThread"); base::SingleThreadTaskExecutor main_thread_task_executor( - base::MessagePump::Type::UI); + base::MessagePumpType::UI); base::RunLoop run_loop; BrowserMonitor monitor(registry_path, &run_loop);
diff --git a/chrome/common/BUILD.gn b/chrome/common/BUILD.gn index 3bf72b5b..6c749b5 100644 --- a/chrome/common/BUILD.gn +++ b/chrome/common/BUILD.gn
@@ -727,7 +727,6 @@ sources = [ "cache_stats_recorder.mojom", "chrome_render_frame.mojom", - "constants.mojom", "content_settings_renderer.mojom", "media/webrtc_logging.mojom", "navigation_corrector.mojom",
diff --git a/chrome/common/constants.mojom b/chrome/common/constants.mojom deleted file mode 100644 index 881a179..0000000 --- a/chrome/common/constants.mojom +++ /dev/null
@@ -1,9 +0,0 @@ -// Copyright 2017 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. - -module chrome.mojom; - -const string kServiceName = "chrome"; - -const string kRendererServiceName = "chrome_renderer";
diff --git a/chrome/common/extensions/api/_api_features.json b/chrome/common/extensions/api/_api_features.json index 6094725..513980a2 100644 --- a/chrome/common/extensions/api/_api_features.json +++ b/chrome/common/extensions/api/_api_features.json
@@ -613,7 +613,8 @@ "permissions": { "channel": "stable", "extension_types": ["extension", "legacy_packaged_app", "platform_app"], - "contexts": ["blessed_extension"] + "contexts": ["blessed_extension"], + "disallow_for_service_workers": false }, "platformKeys": { "dependencies": ["permission:platformKeys"],
diff --git a/chrome/common/mac/OWNERS b/chrome/common/mac/OWNERS index 1a105278..011c2b6 100644 --- a/chrome/common/mac/OWNERS +++ b/chrome/common/mac/OWNERS
@@ -12,4 +12,4 @@ per-file *.mojom=file://ipc/SECURITY_OWNERS per-file *.typemap=set noparent per-file *.typemap=file://ipc/SECURITY_OWNERS -# COMPONENT: UI>Browser>WebAppInstalls +# COMPONENT: Internals>PlatformIntegration
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 73d2b4c..cdb0e20 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc
@@ -370,9 +370,9 @@ const char kWebKitForceEnableZoom[] = "webkit.webprefs.force_enable_zoom"; const char kWebKitPasswordEchoEnabled[] = "webkit.webprefs.password_echo_enabled"; +#endif const char kWebKitForceDarkModeEnabled[] = "webkit.webprefs.force_dark_mode_enabled"; -#endif const char kWebKitCommonScript[] = "Zyyy"; const char kWebKitStandardFontFamily[] = "webkit.webprefs.fonts.standard.Zyyy";
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index eeb2d3f4..c90bf9f1 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h
@@ -156,11 +156,11 @@ extern const char kWebKitJavascriptCanAccessClipboard[]; extern const char kWebkitTabsToLinks[]; extern const char kWebKitAllowRunningInsecureContent[]; +extern const char kWebKitForceDarkModeEnabled[]; #if defined(OS_ANDROID) extern const char kWebKitFontScaleFactor[]; extern const char kWebKitForceEnableZoom[]; extern const char kWebKitPasswordEchoEnabled[]; -extern const char kWebKitForceDarkModeEnabled[]; #endif extern const char kSSLErrorOverrideAllowed[]; extern const char kIncognitoModeAvailability[];
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc index 70cf91a..db1adf9 100644 --- a/chrome/renderer/chrome_content_renderer_client.cc +++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -29,7 +29,6 @@ #include "chrome/common/chrome_isolated_world_ids.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/constants.mojom.h" #include "chrome/common/crash_keys.h" #include "chrome/common/pdf_util.h" #include "chrome/common/pepper_permission_util.h" @@ -112,6 +111,7 @@ #include "media/base/media_switches.h" #include "media/media_buildflags.h" #include "mojo/public/cpp/bindings/generic_pending_receiver.h" +#include "mojo/public/cpp/bindings/remote.h" #include "net/base/net_errors.h" #include "ppapi/buildflags/buildflags.h" #include "ppapi/shared_impl/ppapi_switches.h" @@ -342,10 +342,9 @@ : blink::scheduler::WebRendererProcessType::kRenderer); { - startup_metric_utils::mojom::StartupMetricHostPtr startup_metric_host; - GetConnector()->BindInterface( - service_manager::ServiceFilter::ByName(chrome::mojom::kServiceName), - &startup_metric_host); + mojo::Remote<startup_metric_utils::mojom::StartupMetricHost> + startup_metric_host; + thread->BindHostReceiver(startup_metric_host.BindNewPipeAndPassReceiver()); startup_metric_host->RecordRendererMainEntryTime(main_entry_time_); } @@ -367,18 +366,11 @@ if (!spellcheck_) InitSpellCheck(); #endif -#if BUILDFLAG(FULL_SAFE_BROWSING) - registry_.AddInterface( - base::BindRepeating(&safe_browsing::PhishingClassifierFilter::Create)); -#endif + prerender_dispatcher_.reset(new prerender::PrerenderDispatcher()); subresource_filter_ruleset_dealer_.reset( new subresource_filter::UnverifiedRulesetDealer()); - registry_.AddInterface(base::BindRepeating( - &ChromeContentRendererClient::OnWebRtcLoggingAgentRequest, - base::Unretained(this))); - thread->AddObserver(chrome_observer_.get()); thread->AddObserver(prerender_dispatcher_.get()); thread->AddObserver(subresource_filter_ruleset_dealer_.get()); @@ -1076,13 +1068,6 @@ return GURL(); } -void ChromeContentRendererClient::OnBindInterface( - const service_manager::BindSourceInfo& remote_info, - const std::string& name, - mojo::ScopedMessagePipeHandle handle) { - registry_.TryBindInterface(name, &handle); -} - void ChromeContentRendererClient::GetInterface( const std::string& interface_name, mojo::ScopedMessagePipeHandle interface_pipe) { @@ -1582,16 +1567,6 @@ return FlashEmbedRewrite::RewriteFlashEmbedURL(url); } -void ChromeContentRendererClient::CreateRendererService( - service_manager::mojom::ServiceRequest service_request) { - DCHECK(!service_binding_.is_bound()); - service_binding_.Bind(std::move(service_request)); -} - -service_manager::Connector* ChromeContentRendererClient::GetConnector() { - return service_binding_.GetConnector(); -} - std::unique_ptr<content::URLLoaderThrottleProvider> ChromeContentRendererClient::CreateURLLoaderThrottleProvider( content::URLLoaderThrottleProviderType provider_type) { @@ -1644,18 +1619,28 @@ void ChromeContentRendererClient::BindReceiverOnMainThread( mojo::GenericPendingReceiver receiver) { - // TODO(crbug.com/977637): Get rid of the use of BinderRegistry here. This is - // only used to bind a spellcheck interface. + if (auto agent_receiver = receiver.As<chrome::mojom::WebRtcLoggingAgent>()) { + if (!webrtc_logging_agent_impl_) { + webrtc_logging_agent_impl_ = + std::make_unique<chrome::WebRtcLoggingAgentImpl>(); + } + webrtc_logging_agent_impl_->AddReceiver(std::move(agent_receiver)); + return; + } + +#if BUILDFLAG(FULL_SAFE_BROWSING) + if (auto setter_receiver = + receiver.As<safe_browsing::mojom::PhishingModelSetter>()) { + safe_browsing::PhishingClassifierFilter::Create(std::move(setter_receiver)); + return; + } +#endif + + // TODO(crbug.com/977637): Get rid of the use of BinderRegistry here. This was + // done only to avoid churning spellcheck code while eliminting the "chrome" + // and "chrome_renderer" services. Spellcheck is (and should remain) the only + // user of |registry_|. std::string interface_name = *receiver.interface_name(); auto pipe = receiver.PassPipe(); registry_.TryBindInterface(interface_name, &pipe); } - -void ChromeContentRendererClient::OnWebRtcLoggingAgentRequest( - mojo::InterfaceRequest<chrome::mojom::WebRtcLoggingAgent> request) { - if (!webrtc_logging_agent_impl_) { - webrtc_logging_agent_impl_ = - std::make_unique<chrome::WebRtcLoggingAgentImpl>(); - } - webrtc_logging_agent_impl_->AddReceiver(std::move(request)); -}
diff --git a/chrome/renderer/chrome_content_renderer_client.h b/chrome/renderer/chrome_content_renderer_client.h index e90038aed..00ee19f792 100644 --- a/chrome/renderer/chrome_content_renderer_client.h +++ b/chrome/renderer/chrome_content_renderer_client.h
@@ -31,10 +31,7 @@ #include "ppapi/buildflags/buildflags.h" #include "printing/buildflags/buildflags.h" #include "services/service_manager/public/cpp/binder_registry.h" -#include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/local_interface_provider.h" -#include "services/service_manager/public/cpp/service.h" -#include "services/service_manager/public/cpp/service_binding.h" #include "v8/include/v8.h" #if defined(OS_WIN) @@ -56,9 +53,6 @@ } namespace chrome { -namespace mojom { -class WebRtcLoggingAgent; -} // namespace mojom class WebRtcLoggingAgentImpl; } // namespace chrome @@ -89,7 +83,6 @@ class ChromeContentRendererClient : public content::ContentRendererClient, - public service_manager::Service, public service_manager::LocalInterfaceProvider { public: ChromeContentRendererClient(); @@ -207,8 +200,6 @@ const std::string& header_name) override; bool ShouldEnforceWebRTCRoutingPreferences() override; GURL OverrideFlashEmbedWithHTML(const GURL& url) override; - void CreateRendererService( - service_manager::mojom::ServiceRequest service_request) override; std::unique_ptr<content::URLLoaderThrottleProvider> CreateURLLoaderThrottleProvider( content::URLLoaderThrottleProviderType provider_type) override; @@ -252,11 +243,6 @@ static GURL GetNaClContentHandlerURL(const std::string& actual_mime_type, const content::WebPluginInfo& plugin); - // service_manager::Service: - void OnBindInterface(const service_manager::BindSourceInfo& remote_info, - const std::string& name, - mojo::ScopedMessagePipeHandle handle) override; - // service_manager::LocalInterfaceProvider: void GetInterface(const std::string& name, mojo::ScopedMessagePipeHandle request_handle) override; @@ -273,11 +259,6 @@ const extensions::Extension* extension); #endif - service_manager::Connector* GetConnector(); - - void OnWebRtcLoggingAgentRequest( - mojo::InterfaceRequest<chrome::mojom::WebRtcLoggingAgent> request); - #if defined(OS_WIN) // Observes module load events and notifies the ModuleDatabase in the browser // process. This instance is created on the main thread but then lives on the @@ -312,7 +293,6 @@ std::set<std::string> allowed_camera_device_origins_; #endif - service_manager::ServiceBinding service_binding_{this}; service_manager::BinderRegistry registry_; DISALLOW_COPY_AND_ASSIGN(ChromeContentRendererClient);
diff --git a/chrome/service/service_main.cc b/chrome/service/service_main.cc index fee51647..400adc7 100644 --- a/chrome/service/service_main.cc +++ b/chrome/service/service_main.cc
@@ -4,6 +4,7 @@ #include "base/base_switches.h" #include "base/debug/debugger.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "build/build_config.h" @@ -25,10 +26,9 @@ // The service process needs to be able to process WM_QUIT messages from the // Cloud Print Service UI on Windows. base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI_WITH_WM_QUIT_SUPPORT); + base::MessagePumpType::UI_WITH_WM_QUIT_SUPPORT); #else - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); #endif if (parameters.command_line.HasSwitch(switches::kWaitForDebugger)) {
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index c3ee08146..3f753d2 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -878,7 +878,6 @@ "../browser/interstitials/security_interstitial_page_test_utils.h", "../browser/invalidation/deprecated_profile_invalidation_provider_factory_browsertest.cc", "../browser/invalidation/profile_invalidation_provider_factory_browsertest.cc", - "../browser/io_thread_browsertest.cc", "../browser/lifetime/browser_close_manager_browsertest.cc", "../browser/lifetime/browser_shutdown_browsertest.cc", "../browser/loader/cors_origin_access_list_browsertest.cc", @@ -955,6 +954,7 @@ "../browser/net/netinfo_network_quality_estimator_holdback_browsertest.cc", "../browser/net/network_connection_tracker_browsertest.cc", "../browser/net/network_context_configuration_browsertest.cc", + "../browser/net/network_quality_estimator_browsertest.cc", "../browser/net/network_quality_estimator_prefs_browsertest.cc", "../browser/net/network_quality_netinfo_browsertest.cc", "../browser/net/network_quality_tracker_browsertest.cc", @@ -2838,6 +2838,7 @@ "../browser/custom_handlers/protocol_handler_registry_unittest.cc", "../browser/data_reduction_proxy/data_reduction_proxy_chrome_settings_unittest.cc", "../browser/data_reduction_proxy/data_reduction_proxy_settings_unittest_android.cc", + "../browser/data_saver/data_saver_top_host_provider_unittest.cc", "../browser/download/chrome_download_manager_delegate_unittest.cc", "../browser/download/download_history_unittest.cc", "../browser/download/download_item_model_unittest.cc", @@ -3076,7 +3077,6 @@ "../browser/previews/previews_lite_page_url_loader_interceptor_unittest.cc", "../browser/previews/previews_offline_helper_unittest.cc", "../browser/previews/previews_service_unittest.cc", - "../browser/previews/previews_top_host_provider_unittest.cc", "../browser/previews/previews_ui_tab_helper_unittest.cc", "../browser/process_singleton_win_unittest.cc", "../browser/profiles/gaia_info_update_service_unittest.cc", @@ -4522,6 +4522,7 @@ "../browser/safe_browsing/download_protection/download_feedback_unittest.cc", "../browser/safe_browsing/download_protection/download_protection_service_unittest.cc", "../browser/safe_browsing/download_protection/file_analyzer_unittest.cc", + "../browser/safe_browsing/download_protection/multipart_uploader_unittest.cc", "../browser/safe_browsing/download_protection/path_sanitizer_unittest.cc", "../browser/safe_browsing/download_protection/two_phase_uploader_unittest.cc", "../browser/safe_browsing/incident_reporting/binary_integrity_analyzer_mac_unittest.cc", @@ -4580,11 +4581,6 @@ "//components/safe_browsing/renderer:websocket_sb_handshake_throttle_unittest", "//components/safe_browsing/triggers:ad_redirect_trigger", ] - - # TODO(drubery): Once b/138388200 has been addressed, enable this on Windows. - if (!is_win) { - sources += [ "../browser/safe_browsing/download_protection/multipart_uploader_unittest.cc" ] - } } else if (safe_browsing_mode == 2) { sources += [ "../browser/safe_browsing/telemetry/android/android_telemetry_service_unittest.cc" ] deps += [] @@ -4729,6 +4725,7 @@ "../browser/ui/cocoa/profiles/profile_menu_controller_unittest.mm", "../browser/ui/cocoa/scoped_menu_bar_lock_unittest.mm", "../browser/ui/cocoa/status_icons/status_icon_mac_unittest.mm", + "../browser/ui/cocoa/tab_menu_bridge_unittest.mm", "../browser/ui/cocoa/test/cocoa_profile_test.h", "../browser/ui/cocoa/test/cocoa_profile_test.mm", "../browser/ui/cocoa/test/run_loop_testing_unittest.mm",
diff --git a/chrome/test/base/test_browser_window.cc b/chrome/test/base/test_browser_window.cc index e67e9499..91b8cb3 100644 --- a/chrome/test/base/test_browser_window.cc +++ b/chrome/test/base/test_browser_window.cc
@@ -205,7 +205,7 @@ return nullptr; } -ClickToCallDialog* TestBrowserWindow::ShowClickToCallDialog( +SharingDialog* TestBrowserWindow::ShowClickToCallDialog( content::WebContents* web_contents, ClickToCallSharingDialogController* controller) { return nullptr;
diff --git a/chrome/test/base/test_browser_window.h b/chrome/test/base/test_browser_window.h index c29b0589..b21cb18 100644 --- a/chrome/test/base/test_browser_window.h +++ b/chrome/test/base/test_browser_window.h
@@ -120,7 +120,7 @@ bool IsTabStripEditable() const override; bool IsToolbarVisible() const override; bool IsToolbarShowing() const override; - ClickToCallDialog* ShowClickToCallDialog( + SharingDialog* ShowClickToCallDialog( content::WebContents* contents, ClickToCallSharingDialogController* controller) override; void ShowUpdateChromeDialog() override {}
diff --git a/chrome/test/chromedriver/net/test_http_server.cc b/chrome/test/chromedriver/net/test_http_server.cc index 9f6ac99..cdfa4164 100644 --- a/chrome/test/chromedriver/net/test_http_server.cc +++ b/chrome/test/chromedriver/net/test_http_server.cc
@@ -8,7 +8,7 @@ #include "base/bind.h" #include "base/location.h" -#include "base/message_loop/message_loop.h" +#include "base/message_loop/message_pump_type.h" #include "base/single_thread_task_runner.h" #include "base/strings/stringprintf.h" #include "base/time/time.h" @@ -33,7 +33,7 @@ } bool TestHttpServer::Start() { - base::Thread::Options options(base::MessagePump::Type::IO, 0); + base::Thread::Options options(base::MessagePumpType::IO, 0); bool thread_started = thread_.StartWithOptions(options); EXPECT_TRUE(thread_started); if (!thread_started)
diff --git a/chrome/test/data/extensions/api_test/service_worker/worker_based_background/permissions_api/manifest.json b/chrome/test/data/extensions/api_test/service_worker/worker_based_background/permissions_api/manifest.json new file mode 100644 index 0000000..075f727d --- /dev/null +++ b/chrome/test/data/extensions/api_test/service_worker/worker_based_background/permissions_api/manifest.json
@@ -0,0 +1,9 @@ +{ + "name": "SW background extension: Browser Action can call permisssions.request", + "version": "1.0", + "manifest_version": 2, + "description": "Tests that browserAction.onClicked can call permisssions.request", + "optional_permissions": ["storage"], + "browser_action": {}, + "background": {"service_worker": "service_worker_background.js"} +}
diff --git a/chrome/test/data/extensions/api_test/service_worker/worker_based_background/permissions_api/service_worker_background.js b/chrome/test/data/extensions/api_test/service_worker/worker_based_background/permissions_api/service_worker_background.js new file mode 100644 index 0000000..e23aa07 --- /dev/null +++ b/chrome/test/data/extensions/api_test/service_worker/worker_based_background/permissions_api/service_worker_background.js
@@ -0,0 +1,21 @@ +// Copyright 2019 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. + +chrome.browserAction.onClicked.addListener(() => { + chrome.test.assertEq(undefined, chrome.storage); + chrome.permissions.request( + {permissions:['storage']}, + (granted) => { + chrome.test.assertNoLastError(); + chrome.test.assertTrue(granted); + chrome.test.assertTrue(!!chrome.storage); + chrome.permissions.contains({permissions: ['storage']}, (result) => { + chrome.test.assertNoLastError(); + chrome.test.assertTrue(result); + chrome.test.notifyPass(); + }); + }); +}); + +chrome.test.sendMessage('ready');
diff --git a/chrome/test/data/webui/BUILD.gn b/chrome/test/data/webui/BUILD.gn index e14a45f..d5702a2 100644 --- a/chrome/test/data/webui/BUILD.gn +++ b/chrome/test/data/webui/BUILD.gn
@@ -11,6 +11,7 @@ sources = [ "bookmarks/bookmarks_focus_test.js", "cr_elements/cr_elements_focus_test.js", + "cr_elements/cr_elements_v3_focus_test.js", "cr_focus_row_behavior_interactive_test.js", "extensions/cr_extensions_interactive_ui_tests.js", "history/history_focus_test.js", @@ -50,6 +51,7 @@ "chrome_send_browsertest.js", "cr_components/cr_components_browsertest.js", "cr_elements/cr_elements_browsertest.js", + "cr_elements/cr_elements_v3_browsertest.js", "find_shortcut_behavior_browsertest.js", "history/history_browsertest.js", "js/webui_resource_module_async_browsertest.js",
diff --git a/chrome/test/data/webui/PRESUBMIT.py b/chrome/test/data/webui/PRESUBMIT.py index badd377..333e8acf 100644 --- a/chrome/test/data/webui/PRESUBMIT.py +++ b/chrome/test/data/webui/PRESUBMIT.py
@@ -2,6 +2,35 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +def _CheckForModularizedTests(input_api, output_api): + module_tests = [ + 'cr_elements/cr_button_tests.m.js', + 'cr_elements/cr_checkbox_test.m.js', + 'cr_elements/cr_toast_test.m.js', + 'cr_elements/cr_toggle_test.m.js', + 'cr_elements/cr_view_manager_test.m.js', + 'extensions/test_util.m.js', + 'mock_timer.m.js', + 'settings/test_util.m.js', + ] + affected_files = [ + input_api.os_path.relpath(f, input_api.PresubmitLocalPath()) + for f in input_api.AbsoluteLocalPaths() + ] + + errors = [] + for module_test in module_tests: + test = module_test[:-5] + '.js' + if ((test in affected_files) != (module_test in affected_files)): + errors.append('original: %s, modularized: %s' % (test, module_test)) + if errors: + msg = 'Found modified test files with corresponding module files not ' + \ + 'updated, or vice versa. Please ensure module and original test ' + \ + 'files are updated in parallel, so that behavior is verified for ' + \ + 'both modularized and non-modularized code.\n ' + '\n '.join(errors) + return [output_api.PresubmitPromptWarning(msg)] + else: + return [] def _CommonChecks(input_api, output_api): results = [] @@ -15,6 +44,7 @@ input_api, output_api) finally: sys.path = old_sys_path + results += _CheckForModularizedTests(input_api, output_api) results += input_api.canned_checks.CheckPatchFormatted(input_api, output_api, check_js=True) return results
diff --git a/chrome/test/data/webui/chromeos/fake_network_config_mojom.js b/chrome/test/data/webui/chromeos/fake_network_config_mojom.js index 08b85956..78bb378 100644 --- a/chrome/test/data/webui/chromeos/fake_network_config_mojom.js +++ b/chrome/test/data/webui/chromeos/fake_network_config_mojom.js
@@ -20,6 +20,8 @@ this.onNetworkListChanged.bind(this)); extensionApi.onDeviceStateListChanged.addListener( this.onDeviceStateListChanged.bind(this)); + extensionApi.onActiveNetworksChanged.addListener( + this.onActiveNetworksChanged.bind(this)); } onNetworkListChanged(networks) { @@ -31,6 +33,14 @@ } /** + * @param {?Array<?chromeos.networkConfig.mojom.NetworkStateProperties>} + * networks + */ + onActiveNetworksChanged(networks) { + this.observers_.forEach(o => o.onActiveNetworksChanged(networks)); + } + + /** * @param { !chromeos.networkConfig.mojom.CrosNetworkConfigObserverProxy } * observer */
diff --git a/chrome/test/data/webui/chromeos/fake_networking_private.js b/chrome/test/data/webui/chromeos/fake_networking_private.js index 539c08b..4b31424c 100644 --- a/chrome/test/data/webui/chromeos/fake_networking_private.js +++ b/chrome/test/data/webui/chromeos/fake_networking_private.js
@@ -53,7 +53,7 @@ var methodNames = [ 'getProperties', 'getProperties', 'getManagedProperties', 'getNetworks', - 'getDeviceStates', 'enableNetworkType', 'disableNetworkType', + 'getDeviceStates', 'getState', 'enableNetworkType', 'disableNetworkType', 'requestNetworkScan', 'getGlobalPolicy', 'getCertificateLists' ]; @@ -127,7 +127,13 @@ }, /** @override */ - getState: assertNotReached, + getState: function(guid, callback) { + var result = this.networkStates_.find(function(state) { + return state.GUID == guid; + }); + callback(result); + this.methodCalled('getState'); + }, /** @override */ setProperties: assertNotReached, @@ -241,6 +247,9 @@ onDeviceStateListChanged: new FakeChromeEvent(), /** @type {!FakeChromeEvent} */ + onActiveNetworksChanged: new FakeChromeEvent(), + + /** @type {!FakeChromeEvent} */ onPortalDetectionCompleted: new FakeChromeEvent(), /** @type {!FakeChromeEvent} */
diff --git a/chrome/test/data/webui/cr_elements/cr_button_tests.m.js b/chrome/test/data/webui/cr_elements/cr_button_tests.m.js new file mode 100644 index 0000000..267adc5 --- /dev/null +++ b/chrome/test/data/webui/cr_elements/cr_button_tests.m.js
@@ -0,0 +1,89 @@ +// Copyright 2019 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 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; +import {eventToPromise} from 'chrome://test/settings/test_util.m.js'; + +suite('cr-button-v3', function() { + let button; + + setup(() => { + PolymerTest.clearBody(); + button = document.createElement('cr-button'); + document.body.appendChild(button); + }); + + /** @param {string} key */ + function press(key) { + button.dispatchEvent(new KeyboardEvent('keydown', {key: key})); + button.dispatchEvent(new KeyboardEvent('keyup', {key: key})); + } + + test('label is displayed', async () => { + const widthWithoutLabel = button.offsetWidth; + document.body.innerHTML = '<cr-button>Long Label</cr-button>'; + button = document.body.querySelector('cr-button'); + assertTrue(widthWithoutLabel < button.offsetWidth); + }); + + test('tabindex and aria-disabled', () => { + assertFalse(button.disabled); + assertFalse(button.hasAttribute('disabled')); + assertEquals('0', button.getAttribute('tabindex')); + assertEquals('false', button.getAttribute('aria-disabled')); + button.disabled = true; + assertTrue(button.hasAttribute('disabled')); + assertEquals('-1', button.getAttribute('tabindex')); + assertEquals('true', button.getAttribute('aria-disabled')); + }); + + test('enter/space/click events and programmatic click() calls', async () => { + let clickCount = 0; + const clickHandler = () => { + clickCount++; + }; + button.addEventListener('click', clickHandler); + + const checkClicks = expectedCount => { + clickCount = 0; + press('Enter'); + press(' '); + button.dispatchEvent(new MouseEvent('click')); + button.click(); + assertEquals(expectedCount, clickCount); + }; + + checkClicks(4); + button.disabled = true; + checkClicks(0); + button.disabled = false; + checkClicks(4); + + button.removeEventListener('click', clickHandler); + }); + + test('when tabindex is -1, it stays -1', async () => { + document.body.innerHTML = '<cr-button tabindex="-1"></cr-button>'; + button = document.body.querySelector('cr-button'); + assertEquals('-1', button.getAttribute('tabindex')); + }); + + test('hidden', () => { + assertFalse(button.hidden); + assertFalse(button.hasAttribute('hidden')); + assertNotEquals('none', getComputedStyle(button).display); + button.hidden = true; + assertTrue(button.hasAttribute('hidden')); + assertEquals('none', getComputedStyle(button).display); + button.hidden = false; + assertFalse(button.hasAttribute('hidden')); + assertNotEquals('none', getComputedStyle(button).display); + }); + + test('tap event is emitted on click', async () => { + const wait = eventToPromise('tap', button); + button.click(); + await wait; + }); +});
diff --git a/chrome/test/data/webui/cr_elements/cr_checkbox_test.m.js b/chrome/test/data/webui/cr_elements/cr_checkbox_test.m.js new file mode 100644 index 0000000..a8db2e8 --- /dev/null +++ b/chrome/test/data/webui/cr_elements/cr_checkbox_test.m.js
@@ -0,0 +1,211 @@ +// 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. + +import 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.m.js'; + +import {keyDownOn, keyUpOn, pressAndReleaseKeyOn} from 'chrome://resources/polymer/v3_0/iron-test-helpers/mock-interactions.js'; +import {eventToPromise} from 'chrome://test/settings/test_util.m.js'; + +suite('cr-checkbox-v3', function() { + let checkbox; + + setup(function() { + PolymerTest.clearBody(); + document.body.innerHTML = ` + <cr-checkbox> + <div>label + <a>link</a> + </div> + </cr-checkbox> + `; + + checkbox = document.querySelector('cr-checkbox'); + assertNotChecked(); + }); + + function assertChecked() { + assertTrue(checkbox.checked); + assertTrue(checkbox.hasAttribute('checked')); + assertEquals('true', checkbox.$.checkbox.getAttribute('aria-checked')); + } + + function assertNotChecked() { + assertFalse(checkbox.checked); + assertEquals(null, checkbox.getAttribute('checked')); + assertEquals('false', checkbox.$.checkbox.getAttribute('aria-checked')); + } + + function assertDisabled() { + assertTrue(checkbox.disabled); + assertFalse(checkbox.hasAttribute('tabindex')); + assertEquals('-1', checkbox.$.checkbox.getAttribute('tabindex')); + assertTrue(checkbox.hasAttribute('disabled')); + assertEquals('true', checkbox.$.checkbox.getAttribute('aria-disabled')); + assertEquals('none', getComputedStyle(checkbox).pointerEvents); + } + + function assertNotDisabled() { + assertFalse(checkbox.disabled); + assertFalse(checkbox.hasAttribute('tabindex')); + assertEquals('0', checkbox.$.checkbox.getAttribute('tabindex')); + assertFalse(checkbox.hasAttribute('disabled')); + assertEquals('false', checkbox.$.checkbox.getAttribute('aria-disabled')); + } + + /** + * @param {string} keyName The name of the key to trigger. + * @param {HTMLElement=} element + */ + function triggerKeyPressEvent(keyName, element) { + element = element || checkbox.$.checkbox; + pressAndReleaseKeyOn(element, '', undefined, keyName); + } + + // Test that the control is checked when the user taps on it (no movement + // between pointerdown and pointerup). + test('ToggleByMouse', async () => { + let whenChanged = eventToPromise('change', checkbox); + checkbox.click(); + await whenChanged; + assertChecked(); + whenChanged = eventToPromise('change', checkbox); + checkbox.click(); + await whenChanged; + assertNotChecked(); + }); + + // Test that the control is checked when the |checked| attribute is + // programmatically changed. + test('ToggleByAttribute', done => { + eventToPromise('change', checkbox).then(function() { + // Should not fire 'change' event when state is changed programmatically. + // Only user interaction should result in 'change' event. + assertFalse(true); + }); + + checkbox.checked = true; + assertChecked(); + + checkbox.checked = false; + assertNotChecked(); + + // Wait 1 cycle to make sure change-event was not fired. + setTimeout(done); + }); + + test('Toggle checkbox button click', async () => { + let whenChanged = eventToPromise('change', checkbox); + checkbox.$.checkbox.click(); + await whenChanged; + assertChecked(); + whenChanged = eventToPromise('change', checkbox); + triggerKeyPressEvent('Enter'); + await whenChanged; + assertNotChecked(); + whenChanged = eventToPromise('change', checkbox); + triggerKeyPressEvent(' '); + await whenChanged; + assertChecked(); + }); + + // Test that the control is not affected by user interaction when disabled. + test('ToggleWhenDisabled', function(done) { + assertNotDisabled(); + checkbox.disabled = true; + assertDisabled(); + + eventToPromise('change', checkbox).then(function() { + assertFalse(true); + }); + + checkbox.click(); + assertNotChecked(); + checkbox.$.checkbox.click(); + assertNotChecked(); + triggerKeyPressEvent('Enter'); + assertNotChecked(); + triggerKeyPressEvent(' '); + assertNotChecked(); + + // Wait 1 cycle to make sure change-event was not fired. + setTimeout(done); + }); + + test('LabelDisplay', function() { + const labelContainer = checkbox.$['label-container']; + // Test that there's actually a label that's more than just the padding. + assertTrue(labelContainer.offsetWidth > 20); + + checkbox.classList.add('no-label'); + assertEquals('none', getComputedStyle(labelContainer).display); + }); + + test('ClickedOnLinkDoesNotToggleCheckbox', function(done) { + eventToPromise('change', checkbox).then(function() { + assertFalse(true); + }); + + assertNotChecked(); + const link = document.querySelector('a'); + link.click(); + assertNotChecked(); + + triggerKeyPressEvent('Enter', link); + assertNotChecked(); + + // Wait 1 cycle to make sure change-event was not fired. + setTimeout(done); + }); + + test('space key down does not toggle', () => { + assertNotChecked(); + keyDownOn(checkbox.$.checkbox, null, undefined, ' '); + assertNotChecked(); + }); + + test('space key up toggles', () => { + assertNotChecked(); + keyUpOn(checkbox.$.checkbox, null, undefined, ' '); + assertChecked(); + }); + + test('InitializingWithTabindex', function() { + PolymerTest.clearBody(); + document.body.innerHTML = ` + <cr-checkbox id="checkbox" tab-index="-1"></cr-checkbox> + `; + + checkbox = document.querySelector('cr-checkbox'); + + // Should not override tabindex if it is initialized. + assertEquals(-1, checkbox.tabIndex); + assertFalse(checkbox.hasAttribute('tabindex')); + assertEquals('-1', checkbox.$.checkbox.getAttribute('tabindex')); + }); + + test('InitializingWithDisabled', function() { + PolymerTest.clearBody(); + document.body.innerHTML = ` + <cr-checkbox id="checkbox" disabled></cr-checkbox> + `; + + checkbox = document.querySelector('cr-checkbox'); + + // Initializing with disabled should make tabindex="-1". + assertEquals(-1, checkbox.tabIndex); + assertFalse(checkbox.hasAttribute('tabindex')); + assertEquals('-1', checkbox.$.checkbox.getAttribute('tabindex')); + }); + + test('tabindex attribute is controlled by tabIndex', () => { + PolymerTest.clearBody(); + document.body.innerHTML = ` + <cr-checkbox id="checkbox" tabindex="-1"></cr-checkbox> + `; + checkbox = document.querySelector('cr-checkbox'); + assertEquals(0, checkbox.tabIndex); + assertFalse(checkbox.hasAttribute('tabindex')); + assertEquals('0', checkbox.$.checkbox.getAttribute('tabindex')); + }); +});
diff --git a/chrome/test/data/webui/cr_elements/cr_elements_v3_browsertest.js b/chrome/test/data/webui/cr_elements/cr_elements_v3_browsertest.js new file mode 100644 index 0000000..9448b974 --- /dev/null +++ b/chrome/test/data/webui/cr_elements/cr_elements_v3_browsertest.js
@@ -0,0 +1,78 @@ +// Copyright 2019 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. + +/** @fileoverview Tests for shared Polymer 3 elements. */ + +// Polymer BrowserTest fixture. +GEN_INCLUDE(['//chrome/test/data/webui/polymer_browser_test_base.js']); + +/** Test fixture for shared Polymer 3 elements. */ +// eslint-disable-next-line no-var +var CrElementsV3BrowserTest = class extends PolymerTest { + /** @override */ + get browsePreload() { + return 'chrome://dummyurl'; + } + + /** @override */ + get extraLibraries() { + return [ + '//third_party/mocha/mocha.js', + '//chrome/test/data/webui/mocha_adapter.js', + ]; + } + + /** @override */ + get webuiHost() { + return 'dummyurl'; + } + + /** @override */ + get runAccessibilityChecks() { + return true; + } + + /** @override */ + setUp() { + PolymerTest.prototype.setUp.call(this); + // We aren't loading the main document. + this.accessibilityAuditConfig.ignoreSelectors('humanLangMissing', 'html'); + } +}; + +// eslint-disable-next-line no-var +var CrElementsButtonV3Test = class extends CrElementsV3BrowserTest { + /** @override */ + get browsePreload() { + return 'chrome://test?module=cr_elements/cr_button_tests.m.js'; + } +}; + +TEST_F('CrElementsButtonV3Test', 'All', function() { + mocha.run(); +}); + +// eslint-disable-next-line no-var +var CrElementsToastV3Test = class extends CrElementsV3BrowserTest { + /** @override */ + get browsePreload() { + return 'chrome://test?module=cr_elements/cr_toast_test.m.js'; + } +}; + +TEST_F('CrElementsToastV3Test', 'All', function() { + mocha.run(); +}); + +// eslint-disable-next-line no-var +var CrElementsViewManagerV3Test = class extends CrElementsV3BrowserTest { + /** @override */ + get browsePreload() { + return 'chrome://test?module=cr_elements/cr_view_manager_test.m.js'; + } +}; + +TEST_F('CrElementsViewManagerV3Test', 'All', function() { + mocha.run(); +});
diff --git a/chrome/test/data/webui/cr_elements/cr_elements_v3_focus_test.js b/chrome/test/data/webui/cr_elements/cr_elements_v3_focus_test.js new file mode 100644 index 0000000..02618d31 --- /dev/null +++ b/chrome/test/data/webui/cr_elements/cr_elements_v3_focus_test.js
@@ -0,0 +1,53 @@ +// Copyright 2019 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. + +/** @fileoverview Tests for shared Polymer 3 elements which rely on focus. */ + +// Polymer BrowserTest fixture. +GEN_INCLUDE(['//chrome/test/data/webui/polymer_interactive_ui_test.js']); + +// eslint-disable-next-line no-var +var CrElementsV3FocusTest = class extends PolymerInteractiveUITest { + /** @override */ + get browsePreload() { + return 'chrome://dummyurl'; + } + + /** @override */ + get extraLibraries() { + return [ + '//third_party/mocha/mocha.js', + '//chrome/test/data/webui/mocha_adapter.js', + ]; + } + + /** @override */ + get webuiHost() { + return 'dummyurl'; + } +}; + +// eslint-disable-next-line no-var +var CrElementsCheckboxV3Test = class extends CrElementsV3FocusTest { + /** @override */ + get browsePreload() { + return 'chrome://test?module=cr_elements/cr_checkbox_test.m.js'; + } +}; + +TEST_F('CrElementsCheckboxV3Test', 'All', function() { + mocha.run(); +}); + +// eslint-disable-next-line no-var +var CrElementsToggleV3Test = class extends CrElementsV3FocusTest { + /** @override */ + get browsePreload() { + return 'chrome://test?module=cr_elements/cr_toggle_test.m.js'; + } +}; + +TEST_F('CrElementsToggleV3Test', 'All', function() { + mocha.run(); +});
diff --git a/chrome/test/data/webui/cr_elements/cr_toast_test.m.js b/chrome/test/data/webui/cr_elements/cr_toast_test.m.js new file mode 100644 index 0000000..bb859413 --- /dev/null +++ b/chrome/test/data/webui/cr_elements/cr_toast_test.m.js
@@ -0,0 +1,134 @@ +// Copyright 2019 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 'chrome://resources/cr_elements/cr_toast/cr_toast.m.js'; +import {MockTimer} from 'chrome://test/mock_timer.m.js'; + +suite('cr-toast-v3', function() { + let toast; + let mockTimer; + + setup(function() { + PolymerTest.clearBody(); + toast = document.createElement('cr-toast'); + document.body.appendChild(toast); + mockTimer = new MockTimer(); + mockTimer.install(); + }); + + teardown(function() { + mockTimer.uninstall(); + }); + + test('simple show/hide', function() { + assertFalse(toast.open); + + toast.show(); + assertTrue(toast.open); + + toast.hide(); + assertFalse(toast.open); + }); + + test('auto hide with show()', function() { + const duration = 100; + toast.duration = duration; + + toast.show(); + assertTrue(toast.open); + + mockTimer.tick(duration); + assertFalse(toast.open); + }); + + test('auto hide with (open = true)', function() { + const duration = 100; + toast.duration = duration; + + toast.open = true; + + mockTimer.tick(duration); + assertFalse(toast.open); + }); + + test('show() clears auto-hide', function() { + const duration = 70; + toast.duration = duration; + toast.open = true; + mockTimer.tick(duration - 1); + toast.show(); + + // Auto-hide is cleared and toast should remain open. + mockTimer.tick(1); + assertTrue(toast.open); + + // When duration passes, new auto-hide should close toast. + mockTimer.tick(duration - 2); + assertTrue(toast.open); + mockTimer.tick(1); + mockTimer.tick(duration); + assertFalse(toast.open); + }); + + test('(open = true) does not clear auto-hide', function() { + const duration = 70; + toast.duration = duration; + toast.open = true; + mockTimer.tick(duration - 1); + toast.open = true; + mockTimer.tick(1); + assertFalse(toast.open); + }); + + test('clearing duration clears timeout', function() { + const nonZeroDuration = 30; + toast.duration = nonZeroDuration; + toast.open = true; + assertTrue(toast.open); + + const zeroDuration = 0; + toast.duration = zeroDuration; + mockTimer.tick(nonZeroDuration); + assertTrue(toast.open); + }); + + test('setting a duration starts new auto-hide', function() { + toast.duration = 0; + toast.show(); + + const nonZeroDuration = 50; + toast.duration = nonZeroDuration; + mockTimer.tick(nonZeroDuration - 1); + assertTrue(toast.open); + + mockTimer.tick(1); + assertFalse(toast.open); + }); + + test('setting duration clears auto-hide', function() { + const oldDuration = 30; + toast.duration = oldDuration; + toast.open = true; + + mockTimer.tick(oldDuration - 1); + assertTrue(toast.open); + + const newDuration = 50; + toast.duration = newDuration; + mockTimer.tick(newDuration - 1); + assertTrue(toast.open); + + mockTimer.tick(1); + assertFalse(toast.open); + }); + + test('setting duration using show(duration)', function() { + const duration = 100; + toast.show(duration); + assertTrue(toast.open); + + mockTimer.tick(duration); + assertFalse(toast.open); + }); +});
diff --git a/chrome/test/data/webui/cr_elements/cr_toggle_test.m.js b/chrome/test/data/webui/cr_elements/cr_toggle_test.m.js new file mode 100644 index 0000000..4eec35d --- /dev/null +++ b/chrome/test/data/webui/cr_elements/cr_toggle_test.m.js
@@ -0,0 +1,225 @@ +// Copyright 2019 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 'chrome://resources/cr_elements/cr_toggle/cr_toggle.m.js'; + +import {keyEventOn, tap} from 'chrome://resources/polymer/v3_0/iron-test-helpers/mock-interactions.js'; +import {eventToPromise} from 'chrome://test/settings/test_util.m.js'; + +suite('cr-toggle-v3', function() { + let toggle; + + setup(function() { + PolymerTest.clearBody(); + document.body.innerHTML = ` + <cr-toggle id="toggle"></cr-toggle> + `; + + toggle = document.getElementById('toggle'); + assertNotChecked(); + }); + + function assertChecked() { + assertTrue(toggle.checked); + assertTrue(toggle.hasAttribute('checked')); + assertEquals('true', toggle.getAttribute('aria-pressed')); + // Asserting that the toggle button has actually moved. + assertTrue(getComputedStyle(toggle.$.knob).transform.includes('matrix')); + } + + function assertNotChecked() { + assertFalse(toggle.checked); + assertEquals(null, toggle.getAttribute('checked')); + assertEquals('false', toggle.getAttribute('aria-pressed')); + // Asserting that the toggle button has not moved. + assertEquals('none', getComputedStyle(toggle.$.knob).transform); + } + + function assertDisabled() { + assertTrue(toggle.disabled); + assertEquals('-1', toggle.getAttribute('tabindex')); + assertTrue(toggle.hasAttribute('disabled')); + assertEquals('true', toggle.getAttribute('aria-disabled')); + } + + function assertNotDisabled() { + assertFalse(toggle.disabled); + assertEquals('0', toggle.getAttribute('tabindex')); + assertFalse(toggle.hasAttribute('disabled')); + assertEquals('false', toggle.getAttribute('aria-disabled')); + } + + /** + * @param {string} keyName The name of the key to trigger. + * @param {string} keyCode The event keyCode and code to trigger. + */ + function triggerKeyPressEvent(keyName, keyCode) { + // Note: MockInteractions incorrectly populates |keyCode| and |code| with + // the same value. The intention of passing a string here is only to set + // |code|, since |keyCode| is not used its value doesn't matter. + keyEventOn(toggle, 'keypress', keyCode, undefined, keyName); + } + + /** + * Simulates dragging the toggle button left/right. + * @param {number} moveDirection -1 for left, 1 for right, 0 when no + * pointermove event should be simulated. + * @param {number=} diff The move amount in pixels. Only relevant if + * moveDirection is non-zero. + */ + function triggerPointerDownMoveUpTapSequence(moveDirection, diff) { + if (window.getComputedStyle(toggle)['pointer-events'] === 'none') { + return; + } + + // Simulate events in the same order they are fired by the browser. + // Need to provide a valid |pointerId| for setPointerCapture() to not throw + // an error. + const xStart = 100; + toggle.dispatchEvent( + new PointerEvent('pointerdown', {pointerId: 1, clientX: xStart})); + let xEnd = xStart; + if (moveDirection) { + xEnd = moveDirection > 0 ? xStart + diff : xStart - diff; + toggle.dispatchEvent( + new PointerEvent('pointermove', {pointerId: 1, clientX: xEnd})); + } + toggle.dispatchEvent( + new PointerEvent('pointerup', {pointerId: 1, clientX: xEnd})); + tap(toggle); + } + + // Test that the control is toggled when the |checked| attribute is + // programmatically changed. + test('ToggleByAttribute', function() { + eventToPromise('change', toggle).then(function() { + // Should not fire 'change' event when state is changed programmatically. + // Only user interaction should result in 'change' event. + assertFalse(true); + }); + + toggle.checked = true; + assertChecked(); + + toggle.checked = false; + assertNotChecked(); + }); + + // Test that the control is toggled when the user taps on it (no movement + // between pointerdown and pointerup). + test('ToggleByPointerTap', function() { + let whenChanged = eventToPromise('change', toggle); + triggerPointerDownMoveUpTapSequence(0 /* no pointermove */); + return whenChanged + .then(function() { + assertChecked(); + whenChanged = eventToPromise('change', toggle); + triggerPointerDownMoveUpTapSequence(0 /* no pointermove */); + return whenChanged; + }) + .then(function() { + assertNotChecked(); + }); + }); + + // Test that the control is toggled if the user moves the pointer by a + // MOVE_THRESHOLD_PX pixels accidentally (shaky hands) in any direction. + test('ToggleByShakyPointerTap', function() { + let whenChanged = eventToPromise('change', toggle); + triggerPointerDownMoveUpTapSequence( + 1 /* right */, toggle.MOVE_THRESHOLD_PX - 1); + return whenChanged + .then(function() { + assertChecked(); + whenChanged = eventToPromise('change', toggle); + triggerPointerDownMoveUpTapSequence( + 1 /* right */, toggle.MOVE_THRESHOLD_PX - 1); + return whenChanged; + }) + .then(function() { + assertNotChecked(); + }); + }); + + // Test that the control is toggled when the user moves the pointer while + // holding down. + test('ToggleByPointerMove', function() { + let whenChanged = eventToPromise('change', toggle); + triggerPointerDownMoveUpTapSequence( + 1 /* right */, toggle.MOVE_THRESHOLD_PX); + return whenChanged + .then(function() { + assertChecked(); + whenChanged = eventToPromise('change', toggle); + triggerPointerDownMoveUpTapSequence( + -1 /* left */, toggle.MOVE_THRESHOLD_PX); + return whenChanged; + }) + .then(function() { + assertNotChecked(); + whenChanged = eventToPromise('change', toggle); + + // Test simple tapping after having dragged. + triggerPointerDownMoveUpTapSequence(0 /* no pointermove */); + return whenChanged; + }) + .then(function() { + assertChecked(); + }); + }); + + // Test that the control is toggled when the user presses the 'Enter' or + // 'Space' key. + test('ToggleByKey', function() { + let whenChanged = eventToPromise('change', toggle); + triggerKeyPressEvent('Enter', 'Enter'); + return whenChanged + .then(function() { + assertChecked(); + whenChanged = eventToPromise('change', toggle); + triggerKeyPressEvent(' ', 'Space'); + return whenChanged; + }) + .then(function() { + assertNotChecked(); + whenChanged = eventToPromise('change', toggle); + triggerKeyPressEvent('Enter', 'NumpadEnter'); + return whenChanged; + }) + .then(function() { + assertChecked(); + }); + }); + + // Test that the control is not affected by user interaction when disabled. + test('ToggleWhenDisabled', function() { + assertNotDisabled(); + toggle.disabled = true; + assertDisabled(); + + triggerPointerDownMoveUpTapSequence(0 /* no pointermove */); + assertNotChecked(); + assertDisabled(); + + toggle.disabled = false; + triggerPointerDownMoveUpTapSequence(0 /* no pointermove */); + assertChecked(); + }); + + // Test that the control works as expected when the click() method is called. + test('ToggleWhenWithClick', function() { + assertNotDisabled(); + assertNotChecked(); + + // State should change because control is enabled. + toggle.click(); + assertChecked(); + + // State should *not* change because control is disabled. + toggle.disabled = true; + assertDisabled(); + toggle.click(); + assertChecked(); + }); +});
diff --git a/chrome/test/data/webui/cr_elements/cr_view_manager_test.m.js b/chrome/test/data/webui/cr_elements/cr_view_manager_test.m.js new file mode 100644 index 0000000..8427f551 --- /dev/null +++ b/chrome/test/data/webui/cr_elements/cr_view_manager_test.m.js
@@ -0,0 +1,107 @@ +// Copyright 2019 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 'chrome://resources/cr_elements/cr_view_manager/cr_view_manager.m.js'; +import {isVisible} from 'chrome://test/extensions/test_util.m.js'; + +suite('cr-view-manager-v3', function() { + let viewManager; + let parent; + let views; + + // Initialize an cr-view-manager inside a parent div before + // each test. + setup(function() { + PolymerTest.clearBody(); + document.body.innerHTML = ` + <div id="parent"> + <cr-view-manager id="viewManager"> + <div slot="view" id="viewOne">view 1</div> + <div slot="view" id="viewTwo">view 2</div> + <div slot="view" id="viewThree">view 3</div> + </cr-view-manager> + </div> + `; + parent = document.body.querySelector('#parent'); + viewManager = document.body.querySelector('#viewManager'); + }); + + test('visibility', function() { + function assertViewVisible(id, expectVisible) { + const expectFunc = expectVisible ? expectTrue : expectFalse; + expectFunc(isVisible(viewManager, '#' + id, true)); + } + + assertViewVisible('viewOne', false); + assertViewVisible('viewTwo', false); + assertViewVisible('viewThree', false); + + return viewManager.switchView('viewOne') + .then(() => { + assertViewVisible('viewOne', true); + assertViewVisible('viewTwo', false); + assertViewVisible('viewThree', false); + + return viewManager.switchView('viewThree'); + }) + .then(() => { + assertViewVisible('viewOne', false); + assertViewVisible('viewTwo', false); + assertViewVisible('viewThree', true); + }); + }); + + test('event firing', function() { + const viewOne = viewManager.querySelector('#viewOne'); + + const fired = new Set(); + const bubbled = new Set(); + + ['view-enter-start', + 'view-enter-finish', + 'view-exit-start', + 'view-exit-finish', + ].forEach(type => { + parent.addEventListener(type, () => { + bubbled.add(type); + }); + viewOne.addEventListener(type, () => { + fired.add(type); + }); + }); + + /** + * @param {string} eventName The event to check + * @param {boolean} expectFired Whether the event should have fired. + */ + function verifyEventFiredAndBubbled(eventName, expectFired) { + expectEquals(expectFired, fired.has(eventName)); + expectEquals(expectFired, bubbled.has(eventName)); + } + + // Setup the switch promise first. + let enterPromise = viewManager.switchView('viewOne'); + // view-enter-start should fire synchronously. + verifyEventFiredAndBubbled('view-enter-start', true); + // view-enter-finish should not fire yet. + verifyEventFiredAndBubbled('view-enter-finish', false); + return enterPromise + .then(() => { + // view-enter-finish should fire after animation. + verifyEventFiredAndBubbled('view-enter-finish', true); + + enterPromise = viewManager.switchView('viewTwo'); + // view-exit-start should fire synchronously. + verifyEventFiredAndBubbled('view-exit-start', true); + // view-exit-finish should not fire yet. + verifyEventFiredAndBubbled('view-exit-finish', false); + + return enterPromise; + }) + .then(() => { + // view-exit-finish should fire after animation. + verifyEventFiredAndBubbled('view-exit-finish', true); + }); + }); +});
diff --git a/chrome/test/data/webui/extensions/test_util.m.js b/chrome/test/data/webui/extensions/test_util.m.js new file mode 100644 index 0000000..59d2e366 --- /dev/null +++ b/chrome/test/data/webui/extensions/test_util.m.js
@@ -0,0 +1,254 @@ +// Copyright 2015 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. + +/** A mock to test that clicking on an element calls a specific method. */ +export class ClickMock { + /** + * Tests clicking on an element and expecting a call. + * @param {HTMLElement} element The element to click on. + * @param {string} callName The function expected to be called. + * @param {Array<*>=} opt_expectedArgs The arguments the function is + * expected to be called with. + * @param {*=} opt_returnValue The value to return from the function call. + */ + testClickingCalls(element, callName, opt_expectedArgs, opt_returnValue) { + const mock = new MockController(); + const mockMethod = mock.createFunctionMock(this, callName); + mockMethod.returnValue = opt_returnValue; + MockMethod.prototype.addExpectation.apply(mockMethod, opt_expectedArgs); + MockInteractions.tap(element); + mock.verifyMocks(); + } +} + +/** + * A mock to test receiving expected events and verify that they were called + * with the proper detail values. + */ +export class ListenerMock { + constructor() { + /** @private {Object<{satisfied: boolean, args: !Object}>} */ + this.listeners_ = {}; + } + + /** + * @param {string} eventName + * @param {Event} e + * @private + */ + onEvent_(eventName, e) { + assert(this.listeners_.hasOwnProperty(eventName)); + if (this.listeners_[eventName].satisfied) { + // Event was already called and checked. We could always make this + // more intelligent by allowing for subsequent calls, removing the + // listener, etc, but there's no need right now. + return; + } + const expected = this.listeners_[eventName].args || {}; + expectDeepEquals(e.detail, expected); + this.listeners_[eventName].satisfied = true; + } + + /** + * Adds an expected event. + * @param {!EventTarget} target + * @param {string} eventName + * @param {Object=} opt_eventArgs If omitted, will check that the details + * are empty (i.e., {}). + */ + addListener(target, eventName, opt_eventArgs) { + assert(!this.listeners_.hasOwnProperty(eventName)); + this.listeners_[eventName] = {args: opt_eventArgs || {}, satisfied: false}; + target.addEventListener(eventName, this.onEvent_.bind(this, eventName)); + } + + /** Verifies the expectations set. */ + verify() { + const missingEvents = []; + for (const key in this.listeners_) { + if (!this.listeners_[key].satisfied) { + missingEvents.push(key); + } + } + expectEquals(0, missingEvents.length, JSON.stringify(missingEvents)); + } +} + +/** + * A mock delegate for the item, capable of testing functionality. + * @implements {extensions.ItemDelegate} + */ +export class MockItemDelegate extends ClickMock { + /** @override */ + deleteItem(id) {} + + /** @override */ + setItemEnabled(id, enabled) {} + + /** @override */ + showItemDetails(id) {} + + /** @override */ + setItemAllowedIncognito(id, enabled) {} + + /** @override */ + setItemAllowedOnFileUrls(id, enabled) {} + + /** @override */ + setItemHostAccess(id, hostAccess) {} + + /** @override */ + setItemCollectsErrors(id, enabled) {} + + /** @override */ + inspectItemView(id, view) {} + + /** @override */ + reloadItem(id) {} + + /** @override */ + repairItem(id) {} + + /** @override */ + showItemOptionsPage(id) {} + + /** @override */ + showInFolder(id) {} + + /** @override */ + getExtensionSize(id) { + return Promise.resolve('10 MB'); + } +} + +/** + * @param {!HTMLElement} element + * @return {boolean} whether or not the element passed in is visible + */ +export function isElementVisible(element) { + const rect = element.getBoundingClientRect(); + return rect.width * rect.height > 0; // Width and height is never negative. +} + +/** + * Returns whether or not the element specified is visible. This is different + * from isElementVisible in that this function attempts to search for the + * element within a parent element, which means you can use it to check if + * the element exists at all. + * @param {!HTMLElement} parentEl + * @param {string} selector + * @param {boolean=} checkLightDom + * @return {boolean} + */ +export function isVisible(parentEl, selector, checkLightDom) { + const element = (checkLightDom ? parentEl.querySelector : parentEl.$$) + .call(parentEl, selector); + const rect = element ? element.getBoundingClientRect() : null; + return !!rect && rect.width * rect.height > 0; +} + +/** + * Tests that the element's visibility matches |expectedVisible| and, + * optionally, has specific content if it is visible. + * @param {!HTMLElement} parentEl The parent element to query for the element. + * @param {string} selector The selector to find the element. + * @param {boolean} expectedVisible Whether the element should be + * visible. + * @param {string=} opt_expectedText The expected textContent value. + */ +export function testVisible( + parentEl, selector, expectedVisible, opt_expectedText) { + const visible = isVisible(parentEl, selector); + expectEquals(expectedVisible, visible, selector); + if (expectedVisible && visible && opt_expectedText) { + const element = parentEl.$$(selector); + expectEquals(opt_expectedText, element.textContent.trim(), selector); + } +} + +/** + * Creates an ExtensionInfo object. + * @param {Object=} opt_properties A set of properties that will be used on + * the resulting ExtensionInfo (otherwise defaults will be used). + * @return {chrome.developerPrivate.ExtensionInfo} + */ +export function createExtensionInfo(opt_properties) { + const id = opt_properties && opt_properties.hasOwnProperty('id') ? + opt_properties['id'] : + 'a'.repeat(32); + const baseUrl = 'chrome-extension://' + id + '/'; + return Object.assign( + { + commands: [], + dependentExtensions: [], + description: 'This is an extension', + disableReasons: { + suspiciousInstall: false, + corruptInstall: false, + updateRequired: false, + }, + homePage: {specified: false, url: ''}, + iconUrl: 'chrome://extension-icon/' + id + '/24/0', + id: id, + incognitoAccess: {isEnabled: true, isActive: false}, + location: 'FROM_STORE', + manifestErrors: [], + name: 'Wonderful Extension', + runtimeErrors: [], + runtimeWarnings: [], + permissions: {simplePermissions: []}, + state: 'ENABLED', + type: 'EXTENSION', + userMayModify: true, + version: '2.0', + views: [{url: baseUrl + 'foo.html'}, {url: baseUrl + 'bar.html'}], + }, + opt_properties); +} + +/** + * Tests that any visible iron-icon child of an HTML element has a + * corresponding non-empty svg element. + * @param {HTMLElement} e The element to check the iron icons in. + */ +export function testIcons(e) { + e.querySelectorAll('* /deep/ iron-icon').forEach(function(icon) { + if (isElementVisible(icon)) { + const svg = icon.$$('svg'); + expectTrue( + !!svg && svg.innerHTML != '', + 'icon "' + icon.icon + '" is not present'); + } + }); +} + +/** + * Finds all nodes matching |query| under |root|, within self and children's + * Shadow DOM. + * @param {!Node} root + * @param {string} query The CSS query + * @return {!Array<!HTMLElement>} + */ +export function findMatches(root, query) { + let elements = new Set(); + function doSearch(node) { + if (node.nodeType == Node.ELEMENT_NODE) { + const matches = node.querySelectorAll(query); + for (let match of matches) { + elements.add(match); + } + } + let child = node.firstChild; + while (child !== null) { + doSearch(child); + child = child.nextSibling; + } + const shadowRoot = node.shadowRoot; + if (shadowRoot) { + doSearch(shadowRoot); + } + } + doSearch(root); + return Array.from(elements); +}
diff --git a/chrome/test/data/webui/mock_timer.m.js b/chrome/test/data/webui/mock_timer.m.js new file mode 100644 index 0000000..732785f0 --- /dev/null +++ b/chrome/test/data/webui/mock_timer.m.js
@@ -0,0 +1,204 @@ +// Copyright 2019 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. + +/** Overrides timeout and interval callbacks to mock timing behavior. */ +export class MockTimer { + constructor() { + /** + * Default versions of the timing functions. + * @type {Object<string, !Function>} + * @private + */ + this.originals_ = []; + + /** + * Key to assign on the next creation of a scheduled timer. Each call to + * setTimeout or setInterval returns a unique key that can be used for + * clearing the timer. + * @type {number} + * @private + */ + this.nextTimerKey_ = 1; + + /** + * Details for active timers. + * @type {Array<{callback: Function, + * delay: number, + * key: number, + * repeats: boolean}>} + * @private + */ + this.timers_ = []; + + /** + * List of scheduled tasks. + * @type {Array<{when: number, key: number}>} + * @private + */ + this.schedule_ = []; + + /** + * Virtual elapsed time in milliseconds. + * @type {number} + * @private + */ + this.now_ = 0; + + /** + * Used to control when scheduled callbacks fire. Calling the 'tick' method + * inflates this parameter and triggers callbacks. + * @type {number} + * @private + */ + this.until_ = 0; + } + + /** + * Replaces built-in functions for scheduled callbacks. + */ + install() { + this.replace_('setTimeout', this.setTimeout_.bind(this)); + this.replace_('clearTimeout', this.clearTimeout_.bind(this)); + this.replace_('setInterval', this.setInterval_.bind(this)); + this.replace_('clearInterval', this.clearInterval_.bind(this)); + } + + /** + * Restores default behavior for scheduling callbacks. + */ + uninstall() { + if (this.originals_) { + for (var key in this.originals_) { + window[key] = this.originals_[key]; + } + } + } + + /** + * Overrides a global function. + * @param {string} functionName The name of the function. + * @param {!Function} replacementFunction The function override. + * @private + */ + replace_(functionName, replacementFunction) { + this.originals_[functionName] = window[functionName]; + window[functionName] = replacementFunction; + } + + /** + * Creates a virtual timer. + * @param {!Function} callback The callback function. + * @param {number} delayInMs The virtual delay in milliseconds. + * @param {boolean} repeats Indicates if the timer repeats. + * @return {number} Idetifier for the timer. + * @private + */ + createTimer_(callback, delayInMs, repeats) { + var key = this.nextTimerKey_++; + var task = + {callback: callback, delay: delayInMs, key: key, repeats: repeats}; + this.timers_[key] = task; + this.scheduleTask_(task); + return key; + } + + /** + * Schedules a callback for execution after a virtual time delay. The tasks + * are sorted in descending order of time delay such that the next callback + * to fire is at the end of the list. + * @param {{callback: Function, + * delay: number, + * key: number, + * repeats: boolean}} details The timer details. + * @private + */ + scheduleTask_(details) { + var key = details.key; + var when = this.now_ + details.delay; + var index = this.schedule_.length; + while (index > 0 && this.schedule_[index - 1].when < when) { + index--; + } + this.schedule_.splice(index, 0, {when: when, key: key}); + } + + /** + * Override of window.setInterval. + * @param {!Function} callback The callback function. + * @param {number} intervalInMs The repeat interval. + * @private + */ + setInterval_(callback, intervalInMs) { + return this.createTimer_(callback, intervalInMs, true); + } + + /** + * Override of window.clearInterval. + * @param {number} key The ID of the interval timer returned from + * setInterval. + * @private + */ + clearInterval_(key) { + this.timers_[key] = undefined; + } + + /** + * Override of window.setTimeout. + * @param {!Function} callback The callback function. + * @param {number} delayInMs The scheduled delay. + * @private + */ + setTimeout_(callback, delayInMs) { + return this.createTimer_(callback, delayInMs, false); + } + + /** + * Override of window.clearTimeout. + * @param {number} key The ID of the schedule timeout callback returned + * from setTimeout. + * @private + */ + clearTimeout_(key) { + this.timers_[key] = undefined; + } + + /** + * Simulates passage of time, triggering any scheduled callbacks whose timer + * has elapsed. + * @param {number} elapsedMs The simulated elapsed time in milliseconds. + */ + tick(elapsedMs) { + this.until_ += elapsedMs; + this.fireElapsedCallbacks_(); + } + + /** + * Triggers any callbacks that should have fired based in the simulated + * timing. + * @private + */ + fireElapsedCallbacks_() { + while (this.schedule_.length > 0) { + var when = this.schedule_[this.schedule_.length - 1].when; + if (when > this.until_) { + break; + } + + var task = this.schedule_.pop(); + var details = this.timers_[task.key]; + if (!details) { + continue; + } // Cancelled task. + + this.now_ = when; + details.callback.apply(window); + if (details.repeats) { + this.scheduleTask_(details); + } else { + this.clearTimeout_(details.key); + } + } + this.now_ = this.until_; + } +}
diff --git a/chrome/test/data/webui/settings/chromeos/cups_printer_landing_page_tests.js b/chrome/test/data/webui/settings/chromeos/cups_printer_landing_page_tests.js index f4d763a..a304f84 100644 --- a/chrome/test/data/webui/settings/chromeos/cups_printer_landing_page_tests.js +++ b/chrome/test/data/webui/settings/chromeos/cups_printer_landing_page_tests.js
@@ -65,7 +65,8 @@ const listElement = printersElement.$$('settings-cups-printers-entry-list'); const entryList = listElement.$$('#printerEntryList'); - return entryList.querySelectorAll('settings-cups-printers-entry'); + return entryList.querySelectorAll( + 'settings-cups-printers-entry:not([hidden])'); } /** @@ -91,6 +92,15 @@ } /** + * @param {!NetworkingPrivate} api + * @param {!Array<crOnc.NetworkStateProperties>} networks + */ +function setNetworksForTest(api, networks) { + api.resetForTest(); + api.addNetworksForTest(networks); +} + +/** * @param {string} expectedMessage * @param {!HTMLElement} toast * @private @@ -115,6 +125,7 @@ assertEquals(printerInfo.printerName, entryInfo.printerName); assertEquals(printerInfo.printerAddress, entryInfo.printerAddress); assertEquals(printerInfo.printerId, entryInfo.printerId); + assertEquals(entryList.length, printerList.length); } } @@ -142,6 +153,7 @@ return cupsPrintersBrowserProxy.whenCalled('getCupsPrintersList'); }) .then(function() { + entryList = getPrinterEntries(savedPrinters); verifyPrintersList(entryList, printerList); }); } @@ -188,6 +200,18 @@ /** @type {?Array<!CupsPrinterInfo>} */ let printerList = null; + /** @type {NetworkingPrivate} */ + let api_; + + /** @type {?chromeos.networkConfig.mojom.CrosNetworkConfigProxy} */ + let mojoApi_; + + suiteSetup(function() { + api_ = new chrome.FakeNetworkingPrivate(); + mojoApi_ = new FakeNetworkConfig(api_); + network_config.MojoInterfaceProviderImpl.getInstance().proxy_ = mojoApi_; + }); + setup(function() { printerList = [ createCupsPrinterInfo('google', '4', 'id4'), @@ -203,6 +227,16 @@ cupsPrintersBrowserProxy.printerList = {printerList: printerList}; settings.CupsPrintersBrowserProxyImpl.instance_ = cupsPrintersBrowserProxy; + // Simulate internet connection. + api_.resetForTest(); + setNetworksForTest(api_, [{ + GUID: 'wifi1_guid', + Name: 'wifi1', + Type: 'WiFi', + ConnectionState: 'Connected', + }]); + api_.enableNetworkType('WiFi'); + PolymerTest.clearBody(); page = document.createElement('settings-cups-printers'); // Enable feature flag to show the new saved printers list. @@ -218,6 +252,7 @@ }); teardown(function() { + api_.resetForTest(); cupsPrintersBrowserProxy.reset(); page.remove(); savedPrintersElement = null; @@ -238,8 +273,6 @@ const printerListEntries = getPrinterEntries(savedPrintersElement); verifyPrintersList(printerListEntries, printerList); - - assertEquals(printerList.length, printerListEntries.length); }); }); @@ -376,12 +409,55 @@ /** @type {?settings.TestCupsPrintersBrowserProxy} */ let cupsPrintersBrowserProxy = null; + /** @type {?NetworkingPrivate} */ + let api_; + + /** @type {?chromeos.networkConfig.mojom.CrosNetworkConfigProxy} */ + let mojoApi_; + + /** @type {!Array<crOnc.NetworkStateProperties>} networks */ + let activeNetworks_; + + /** + * @param {string} guid + * @param {string} state + */ + function setNetworkConnectionState(guid, state) { + let network = activeNetworks_.find((state) => { + return state.GUID == guid; + }); + assertTrue(!!network); + network.ConnectionState = state; + + // TODO(jimmyxgong): Remove this hack by moving |networkStateToMojo_| to + // onc_mojo.js. + mojoApi_.getNetworkState(network.GUID).then(({result}) => { + api_.onActiveNetworksChanged.callListeners([result]); + }); + } + + suiteSetup(function() { + api_ = new chrome.FakeNetworkingPrivate(); + mojoApi_ = new FakeNetworkConfig(api_); + network_config.MojoInterfaceProviderImpl.getInstance().proxy_ = mojoApi_; + }); + setup(function() { cupsPrintersBrowserProxy = new printerBrowserProxy.TestCupsPrintersBrowserProxy; settings.CupsPrintersBrowserProxyImpl.instance_ = cupsPrintersBrowserProxy; + // Simulate internet connection. + api_.resetForTest(); + activeNetworks_ = [{ + GUID: 'wifi1_guid', + Name: 'wifi1', + Type: 'WiFi', + ConnectionState: 'Online', + }]; + setNetworksForTest(api_, activeNetworks_); + PolymerTest.clearBody(); page = document.createElement('settings-cups-printers'); // Enable feature flag to show the new saved printers list. @@ -391,12 +467,10 @@ assertTrue(!!page); Polymer.dom.flush(); - - nearbyPrintersElement = page.$$('settings-cups-nearby-printers'); - assertTrue(!!nearbyPrintersElement); }); teardown(function() { + api_.resetForTest(); cupsPrintersBrowserProxy.reset(); page.remove(); nearbyPrintersElement = null; @@ -413,34 +487,38 @@ createCupsPrinterInfo('test4', '4', 'id4'), ]; - return cupsPrintersBrowserProxy.whenCalled('startDiscoveringPrinters') - .then(function() { - // Assert that no printers have been detected. - let nearbyPrinterEntries = getPrinterEntries(nearbyPrintersElement); - assertEquals(0, nearbyPrinterEntries.length); + return PolymerTest.flushTasks().then(() => { + nearbyPrintersElement = page.$$('settings-cups-nearby-printers'); + assertTrue(!!nearbyPrintersElement); - // Simuluate finding nearby printers. - cr.webUIListenerCallback( - 'on-nearby-printers-changed', automaticPrinterList, - discoveredPrinterList); + // Assert that no printers have been detected. + let nearbyPrinterEntries = getPrinterEntries(nearbyPrintersElement); + assertEquals(0, nearbyPrinterEntries.length); - Polymer.dom.flush(); + // Simuluate finding nearby printers. + cr.webUIListenerCallback( + 'on-nearby-printers-changed', automaticPrinterList, + discoveredPrinterList); - nearbyPrinterEntries = getPrinterEntries(nearbyPrintersElement); + Polymer.dom.flush(); - const expectedPrinterList = - automaticPrinterList.concat(discoveredPrinterList); - verifyPrintersList(nearbyPrinterEntries, expectedPrinterList); - assertEquals(expectedPrinterList.length, nearbyPrinterEntries.length); - }); + nearbyPrinterEntries = getPrinterEntries(nearbyPrintersElement); + + const expectedPrinterList = + automaticPrinterList.concat(discoveredPrinterList); + verifyPrintersList(nearbyPrinterEntries, expectedPrinterList); + }); }); test('addingAutomaticPrinterIsSuccessful', function() { const automaticPrinterList = [createCupsPrinterInfo('test1', '1', 'id1')]; const discoveredPrinterList = []; - return cupsPrintersBrowserProxy.whenCalled('startDiscoveringPrinters') - .then(function() { + return PolymerTest.flushTasks() + .then(() => { + nearbyPrintersElement = page.$$('settings-cups-nearby-printers'); + assertTrue(!!nearbyPrintersElement); + // Assert that no printers are detected. let nearbyPrinterEntries = getPrinterEntries(nearbyPrintersElement); assertEquals(0, nearbyPrinterEntries.length); @@ -466,7 +544,7 @@ return cupsPrintersBrowserProxy.whenCalled('addDiscoveredPrinter'); }) - .then(function() { + .then(() => { const expectedToastMessage = 'Added ' + automaticPrinterList[0].printerName; verifyErrorToastMessage(expectedToastMessage, page.$$('#errorToast')); @@ -479,8 +557,11 @@ let manufacturerDialog = null; - return cupsPrintersBrowserProxy.whenCalled('startDiscoveringPrinters') - .then(function() { + return PolymerTest.flushTasks() + .then(() => { + nearbyPrintersElement = page.$$('settings-cups-nearby-printers'); + assertTrue(!!nearbyPrintersElement); + // Assert that there are initially no detected printers. let nearbyPrinterEntries = getPrinterEntries(nearbyPrintersElement); assertEquals(0, nearbyPrinterEntries.length); @@ -492,8 +573,8 @@ Polymer.dom.flush(); - // Requery and assert that a newly detected discovered printer has the - // correct icon button. + // Requery and assert that a newly detected discovered printer has + // the correct icon button. nearbyPrinterEntries = getPrinterEntries(nearbyPrintersElement); assertEquals(1, nearbyPrinterEntries.length); assertTrue(!!nearbyPrinterEntries[0].$$('.action-button')); @@ -512,7 +593,7 @@ return cupsPrintersBrowserProxy.whenCalled( 'getCupsPrinterManufacturersList'); }) - .then(function() { + .then(() => { const addButton = manufacturerDialog.$$('#addPrinterButton'); assertTrue(addButton.disabled); @@ -527,7 +608,7 @@ addButton.click(); return cupsPrintersBrowserProxy.whenCalled('addCupsPrinter'); }) - .then(function() { + .then(() => { // Assert that the toast notification is shown and has the expected // message when adding a discovered printer. const expectedToastMessage = @@ -535,4 +616,58 @@ verifyErrorToastMessage(expectedToastMessage, page.$$('#errorToast')); }); }); + + test('NetworkConnectedButNoInternet', function() { + // Simulate connecting to a network with no internet connection. + setNetworkConnectionState('wifi1_guid', 'Connected'); + return PolymerTest.flushTasks().then(() => { + // We require internet to be able to add a new printer. Connecting to + // a network without connectivity should be equivalent to not being + // connected to a network. + assertTrue(!!page.$$('#cloudOffIcon')); + assertTrue(!!page.$$('#connectionMessage')); + }); + }); + + test('checkNetworkConnection', function() { + // Simulate disconnecting from a network. + setNetworkConnectionState('wifi1_guid', 'NotConnected'); + return PolymerTest.flushTasks() + .then(() => { + // Expect "Check Connection" text to show up when no internet is + // connected. + assertTrue(!!page.$$('#cloudOffIcon')); + assertTrue(!!page.$$('#connectionMessage')); + + // Simulate connecting to a network with connectivity. + setNetworkConnectionState('wifi1_guid', 'Online'); + return PolymerTest.flushTasks(); + }) + .then(() => { + const automaticPrinterList = [ + createCupsPrinterInfo('test1', '1', 'id1'), + createCupsPrinterInfo('test2', '2', 'id2'), + ]; + const discoveredPrinterList = [ + createCupsPrinterInfo('test3', '3', 'id3'), + createCupsPrinterInfo('test4', '4', 'id4'), + ]; + + // Simuluate finding nearby printers. + cr.webUIListenerCallback( + 'on-nearby-printers-changed', automaticPrinterList, + discoveredPrinterList); + + Polymer.dom.flush(); + + nearbyPrintersElement = page.$$('settings-cups-nearby-printers'); + assertTrue(!!nearbyPrintersElement); + + nearbyPrinterEntries = getPrinterEntries(nearbyPrintersElement); + + const expectedPrinterList = + automaticPrinterList.concat(discoveredPrinterList); + verifyPrintersList(nearbyPrinterEntries, expectedPrinterList); + }); + }); });
diff --git a/chrome/test/data/webui/settings/chromeos/os_settings_browsertest.js b/chrome/test/data/webui/settings/chromeos/os_settings_browsertest.js index c5b5730..7823e8e 100644 --- a/chrome/test/data/webui/settings/chromeos/os_settings_browsertest.js +++ b/chrome/test/data/webui/settings/chromeos/os_settings_browsertest.js
@@ -765,8 +765,12 @@ get extraLibraries() { return super.extraLibraries.concat([ '//ui/webui/resources/js/assert.js', + '//ui/webui/resources/js/promise_resolver.js', BROWSER_SETTINGS_PATH + 'test_util.js', BROWSER_SETTINGS_PATH + '../test_browser_proxy.js', + BROWSER_SETTINGS_PATH + '../fake_chrome_event.js', + BROWSER_SETTINGS_PATH + '../chromeos/fake_networking_private.js', + BROWSER_SETTINGS_PATH + '../chromeos/fake_network_config_mojom.js', 'test_cups_printers_browser_proxy.js', 'cups_printer_landing_page_tests.js', ]);
diff --git a/chrome/test/data/webui/settings/test_util.m.js b/chrome/test/data/webui/settings/test_util.m.js new file mode 100644 index 0000000..90ed2b9 --- /dev/null +++ b/chrome/test/data/webui/settings/test_util.m.js
@@ -0,0 +1,271 @@ +// Copyright 2016 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. + +/** + * Observes an HTML attribute and fires a promise when it matches a given + * value. + * @param {!HTMLElement} target + * @param {string} attributeName + * @param {*} attributeValue + * @return {!Promise} + */ +export function whenAttributeIs(target, attributeName, attributeValue) { + function isDone() { + return target.getAttribute(attributeName) == attributeValue; + } + + return isDone() ? Promise.resolve() : new Promise(function(resolve) { + new MutationObserver(function(mutations, observer) { + for (const mutation of mutations) { + assertEquals('attributes', mutation.type); + if (mutation.attributeName == attributeName && isDone()) { + observer.disconnect(); + resolve(); + return; + } + } + }) + .observe( + target, {attributes: true, childList: false, characterData: false}); + }); +} + +/** + * Converts an event occurrence to a promise. + * @param {string} eventType + * @param {!HTMLElement} target + * @return {!Promise} A promise firing once the event occurs. + */ +export function eventToPromise(eventType, target) { + return new Promise(function(resolve, reject) { + target.addEventListener(eventType, function f(e) { + target.removeEventListener(eventType, f); + resolve(e); + }); + }); +} + +/** + * Data-binds two Polymer properties using the property-changed events and + * set/notifyPath API. Useful for testing components which would normally be + * used together. + * @param {!HTMLElement} el1 + * @param {!HTMLElement} el2 + * @param {string} property + */ +export function fakeDataBind(el1, el2, property) { + const forwardChange = function(el, event) { + if (event.detail.hasOwnProperty('path')) { + el.notifyPath(event.detail.path, event.detail.value); + } else { + el.set(property, event.detail.value); + } + }; + // Add the listeners symmetrically. Polymer will prevent recursion. + el1.addEventListener(property + '-changed', forwardChange.bind(null, el2)); + el2.addEventListener(property + '-changed', forwardChange.bind(null, el1)); +} + +/** + * Helper to create an object containing a ContentSettingsType key to array or + * object value. This is a convenience function that can eventually be + * replaced with ES6 computed properties. + * @param {settings.ContentSettingsTypes} contentType The ContentSettingsType + * to use as the key. + * @param {Object} value The value to map to |contentType|. + * @return {Object<setting: settings.ContentSettingsTypes, value: Object>} + */ +export function createContentSettingTypeToValuePair(contentType, value) { + return {setting: contentType, value: value}; +} + +/** + * Helper to create a mock DefaultContentSetting. + * @param {!Object=} override An object with a subset of the properties of + * DefaultContentSetting. Properties defined in |override| will + * overwrite the defaults in this function's return value. + * @return {DefaultContentSetting} + */ +export function createDefaultContentSetting(override) { + if (override === undefined) { + override = {}; + } + return Object.assign( + { + setting: settings.ContentSetting.ASK, + source: settings.SiteSettingSource.PREFERENCE, + }, + override); +} + +/** + * Helper to create a mock RawSiteException. + * @param {!string} origin The origin to use for this RawSiteException. + * @param {!Object=} override An object with a subset of the properties of + * RawSiteException. Properties defined in |override| will overwrite the + * defaults in this function's return value. + * @return {RawSiteException} + */ +export function createRawSiteException(origin, override) { + if (override === undefined) { + override = {}; + } + return Object.assign( + { + embeddingOrigin: origin, + incognito: false, + origin: origin, + displayName: '', + setting: settings.ContentSetting.ALLOW, + source: settings.SiteSettingSource.PREFERENCE, + }, + override); +} + +/** + * Helper to create a mock RawChooserException. + * @param {!settings.ChooserType} chooserType The chooser exception type. + * @param {Array<!RawSiteException>} sites A list of SiteExceptions + * corresponding to the chooser exception. + * @param {!Object=} override An object with a subset of the properties of + * RawChooserException. Properties defined in |override| will overwrite + * the defaults in this function's return value. + * @return {RawChooserException} + */ +export function createRawChooserException(chooserType, sites, override) { + return Object.assign( + {chooserType: chooserType, displayName: '', object: {}, sites: sites}, + override || {}); +} + +/** + * Helper to create a mock SiteSettingsPref. + * @param {!Array<{setting: settings.ContentSettingsTypes, + * value: DefaultContentSetting}>} defaultsList A list of + * DefaultContentSettings and the content settings they apply to, which + * will overwrite the defaults in the SiteSettingsPref returned by this + * function. + * @param {!Array<{setting: settings.ContentSettingsTypes, + * value: !Array<RawSiteException>}>} exceptionsList A list of + * RawSiteExceptions and the content settings they apply to, which will + * overwrite the exceptions in the SiteSettingsPref returned by this + * function. + * @param {!Array<{setting: settings.ContentSettingsTypes, + * value: !Array<RawChooserException>}>} chooserExceptionsList + * A list of RawChooserExceptions and the chooser type that they apply to, + * which will overwrite the exceptions in the SiteSettingsPref returned by + * this function. + * @return {SiteSettingsPref} + */ +export function createSiteSettingsPrefs( + defaultsList, exceptionsList, chooserExceptionsList = []) { + // These test defaults reflect the actual defaults assigned to each + // ContentSettingType, but keeping these in sync shouldn't matter for tests. + const defaults = {}; + for (let type in settings.ContentSettingsTypes) { + defaults[settings.ContentSettingsTypes[type]] = + createDefaultContentSetting({}); + } + defaults[settings.ContentSettingsTypes.COOKIES].setting = + settings.ContentSetting.ALLOW; + defaults[settings.ContentSettingsTypes.IMAGES].setting = + settings.ContentSetting.ALLOW; + defaults[settings.ContentSettingsTypes.JAVASCRIPT].setting = + settings.ContentSetting.ALLOW; + defaults[settings.ContentSettingsTypes.SOUND].setting = + settings.ContentSetting.ALLOW; + defaults[settings.ContentSettingsTypes.POPUPS].setting = + settings.ContentSetting.BLOCK; + defaults[settings.ContentSettingsTypes.PROTOCOL_HANDLERS].setting = + settings.ContentSetting.ALLOW; + defaults[settings.ContentSettingsTypes.BACKGROUND_SYNC].setting = + settings.ContentSetting.ALLOW; + defaults[settings.ContentSettingsTypes.ADS].setting = + settings.ContentSetting.BLOCK; + defaults[settings.ContentSettingsTypes.SENSORS].setting = + settings.ContentSetting.ALLOW; + defaults[settings.ContentSettingsTypes.USB_DEVICES].setting = + settings.ContentSetting.ASK; + defaultsList.forEach((override) => { + defaults[override.setting] = override.value; + }); + + const chooserExceptions = {}; + const exceptions = {}; + for (let type in settings.ContentSettingsTypes) { + chooserExceptions[settings.ContentSettingsTypes[type]] = []; + exceptions[settings.ContentSettingsTypes[type]] = []; + } + exceptionsList.forEach(override => { + exceptions[override.setting] = override.value; + }); + chooserExceptionsList.forEach(override => { + chooserExceptions[override.setting] = override.value; + }); + + return { + chooserExceptions: chooserExceptions, + defaults: defaults, + exceptions: exceptions, + }; +} + +/** + * Helper to create a mock SiteGroup. + * @param {!string} eTLDPlus1Name The eTLD+1 of all the origins provided in + * |originList|. + * @param {!Array<string>} originList A list of the origins with the same + * eTLD+1. + * @return {SiteGroup} + */ +export function createSiteGroup(eTLDPlus1Name, originList) { + const originInfoList = originList.map(origin => createOriginInfo(origin)); + return { + etldPlus1: eTLDPlus1Name, + origins: originInfoList, + numCookies: 0, + }; +} + +export function createOriginInfo(origin, override) { + if (override === undefined) { + override = {}; + } + return Object.assign( + { + origin: origin, + engagement: 0, + usage: 0, + numCookies: 0, + hasPermissionSettings: false, + }, + override); +} + +/** + * Helper to retrieve the category of a permission from the given + * |chooserType|. + * @param {settings.ChooserType} chooserType The chooser type of the + * permission. + * @return {?settings.ContentSettingsType} + */ +export function getContentSettingsTypeFromChooserType(chooserType) { + switch (chooserType) { + case settings.ChooserType.USB_DEVICES: + return settings.ContentSettingsTypes.USB_DEVICES; + default: + return null; + } +} + +/** + * Converts beforeNextRender() API to promise-based. + * @param {!Element} element + * @return {!Promise} + */ +export function waitForRender(element) { + return new Promise(resolve => { + Polymer.RenderStatus.beforeNextRender(element, resolve); + }); +}
diff --git a/chrome/tools/service_discovery_sniffer/service_discovery_sniffer.cc b/chrome/tools/service_discovery_sniffer/service_discovery_sniffer.cc index 80e8f568..98ffbab1 100644 --- a/chrome/tools/service_discovery_sniffer/service_discovery_sniffer.cc +++ b/chrome/tools/service_discovery_sniffer/service_discovery_sniffer.cc
@@ -9,6 +9,7 @@ #include "base/at_exit.h" #include "base/bind.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "chrome/browser/local_discovery/service_discovery_client_impl.h" @@ -98,7 +99,7 @@ int main(int argc, char** argv) { base::AtExitManager at_exit_manager; - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); if (argc != 2) { printf("Please provide exactly 1 argument.\n");
diff --git a/chrome/updater/updater.cc b/chrome/updater/updater.cc index bb04c80..4deeeed 100644 --- a/chrome/updater/updater.cc +++ b/chrome/updater/updater.cc
@@ -18,6 +18,7 @@ #include "base/files/file_path.h" #include "base/logging.h" #include "base/memory/scoped_refptr.h" +#include "base/message_loop/message_pump_type.h" #include "base/optional.h" #include "base/run_loop.h" #include "base/stl_util.h" @@ -186,8 +187,7 @@ installer->FindInstallOfApp(); const auto component = installer->MakeCrxComponent(); - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); base::RunLoop runloop; DCHECK(base::ThreadTaskRunnerHandle::IsSet());
diff --git a/chrome/utility/importer/firefox_importer_unittest_utils_mac.cc b/chrome/utility/importer/firefox_importer_unittest_utils_mac.cc index 9b003a7..e5d0321 100644 --- a/chrome/utility/importer/firefox_importer_unittest_utils_mac.cc +++ b/chrome/utility/importer/firefox_importer_unittest_utils_mac.cc
@@ -11,6 +11,7 @@ #include "base/files/file_util.h" #include "base/files/scoped_file.h" #include "base/location.h" +#include "base/message_loop/message_pump_type.h" #include "base/posix/global_descriptors.h" #include "base/process/kill.h" #include "base/process/launch.h" @@ -182,7 +183,7 @@ bool FFUnitTestDecryptorProxy::Setup(const base::FilePath& nss_path) { // Create a new task executor and spawn the child process. main_task_executor_ = std::make_unique<base::SingleThreadTaskExecutor>( - base::MessagePump::Type::IO); + base::MessagePumpType::IO); mojo::OutgoingInvitation invitation; std::string token = base::NumberToString(base::RandUint64()); @@ -241,7 +242,7 @@ // Entry function in child process. MULTIPROCESS_TEST_MAIN(NSSDecrypterChildProcess) { - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); auto* command_line = base::CommandLine::ForCurrentProcess(); auto endpoint = mojo::PlatformChannel::RecoverPassedEndpointFromCommandLine(
diff --git a/chromecast/browser/cast_content_browser_client.cc b/chromecast/browser/cast_content_browser_client.cc index 5e383970..40735a5 100644 --- a/chromecast/browser/cast_content_browser_client.cc +++ b/chromecast/browser/cast_content_browser_client.cc
@@ -399,8 +399,7 @@ } void CastContentBrowserClient::RenderProcessWillLaunch( - content::RenderProcessHost* host, - service_manager::mojom::ServiceRequest* service_request) { + content::RenderProcessHost* host) { // Forcibly trigger I/O-thread URLRequestContext initialization before // getting HostResolver. base::PostTaskWithTraitsAndReplyWithResult(
diff --git a/chromecast/browser/cast_content_browser_client.h b/chromecast/browser/cast_content_browser_client.h index aae8824..f5a6817b 100644 --- a/chromecast/browser/cast_content_browser_client.h +++ b/chromecast/browser/cast_content_browser_client.h
@@ -135,9 +135,7 @@ std::vector<std::string> GetStartupServices() override; std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts( const content::MainFunctionParams& parameters) override; - void RenderProcessWillLaunch( - content::RenderProcessHost* host, - service_manager::mojom::ServiceRequest* service_request) override; + void RenderProcessWillLaunch(content::RenderProcessHost* host) override; bool IsHandledURL(const GURL& url) override; void SiteInstanceGotProcess(content::SiteInstance* site_instance) override; void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
diff --git a/chromecast/browser/url_request_context_factory.cc b/chromecast/browser/url_request_context_factory.cc index a3646ba..f78e84fe 100644 --- a/chromecast/browser/url_request_context_factory.cc +++ b/chromecast/browser/url_request_context_factory.cc
@@ -34,7 +34,7 @@ #include "net/dns/host_resolver_manager.h" #include "net/http/http_auth_handler_factory.h" #include "net/http/http_network_layer.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/http/http_stream_factory.h" #include "net/proxy_resolution/proxy_resolution_service.h" #include "net/ssl/ssl_config_service_defaults.h" @@ -224,7 +224,7 @@ // Use in-memory HttpServerProperties. Disk-based can improve performance // but benefit seems small (only helps 1st request to a server). - http_server_properties_.reset(new net::HttpServerPropertiesImpl); + http_server_properties_ = std::make_unique<net::HttpServerProperties>(); DCHECK(proxy_config_service_); proxy_resolution_service_ =
diff --git a/chromecast/crash/linux/crash_uploader.cc b/chromecast/crash/linux/crash_uploader.cc index 16d96f4..a01d97dc 100644 --- a/chromecast/crash/linux/crash_uploader.cc +++ b/chromecast/crash/linux/crash_uploader.cc
@@ -11,6 +11,7 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/logging.h" +#include "base/message_loop/message_pump_type.h" #include "base/task/single_thread_task_executor.h" #include "base/threading/platform_thread.h" #include "base/time/time.h" @@ -41,7 +42,7 @@ setpriority(PRIO_PROCESS, 0, 19); // Create the main task executor. - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); std::unique_ptr<chromecast::CastSysInfo> sys_info = chromecast::CreateSysInfo();
diff --git a/chromecast/external_mojo/external_service_support/standalone_mojo_broker.cc b/chromecast/external_mojo/external_service_support/standalone_mojo_broker.cc index 4e840cc..77d194c 100644 --- a/chromecast/external_mojo/external_service_support/standalone_mojo_broker.cc +++ b/chromecast/external_mojo/external_service_support/standalone_mojo_broker.cc
@@ -7,6 +7,7 @@ #include "base/at_exit.h" #include "base/message_loop/message_pump_for_io.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "chromecast/external_mojo/external_service_support/process_setup.h" @@ -20,7 +21,7 @@ base::AtExitManager exit_manager; chromecast::external_service_support::CommonProcessInitialization(argc, argv); - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); base::RunLoop run_loop; mojo::core::Configuration mojo_config;
diff --git a/chromecast/external_mojo/external_service_support/standalone_service_main.cc b/chromecast/external_mojo/external_service_support/standalone_service_main.cc index 8982d5b..a2f7e5b 100644 --- a/chromecast/external_mojo/external_service_support/standalone_service_main.cc +++ b/chromecast/external_mojo/external_service_support/standalone_service_main.cc
@@ -8,6 +8,7 @@ #include "base/at_exit.h" #include "base/bind.h" #include "base/message_loop/message_pump_for_io.h" +#include "base/message_loop/message_pump_type.h" #include "base/task/single_thread_task_executor.h" #include "base/task/thread_pool/thread_pool.h" #include "chromecast/external_mojo/external_service_support/external_connector.h" @@ -40,7 +41,7 @@ base::AtExitManager exit_manager; chromecast::external_service_support::CommonProcessInitialization(argc, argv); - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); base::RunLoop run_loop; mojo::core::Init();
diff --git a/chromecast/tracing/tracing_service_main.cc b/chromecast/tracing/tracing_service_main.cc index 7914e21..21bc2847 100644 --- a/chromecast/tracing/tracing_service_main.cc +++ b/chromecast/tracing/tracing_service_main.cc
@@ -17,6 +17,7 @@ #include "base/memory/weak_ptr.h" #include "base/message_loop/message_loop_current.h" #include "base/message_loop/message_pump_for_io.h" +#include "base/message_loop/message_pump_type.h" #include "base/posix/eintr_wrapper.h" #include "base/posix/unix_domain_socket.h" #include "base/strings/string_split.h" @@ -401,7 +402,7 @@ LOG(INFO) << "Starting system tracing service..."; - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); chromecast::tracing::TracingService service; if (!service.Init())
diff --git a/chromeos/BUILD.gn b/chromeos/BUILD.gn index 67439dd..1ac6a422 100644 --- a/chromeos/BUILD.gn +++ b/chromeos/BUILD.gn
@@ -239,7 +239,6 @@ tast_test("chrome_all_tast_tests") { # To disable a specific test, add it the following list. tast_disabled_tests = [ - "security.SELinuxFilesARC", # crbug.com/968155 "ui.MashLogin", "ui.SingleProcessMashLogin", ]
diff --git a/chromeos/services/assistant/BUILD.gn b/chromeos/services/assistant/BUILD.gn index a380516..239ab49a 100644 --- a/chromeos/services/assistant/BUILD.gn +++ b/chromeos/services/assistant/BUILD.gn
@@ -137,6 +137,7 @@ testonly = true deps = [ ":lib", + "//ash/public/mojom", "//base", "//base/test:test_support", "//chromeos/audio",
diff --git a/chromeos/services/assistant/service_unittest.cc b/chromeos/services/assistant/service_unittest.cc index 7d2cef68..b48f37f 100644 --- a/chromeos/services/assistant/service_unittest.cc +++ b/chromeos/services/assistant/service_unittest.cc
@@ -9,7 +9,7 @@ #include <vector> #include "ash/public/cpp/voice_interaction_controller.h" -#include "ash/public/interfaces/constants.mojom-forward.h" +#include "ash/public/mojom/constants.mojom-forward.h" #include "base/bind.h" #include "base/logging.h" #include "base/macros.h"
diff --git a/components/BUILD.gn b/components/BUILD.gn index 19b8b90..6c6ac55 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn
@@ -100,7 +100,6 @@ "//components/gcm_driver/crypto:unit_tests", "//components/google/core/common:unit_tests", "//components/grpc_support/test:unit_tests", - "//components/gwp_asan:unit_tests", "//components/history/core/browser:unit_tests", "//components/history/core/common:unit_tests", "//components/image_fetcher/core:unit_tests",
diff --git a/components/autofill/content/renderer/html_based_username_detector.cc b/components/autofill/content/renderer/html_based_username_detector.cc index d43ea91..1d5608b 100644 --- a/components/autofill/content/renderer/html_based_username_detector.cc +++ b/components/autofill/content/renderer/html_based_username_detector.cc
@@ -5,7 +5,9 @@ #include "components/autofill/content/renderer/html_based_username_detector.h" #include <algorithm> +#include <string> #include <tuple> +#include <utility> #include "base/containers/flat_set.h" #include "base/i18n/case_conversion.h" @@ -15,6 +17,7 @@ #include "base/strings/utf_string_conversions.h" #include "components/autofill/content/renderer/form_autofill_util.h" #include "components/autofill/content/renderer/html_based_username_detector_vocabulary.h" +#include "components/autofill/core/common/form_data.h" #include "third_party/blink/public/web/web_form_element.h" using blink::WebFormControlElement; @@ -223,23 +226,25 @@ void FindWordsFromCategoryInForm( const std::vector<UsernameFieldData>& possible_usernames_data, const CategoryOfWords& category, - std::vector<blink::WebInputElement>* username_predictions) { + std::vector<uint32_t>* username_predictions) { // Auxiliary element that contains the first field (in order of appearance in // the form) in which a substring is encountered. - WebInputElement chosen_field; + uint32_t chosen_field_renderer_id = FormData::kNotSetFormRendererId; size_t fields_found = 0; for (const UsernameFieldData& field_data : possible_usernames_data) { if (ContainsWordFromCategory(field_data, category)) { - if (fields_found == 0) - chosen_field = field_data.input_element; + if (fields_found == 0) { + chosen_field_renderer_id = + field_data.input_element.UniqueRendererFormControlId(); + } fields_found++; } } if (fields_found > 0 && fields_found <= 2) - if (!base::Contains(*username_predictions, chosen_field)) - username_predictions->push_back(chosen_field); + if (!base::Contains(*username_predictions, chosen_field_renderer_id)) + username_predictions->push_back(chosen_field_renderer_id); } // Find username elements if there is no cached result for the given form and @@ -247,7 +252,7 @@ void FindUsernameFieldInternal( const std::vector<blink::WebFormControlElement>& all_control_elements, const FormData& form_data, - std::vector<blink::WebInputElement>* username_predictions) { + std::vector<uint32_t>* username_predictions) { DCHECK(username_predictions); DCHECK(username_predictions->empty()); @@ -279,9 +284,16 @@ } } +// Returns the |unique_renderer_id| of a given |WebFormElement|. If +// |WebFormElement::IsNull()| return |kNotSetFormRendererId|. +uint32_t GetFormRendererId(WebFormElement form) { + return form.IsNull() ? FormData::kNotSetFormRendererId + : form.UniqueRendererFormId(); +} + } // namespace -const std::vector<WebInputElement>& GetPredictionsFieldBasedOnHtmlAttributes( +const std::vector<uint32_t>& GetPredictionsFieldBasedOnHtmlAttributes( const std::vector<WebFormControlElement>& all_control_elements, const FormData& form_data, UsernameDetectorCache* username_detector_cache) { @@ -293,18 +305,17 @@ // All elements in |all_control_elements| should have the same |Form()|. DCHECK(AllElementsBelongsToSameForm(all_control_elements)); - - const WebFormElement form = all_control_elements[0].Form(); + const WebFormElement form = all_control_elements.at(0).Form(); // True if the cache has no entry for |form|. bool cache_miss = true; // Iterator pointing to the entry for |form| if the entry for |form| is found. UsernameDetectorCache::iterator form_position; std::tie(form_position, cache_miss) = username_detector_cache->insert( - std::make_pair(form, std::vector<WebInputElement>())); + std::make_pair(GetFormRendererId(form), std::vector<uint32_t>())); if (cache_miss) { - std::vector<WebInputElement> username_predictions; + std::vector<uint32_t> username_predictions; FindUsernameFieldInternal(all_control_elements, form_data, &username_predictions); if (!username_predictions.empty())
diff --git a/components/autofill/content/renderer/html_based_username_detector.h b/components/autofill/content/renderer/html_based_username_detector.h index ffebdd8..7b55abd 100644 --- a/components/autofill/content/renderer/html_based_username_detector.h +++ b/components/autofill/content/renderer/html_based_username_detector.h
@@ -6,6 +6,7 @@ #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_HTML_BASED_USERNAME_DETECTOR_H_ #include <map> +#include <vector> #include "components/autofill/core/common/password_form.h" #include "third_party/blink/public/web/web_form_control_element.h" @@ -13,10 +14,9 @@ namespace autofill { -// The detector's cache is a map from WebFormElement to the list of predictions -// for the given form (in the order of decreasing reliability). -using UsernameDetectorCache = - std::map<blink::WebFormElement, std::vector<blink::WebInputElement>>; +// The detector's cache is a map from a |unique_renderer_id| to the list of +// predictions for the given form (in the order of decreasing reliability). +using UsernameDetectorCache = std::map<uint32_t, std::vector<uint32_t>>; // Classifier for getting username field by analyzing HTML attribute values. // The algorithm looks for words that are likely to point to username field (ex. @@ -29,8 +29,7 @@ // data. Otherwise, the detector will be run and the outcome will be saved to // the cache. The function returns a reference to the vector of predictions, // which is stored in the cache. -const std::vector<blink::WebInputElement>& -GetPredictionsFieldBasedOnHtmlAttributes( +const std::vector<uint32_t>& GetPredictionsFieldBasedOnHtmlAttributes( const std::vector<blink::WebFormControlElement>& all_control_elements, const FormData& form_data, UsernameDetectorCache* username_detector_cache);
diff --git a/components/autofill/content/renderer/password_form_conversion_utils.cc b/components/autofill/content/renderer/password_form_conversion_utils.cc index 0560d44..ba2e575 100644 --- a/components/autofill/content/renderer/password_form_conversion_utils.cc +++ b/components/autofill/content/renderer/password_form_conversion_utils.cc
@@ -396,14 +396,8 @@ if (!username_detector_cache) username_detector_cache = &dummy_cache; - const std::vector<WebInputElement>& username_predictions_dom = - GetPredictionsFieldBasedOnHtmlAttributes(control_elements, form_data, - username_detector_cache); - username_predictions.reserve(username_predictions_dom.size()); - for (const WebInputElement& element : username_predictions_dom) { - username_predictions.push_back(element.UniqueRendererFormControlId()); - } - return username_predictions; + return GetPredictionsFieldBasedOnHtmlAttributes(control_elements, form_data, + username_detector_cache); } // Get information about a login form encapsulated in a PasswordForm struct.
diff --git a/components/autofill/content/renderer/password_form_conversion_utils_browsertest.cc b/components/autofill/content/renderer/password_form_conversion_utils_browsertest.cc index 53988a9..02b36b862 100644 --- a/components/autofill/content/renderer/password_form_conversion_utils_browsertest.cc +++ b/components/autofill/content/renderer/password_form_conversion_utils_browsertest.cc
@@ -30,10 +30,12 @@ #include "third_party/blink/public/web/web_input_element.h" #include "third_party/blink/public/web/web_local_frame.h" +using blink::WebElement; using blink::WebFormControlElement; using blink::WebFormElement; -using blink::WebLocalFrame; using blink::WebInputElement; +using blink::WebLocalFrame; +using blink::WebString; using blink::WebVector; namespace autofill { @@ -286,6 +288,16 @@ content::RenderViewTest::TearDown(); } + uint32_t GetRendererIdFromWebElementId(WebString id) { + WebLocalFrame* frame = GetMainFrame(); + if (!frame || frame->GetDocument().IsNull()) + return FormData::kNotSetFormRendererId; + WebElement element = frame->GetDocument().GetElementById(id); + if (element.IsNull()) + return FormData::kNotSetFormRendererId; + return element.To<WebInputElement>().UniqueRendererFormControlId(); + } + UsernameDetectorCache username_detector_cache_; private: @@ -373,73 +385,87 @@ const char* first_text_field_parameters[3]; const char* second_text_field_parameters[3]; const char* expected_username_element; + const WebString expected_username_id; const char* expected_username_value; } cases[] = { // There are both field name and id. - {{"username", "id", "johnsmith"}, - {"email", "id", "js@google.com"}, + {{"username", "x1d", "johnsmith"}, + {"email", "y1d", "js@google.com"}, "username", + "x1d", "johnsmith"}, // there is no field id. - {{"username", "", "johnsmith"}, - {"email", "", "js@google.com"}, + {{"username", "x1d", "johnsmith"}, + {"email", "y1d", "js@google.com"}, "username", + "x1d", "johnsmith"}, // Upper or mixed case shouldn't matter. - {{"uSeRnAmE", "id", "johnsmith"}, - {"email", "id", "js@google.com"}, + {{"uSeRnAmE", "x1d", "johnsmith"}, + {"email", "y1d", "js@google.com"}, "uSeRnAmE", + "x1d", "johnsmith"}, // Check removal of special characters. - {{"u1_s2-e3~r4/n5(a)6m#e", "", "johnsmith"}, - {"email", "", "js@google.com"}, + {{"u1_s2-e3~r4/n5(a)6m#e", "x1d", "johnsmith"}, + {"email", "y1d", "js@google.com"}, "u1_s2-e3~r4/n5(a)6m#e", + "x1d", "johnsmith"}, // Check guard between field name and field id. {{"us", "ername", "johnsmith"}, - {"email", "", "js@google.com"}, + {"email", "id", "js@google.com"}, "email", + "id", "js@google.com"}, // Check removal of fields with latin negative words in developer group. - {{"email", "", "js@google.com"}, - {"fake_username", "", "johnsmith"}, + {{"email", "x", "js@google.com"}, + {"fake_username", "y", "johnsmith"}, "email", + "x", "js@google.com"}, {{"email", "mail", "js@google.com"}, {"user_name", "fullname", "johnsmith"}, "email", + "mail", "js@google.com"}, // Identify latin translations of "username". - {{"benutzername", "", "johnsmith"}, - {"email", "", "js@google.com"}, + {{"benutzername", "x", "johnsmith"}, + {"email", "y", "js@google.com"}, "benutzername", + "x", "johnsmith"}, // Identify latin translations of "user". - {{"utilizator", "", "johnsmith"}, - {"email", "", "js@google.com"}, + {{"utilizator", "x1d", "johnsmith"}, + {"email", "y1d", "js@google.com"}, "utilizator", + "x1d", "johnsmith"}, // Identify technical words. - {{"loginid", "", "johnsmith"}, - {"email", "", "js@google.com"}, + {{"loginid", "x1d", "johnsmith"}, + {"email", "y1d", "js@google.com"}, "loginid", + "x1d", "johnsmith"}, // Identify weak words. - {{"usrname", "", "johnsmith"}, - {"email", "", "js@google.com"}, + {{"usrname", "x1d", "johnsmith"}, + {"email", "y1d", "js@google.com"}, "email", + "y1d", "js@google.com"}, // If a word matches in maximum 2 fields, it is accepted. // First encounter is selected as username. - {{"username", "", "johnsmith"}, - {"repeat_username", "", "johnsmith"}, + {{"username", "x1d", "johnsmith"}, + {"repeat_username", "y1d", "johnsmith"}, "username", + "x1d", "johnsmith"}, // A short word should be enclosed between delimiters. Otherwise, an // Occurrence doesn't count. {{"identity_name", "idn", "johnsmith"}, - {"id", "id", "123"}, + {"id", "xid", "123"}, "id", + "xid", "123"}}; for (size_t i = 0; i < base::size(cases); ++i) { @@ -459,10 +485,12 @@ std::string html = builder.ProduceHTML(); username_detector_cache_.clear(); + std::unique_ptr<PasswordForm> password_form = LoadHTMLAndConvertForm(html, nullptr, false); - ASSERT_TRUE(password_form); + uint32_t username_renderer_id = + GetRendererIdFromWebElementId(cases[i].expected_username_id); EXPECT_EQ(base::UTF8ToUTF16(cases[i].expected_username_element), password_form->username_element); @@ -471,9 +499,8 @@ // Check that the username field was found by HTML detector. ASSERT_EQ(1u, username_detector_cache_.size()); ASSERT_FALSE(username_detector_cache_.begin()->second.empty()); - EXPECT_EQ( - cases[i].expected_username_element, - username_detector_cache_.begin()->second[0].NameForAutofill().Utf8()); + EXPECT_EQ(username_renderer_id, + username_detector_cache_.begin()->second[0]); } } @@ -481,11 +508,11 @@ // If word matches in more than 2 fields, we don't match on it. // We search for match with another word. PasswordFormBuilder builder(kTestFormActionURL); - builder.AddTextFieldWithoutAutocomplete("address", "user", "someaddress", "", + builder.AddTextFieldWithoutAutocomplete("address", "xuser", "someaddress", "", ""); - builder.AddTextFieldWithoutAutocomplete("loginid", "user", "johnsmith", "", + builder.AddTextFieldWithoutAutocomplete("loginid", "yuser", "johnsmith", "", ""); - builder.AddTextFieldWithoutAutocomplete("tel", "user", "sometel", "", ""); + builder.AddTextFieldWithoutAutocomplete("tel", "zuser", "sometel", "", ""); builder.AddPasswordField("password", "secret", nullptr); builder.AddSubmitButton("submit"); std::string html = builder.ProduceHTML(); @@ -494,6 +521,8 @@ std::unique_ptr<PasswordForm> password_form = LoadHTMLAndConvertForm(html, nullptr, false); + uint32_t username_renderer_id = GetRendererIdFromWebElementId("yuser"); + ASSERT_TRUE(password_form); EXPECT_EQ(base::UTF8ToUTF16("loginid"), password_form->username_element); @@ -501,9 +530,7 @@ // Check that the username field was found by HTML detector. ASSERT_EQ(1u, username_detector_cache_.size()); ASSERT_EQ(1u, username_detector_cache_.begin()->second.size()); - EXPECT_EQ( - "loginid", - username_detector_cache_.begin()->second[0].NameForAutofill().Utf8()); + EXPECT_EQ(username_renderer_id, username_detector_cache_.begin()->second[0]); } TEST_F(PasswordFormConversionUtilsTest, HTMLDetector_UserGroupAttributes) { @@ -520,69 +547,82 @@ const char* first_text_field_parameters[4]; const char* second_text_field_parameters[4]; const char* expected_username_element; + const WebString expected_username_id; const char* expected_username_value; } cases[] = { // Label information will decide username. {{"name1", "id1", "johnsmith", "Username:"}, {"name2", "id2", "js@google.com", "Email:"}, "name1", + "id1", "johnsmith"}, // Placeholder information will decide username. {{"name1", "id1", "js@google.com", "Email:"}, {"name2", "id2", "johnsmith", "Username:"}, "name2", + "id2", "johnsmith"}, // Check removal of special characters. {{"name1", "id1", "johnsmith", "U s er n a m e:"}, {"name2", "id2", "js@google.com", "Email:"}, "name1", + "id1", "johnsmith"}, // Check removal of fields with latin negative words in user group. {{"name1", "id1", "johnsmith", "Username password:"}, {"name2", "id2", "js@google.com", "Email:"}, "name2", + "id2", "js@google.com"}, // Check removal of fields with non-latin negative words in user group. {{"name1", "id1", "js@google.com", "Email:"}, {"name2", "id2", "johnsmith", "የይለፍቃልየይለፍቃል:"}, "name1", + "id1", "js@google.com"}, // Identify latin translations of "username". {{"name1", "id1", "johnsmith", "Username:"}, {"name2", "id2", "js@google.com", "Email:"}, "name1", + "id1", "johnsmith"}, // Identify non-latin translations of "username". {{"name1", "id1", "johnsmith", "用户名:"}, {"name2", "id2", "js@google.com", "Email:"}, "name1", + "id1", "johnsmith"}, // Identify latin translations of "user". {{"name1", "id1", "johnsmith", "Wosuta:"}, {"name2", "id2", "js@google.com", "Email:"}, "name1", + "id1", "johnsmith"}, // Identify non-latin translations of "user". {{"name1", "id1", "johnsmith", "истифода:"}, {"name2", "id2", "js@google.com", "Email:"}, "name1", + "id1", "johnsmith"}, // Identify weak words. {{"name1", "id1", "johnsmith", "Insert your login details:"}, {"name2", "id2", "js@google.com", "Insert your email:"}, "name1", + "id1", "johnsmith"}, // Check user group priority, compared to developer group. // User group should have higher priority than developer group. - {{"email", "", "js@google.com", "Username:"}, - {"username", "", "johnsmith", "Email:"}, + {{"email", "id1", "js@google.com", "Username:"}, + {"username", "id2", "johnsmith", "Email:"}, "email", + "id1", "js@google.com"}, // Check treatment for short dictionary words. "uid" has higher priority, // but its occurrence is ignored because it is a part of another word. - {{"name1", "", "johnsmith", "Insert your id:"}, + {{"name1", "noword", "johnsmith", "Insert your id:"}, {"name2", "uidentical", "js@google.com", "Insert something:"}, "name1", + "noword", "johnsmith"}}; for (size_t i = 0; i < base::size(cases); ++i) { @@ -607,6 +647,9 @@ std::unique_ptr<PasswordForm> password_form = LoadHTMLAndConvertForm(html, nullptr, false); + uint32_t username_renderer_id = + GetRendererIdFromWebElementId(cases[i].expected_username_id); + ASSERT_TRUE(password_form); EXPECT_EQ(base::UTF8ToUTF16(cases[i].expected_username_element), @@ -616,9 +659,8 @@ // Check that the username field was found by HTML detector. ASSERT_EQ(1u, username_detector_cache_.size()); ASSERT_FALSE(username_detector_cache_.begin()->second.empty()); - EXPECT_EQ( - cases[i].expected_username_element, - username_detector_cache_.begin()->second[0].NameForAutofill().Utf8()); + EXPECT_EQ(username_renderer_id, + username_detector_cache_.begin()->second[0]); } } @@ -638,9 +680,10 @@ base::HistogramTester histogram_tester; std::unique_ptr<PasswordForm> password_form = CreatePasswordFormFromWebForm(form, nullptr, nullptr, &detector_cache); + EXPECT_TRUE(password_form); ASSERT_EQ(1u, detector_cache.size()); - EXPECT_EQ(form, detector_cache.begin()->first); + EXPECT_EQ(form.UniqueRendererFormId(), detector_cache.begin()->first); EXPECT_TRUE(detector_cache.begin()->second.empty()); histogram_tester.ExpectUniqueSample("PasswordManager.UsernameDetectionMethod", UsernameDetectionMethod::BASE_HEURISTIC, @@ -655,7 +698,7 @@ CreatePasswordFormFromWebForm(form, nullptr, nullptr, &detector_cache); EXPECT_TRUE(password_form); ASSERT_EQ(1u, detector_cache.size()); - EXPECT_EQ(form, detector_cache.begin()->first); + EXPECT_EQ(form.UniqueRendererFormId(), detector_cache.begin()->first); EXPECT_TRUE(detector_cache.begin()->second.empty()); histogram_tester.ExpectUniqueSample("PasswordManager.UsernameDetectionMethod", UsernameDetectionMethod::BASE_HEURISTIC, @@ -668,9 +711,10 @@ CreatePasswordFormFromWebForm(form, nullptr, nullptr, &detector_cache); EXPECT_TRUE(password_form); ASSERT_EQ(1u, detector_cache.size()); - EXPECT_EQ(form, detector_cache.begin()->first); + EXPECT_EQ(form.UniqueRendererFormId(), detector_cache.begin()->first); ASSERT_EQ(1u, detector_cache.begin()->second.size()); - EXPECT_EQ("id", detector_cache.begin()->second[0].NameForAutofill().Utf8()); + EXPECT_EQ(control_elements[0].UniqueRendererFormControlId(), + detector_cache.begin()->second[0]); EXPECT_THAT( histogram_tester.GetAllSamples("PasswordManager.UsernameDetectionMethod"), testing::UnorderedElementsAre( @@ -684,9 +728,10 @@ CreatePasswordFormFromWebForm(form, nullptr, nullptr, &detector_cache); EXPECT_TRUE(password_form); ASSERT_EQ(1u, detector_cache.size()); - EXPECT_EQ(form, detector_cache.begin()->first); + EXPECT_EQ(form.UniqueRendererFormId(), detector_cache.begin()->first); ASSERT_EQ(1u, detector_cache.begin()->second.size()); - EXPECT_EQ("id", detector_cache.begin()->second[0].NameForAutofill().Utf8()); + EXPECT_EQ(control_elements[0].UniqueRendererFormControlId(), + detector_cache.begin()->second[0]); EXPECT_THAT( histogram_tester.GetAllSamples("PasswordManager.UsernameDetectionMethod"), testing::UnorderedElementsAre( @@ -716,9 +761,11 @@ // Add predictions for "email" and "id" fields to the cache. UsernameDetectorCache username_detector_cache; - username_detector_cache[control_elements[0].Form()] = { - *ToWebInputElement(&control_elements[1]), // email - *ToWebInputElement(&control_elements[2])}; // id + username_detector_cache[control_elements[0].Form().UniqueRendererFormId()] = { + ToWebInputElement(&control_elements[1]) + ->UniqueRendererFormControlId(), // email + ToWebInputElement(&control_elements[2]) + ->UniqueRendererFormControlId()}; // id // A user typed only into "id" and "password" fields. So, the prediction for // "email" field should be ignored despite it is more reliable than prediction
diff --git a/components/autofill/core/browser/form_structure.h b/components/autofill/core/browser/form_structure.h index fa8777ff..805dc59 100644 --- a/components/autofill/core/browser/form_structure.h +++ b/components/autofill/core/browser/form_structure.h
@@ -282,12 +282,11 @@ const std::pair<PasswordAttribute, bool>& vote) { password_attributes_vote_ = vote; } -#if defined(UNIT_TEST) + base::Optional<std::pair<PasswordAttribute, bool>> - get_password_attributes_vote_for_testing() const { + get_password_attributes_vote() const { return password_attributes_vote_; } -#endif void set_password_length_vote(const size_t noisified_password_length) { DCHECK(password_attributes_vote_.has_value()) @@ -295,14 +294,15 @@ "|password_attributes_vote_| has no value."; password_length_vote_ = noisified_password_length; } -#if defined(UNIT_TEST) - size_t get_password_length_vote_for_testing() const { + + size_t get_password_length_vote() const { DCHECK(password_attributes_vote_.has_value()) << "|password_length_vote_| doesn't make sense if " "|password_attributes_vote_| has no value."; return password_length_vote_; } +#if defined(UNIT_TEST) mojom::SubmissionIndicatorEvent get_submission_event_for_testing() const { return submission_event_; } @@ -315,14 +315,12 @@ password_symbol_vote_ = noisified_symbol; } -#if defined(UNIT_TEST) - int get_password_symbol_vote_for_testing() { + int get_password_symbol_vote() const { DCHECK(password_attributes_vote_.has_value()) << "|password_symbol_vote_| doesn't make sense if " "|password_attributes_vote_| has no value"; return password_symbol_vote_; } -#endif mojom::SubmissionSource submission_source() const { return submission_source_;
diff --git a/components/autofill/core/common/save_password_progress_logger.cc b/components/autofill/core/common/save_password_progress_logger.cc index 7408ebf..8551fec 100644 --- a/components/autofill/core/common/save_password_progress_logger.cc +++ b/components/autofill/core/common/save_password_progress_logger.cc
@@ -417,6 +417,10 @@ return "Server predictions"; case SavePasswordProgressLogger::STRING_FORM_VOTES: return "Form votes"; + case SavePasswordProgressLogger::STRING_FIRSTUSE_FORM_VOTE: + return "FirstUse vote"; + case SavePasswordProgressLogger::STRING_PASSWORD_FORM_VOTE: + return "PasswordForm vote"; case SavePasswordProgressLogger::STRING_REUSE_FOUND: return "Password reused from "; case SavePasswordProgressLogger::STRING_GENERATION_DISABLED_SAVING_DISABLED: @@ -486,6 +490,27 @@ return "Leak detection finished with result"; case STRING_LEAK_DETECTION_SIGNED_OUT_ERROR: return "Leak detection failed: signed out"; + case SavePasswordProgressLogger:: + STRING_PASSWORD_REQUIREMENTS_VOTE_FOR_LOWERCASE: + return "Uploading password requirements vote for using lowercase letters"; + case SavePasswordProgressLogger:: + STRING_PASSWORD_REQUIREMENTS_VOTE_FOR_UPPERCASE: + return "Uploading password requirements vote for using lowercase letters"; + case SavePasswordProgressLogger:: + STRING_PASSWORD_REQUIREMENTS_VOTE_FOR_NUMERICS: + return "Uploading password requirements vote for using numbers"; + case SavePasswordProgressLogger:: + STRING_PASSWORD_REQUIREMENTS_VOTE_FOR_SPECIAL_SYMBOL: + return "Uploading password requirements vote for using special symbols"; + case SavePasswordProgressLogger:: + STRING_PASSWORD_REQUIREMENTS_VOTE_FOR_SPECIFIC_SPECIAL_SYMBOL: + return "Used specific special symbol"; + case SavePasswordProgressLogger:: + STRING_PASSWORD_REQUIREMENTS_VOTE_FOR_PASSWORD_LENGTH: + return "Uploading password requirements vote for password length"; + case SavePasswordProgressLogger:: + STRING_PASSWORD_REQUIREMENTS_VOTE_NO_PASSWORD_ATTRIBUTES: + return "No password requirements attributed set"; case SavePasswordProgressLogger::STRING_INVALID: return "INVALID"; // Intentionally no default: clause here -- all IDs need to get covered.
diff --git a/components/autofill/core/common/save_password_progress_logger.h b/components/autofill/core/common/save_password_progress_logger.h index 484204c..46a5f59 100644 --- a/components/autofill/core/common/save_password_progress_logger.h +++ b/components/autofill/core/common/save_password_progress_logger.h
@@ -146,6 +146,8 @@ STRING_FIELDS, STRING_SERVER_PREDICTIONS, STRING_FORM_VOTES, + STRING_FIRSTUSE_FORM_VOTE, + STRING_PASSWORD_FORM_VOTE, STRING_REUSE_FOUND, STRING_GENERATION_DISABLED_SAVING_DISABLED, STRING_GENERATION_DISABLED_NO_SYNC, @@ -179,6 +181,13 @@ STRING_SHOW_ONBOARDING, STRING_LEAK_DETECTION_FINISHED, STRING_LEAK_DETECTION_SIGNED_OUT_ERROR, + STRING_PASSWORD_REQUIREMENTS_VOTE_FOR_LOWERCASE, + STRING_PASSWORD_REQUIREMENTS_VOTE_FOR_UPPERCASE, + STRING_PASSWORD_REQUIREMENTS_VOTE_FOR_NUMERICS, + STRING_PASSWORD_REQUIREMENTS_VOTE_FOR_SPECIAL_SYMBOL, + STRING_PASSWORD_REQUIREMENTS_VOTE_FOR_SPECIFIC_SPECIAL_SYMBOL, + STRING_PASSWORD_REQUIREMENTS_VOTE_FOR_PASSWORD_LENGTH, + STRING_PASSWORD_REQUIREMENTS_VOTE_NO_PASSWORD_ATTRIBUTES, STRING_INVALID, // Represents a string returned in a case of an error. STRING_MAX = STRING_INVALID };
diff --git a/components/autofill_assistant/browser/controller.cc b/components/autofill_assistant/browser/controller.cc index 72a2d52a..04b9fa3 100644 --- a/components/autofill_assistant/browser/controller.cc +++ b/components/autofill_assistant/browser/controller.cc
@@ -546,6 +546,7 @@ if (script_domain_ != url.host()) { StopPeriodicScriptChecks(); script_domain_ = url.host(); + pending_get_scripts_ = true; DVLOG(2) << "GetScripts for " << script_domain_; GetService()->GetScriptsForUrl( url, *trigger_context_, @@ -613,6 +614,7 @@ if (url.host() != script_domain_) return; + pending_get_scripts_ = false; if (!result) { DVLOG(1) << "Failed to get assistant scripts for " << script_domain_; OnFatalError(l10n_util::GetStringUTF8(IDS_AUTOFILL_ASSISTANT_DEFAULT_ERROR), @@ -628,6 +630,12 @@ Metrics::DropOutReason::GET_SCRIPTS_UNPARSABLE); return; } + ProcessSupportsScriptResponse(response_proto); + GetOrCheckScripts(); +} + +void Controller::ProcessSupportsScriptResponse( + const SupportsScriptResponseProto& response_proto) { if (response_proto.has_client_settings()) settings_.UpdateFromProto(response_proto.client_settings()); @@ -668,8 +676,47 @@ } OnNoRunnableScriptsForPage(); } - script_tracker()->SetScripts(std::move(scripts)); +} + +void Controller::UpdateScriptsFromBundle( + const std::string& script_bundle_bytes) { + if (script_bundle_bytes.empty()) + return; + + ScriptBundleProto proto; + if (!proto.ParseFromString(script_bundle_bytes)) { + DVLOG(3) << __func__ << " Ignored unparseable script bundle"; + return; + } + + // If the bundle isn't meant for the current domain, ignore it. + std::string current_domain = GetCurrentURL().host(); + if (current_domain != proto.domain()) { + DVLOG(3) << __func__ << " Ignored script bundle for incorrect domain"; + return; + } + ScriptTracker* tracker = script_tracker(); + + // Update the set of scripts available for the domain and their preconditions. + // Do nothing if the set of scripts is already known. + if (script_domain_ == current_domain && !pending_get_scripts_) + return; + + script_domain_ = current_domain; + ProcessSupportsScriptResponse(proto.supports_scripts()); + + // Store initial script actions. + for (ScriptActionsProto& actions_proto : *proto.mutable_script_actions()) { + auto response_ptr = std::make_unique<ActionsResponseProto>(); + response_ptr->Swap(actions_proto.mutable_actions()); + if (!tracker->SetScriptActions(actions_proto.script_path(), + std::move(response_ptr))) { + DVLOG(3) << __func__ << " Ignored actions for unknown script " + << actions_proto.script_path(); + } + } + GetOrCheckScripts(); } @@ -823,9 +870,12 @@ } void Controller::Track(std::unique_ptr<TriggerContext> trigger_context, + const std::string& script_bundle_bytes, base::OnceCallback<void()> on_first_check_done) { tracking_ = true; + UpdateScriptsFromBundle(script_bundle_bytes); + if (state_ == AutofillAssistantState::INACTIVE) { trigger_context_ = std::move(trigger_context); InitFromParameters();
diff --git a/components/autofill_assistant/browser/controller.h b/components/autofill_assistant/browser/controller.h index a6a32bc..e02423c 100644 --- a/components/autofill_assistant/browser/controller.h +++ b/components/autofill_assistant/browser/controller.h
@@ -69,7 +69,12 @@ // // If non-null |on_first_check_done| is called once the result of the first // check of script availability are in - whether they're positive or negative. + // + // If |script_bundle_bytes| is specified, matches the current domain, and no + // scripts have been retrieved yet for the current domain, its data will be + // used to skip sending RPCs. void Track(std::unique_ptr<TriggerContext> trigger_context, + const std::string& script_bundle_bytes, base::OnceCallback<void()> on_first_check_done); // Called when autofill assistant should start. @@ -192,6 +197,15 @@ void OnGetScripts(const GURL& url, bool result, const std::string& response); + // Updates state from the given |SupportsScriptResponseProto|. + void ProcessSupportsScriptResponse( + const SupportsScriptResponseProto& response); + + // If possible, updates the set of scripts from the given bundle, which should + // by a serialized ScriptBundleProto. The bundle is ignored if it is empty or + // refers to another domain than the current one. + void UpdateScriptsFromBundle(const std::string& script_bundle_bytes); + // Execute |script_path| and, if execution succeeds, enter |end_state| and // call |on_success|. void ExecuteScript(const std::string& script_path, @@ -282,8 +296,15 @@ GURL deeplink_url_; // Domain of the last URL the controller requested scripts from. + // + // As long as |pending_get_scripts_| is true, the set of scripts for that + // domain isn't know. Once |pending_get_scripts_| is false, the set of scripts + // in the tracker is the one for that domain. std::string script_domain_; + // If true a RPC to fetch the scripts for |script_domain_| is in progress. + bool pending_get_scripts_ = false; + // Whether a task for periodic checks is scheduled. bool periodic_script_check_scheduled_ = false;
diff --git a/components/autofill_assistant/browser/controller_unittest.cc b/components/autofill_assistant/browser/controller_unittest.cc index fbedd27b..d82afee 100644 --- a/components/autofill_assistant/browser/controller_unittest.cc +++ b/components/autofill_assistant/browser/controller_unittest.cc
@@ -1011,7 +1011,7 @@ // Start tracking at example.com, with one script matching SetLastCommittedUrl(GURL("http://example.com/")); - controller_->Track(TriggerContext::CreateEmpty(), base::DoNothing()); + controller_->Track(TriggerContext::CreateEmpty(), "", base::DoNothing()); EXPECT_EQ(AutofillAssistantState::TRACKING, controller_->GetState()); ASSERT_THAT(controller_->GetUserActions(), SizeIs(1)); @@ -1059,7 +1059,7 @@ // Start tracking at example.com, with one script matching SetLastCommittedUrl(GURL("http://example.com/")); - controller_->Track(TriggerContext::CreateEmpty(), base::DoNothing()); + controller_->Track(TriggerContext::CreateEmpty(), "", base::DoNothing()); ASSERT_THAT(controller_->GetUserActions(), SizeIs(1)); EXPECT_TRUE(controller_->PerformUserAction(0)); @@ -1084,7 +1084,7 @@ // Start tracking at example.com, with one script matching SetLastCommittedUrl(GURL("http://example.com/")); - controller_->Track(TriggerContext::CreateEmpty(), base::DoNothing()); + controller_->Track(TriggerContext::CreateEmpty(), "", base::DoNothing()); ASSERT_THAT(controller_->GetUserActions(), SizeIs(1)); EXPECT_FALSE(controller_->NeedsUI()); @@ -1115,7 +1115,7 @@ // Start tracking at example.com, with one script matching SetLastCommittedUrl(GURL("http://example.com/")); - controller_->Track(TriggerContext::CreateEmpty(), base::DoNothing()); + controller_->Track(TriggerContext::CreateEmpty(), "", base::DoNothing()); ASSERT_THAT(controller_->GetUserActions(), SizeIs(1)); EXPECT_FALSE(controller_->NeedsUI()); @@ -1145,7 +1145,7 @@ // Start tracking at example.com, with one script matching SetLastCommittedUrl(GURL("http://example.com/")); - controller_->Track(TriggerContext::CreateEmpty(), base::DoNothing()); + controller_->Track(TriggerContext::CreateEmpty(), "", base::DoNothing()); EXPECT_EQ(AutofillAssistantState::TRACKING, controller_->GetState()); ASSERT_THAT(controller_->GetUserActions(), SizeIs(1)); @@ -1177,7 +1177,7 @@ SetLastCommittedUrl(GURL("http://example.com/")); bool first_check_done = false; - controller_->Track(TriggerContext::CreateEmpty(), + controller_->Track(TriggerContext::CreateEmpty(), "", base::BindOnce( [](Controller* controller, bool* is_done) { // User actions must have been set when this is @@ -1205,7 +1205,7 @@ base::MockCallback<base::OnceCallback<void()>> callback; EXPECT_CALL(callback, Run()); - controller_->Track(TriggerContext::CreateEmpty(), callback.Get()); + controller_->Track(TriggerContext::CreateEmpty(), "", callback.Get()); EXPECT_EQ(AutofillAssistantState::STOPPED, controller_->GetState()); } @@ -1222,7 +1222,7 @@ base::MockCallback<base::OnceCallback<void()>> callback; EXPECT_CALL(callback, Run()); - controller_->Track(TriggerContext::CreateEmpty(), callback.Get()); + controller_->Track(TriggerContext::CreateEmpty(), "", callback.Get()); EXPECT_EQ(AutofillAssistantState::TRACKING, controller_->GetState()); } @@ -1240,7 +1240,7 @@ base::MockCallback<base::OnceCallback<void()>> callback; EXPECT_CALL(callback, Run()); - controller_->Track(TriggerContext::CreateEmpty(), callback.Get()); + controller_->Track(TriggerContext::CreateEmpty(), "", callback.Get()); EXPECT_EQ(AutofillAssistantState::TRACKING, controller_->GetState()); } @@ -1250,12 +1250,12 @@ SetNextScriptResponse(script_response); SetLastCommittedUrl(GURL("http://example.com/")); - controller_->Track(TriggerContext::CreateEmpty(), base::DoNothing()); + controller_->Track(TriggerContext::CreateEmpty(), "", base::DoNothing()); EXPECT_EQ(AutofillAssistantState::TRACKING, controller_->GetState()); base::MockCallback<base::OnceCallback<void()>> callback; EXPECT_CALL(callback, Run()); - controller_->Track(TriggerContext::CreateEmpty(), callback.Get()); + controller_->Track(TriggerContext::CreateEmpty(), "", callback.Get()); } TEST_F(ControllerTest, TrackThenAutostart) { @@ -1267,7 +1267,7 @@ SetNextScriptResponse(script_response); SetLastCommittedUrl(GURL("http://example.com/")); - controller_->Track(TriggerContext::CreateEmpty(), base::DoNothing()); + controller_->Track(TriggerContext::CreateEmpty(), "", base::DoNothing()); EXPECT_EQ(AutofillAssistantState::TRACKING, controller_->GetState()); EXPECT_THAT(controller_->GetUserActions(), SizeIs(1)); @@ -1298,6 +1298,162 @@ AutofillAssistantState::TRACKING)); } +TEST_F(ControllerTest, TrackWithScriptBundle) { + ScriptBundleProto bundle; + bundle.set_domain("a.example.com"); + AddRunnableScript(bundle.mutable_supports_scripts(), "script1"); + AddRunnableScript(bundle.mutable_supports_scripts(), "script2"); + auto* script1 = bundle.add_script_actions(); + script1->set_script_path("script1"); + script1->mutable_actions()->add_actions()->mutable_tell()->set_message( + "script1 was here"); + + std::string bundle_str; + bundle.SerializeToString(&bundle_str); + + // Get the script list from the bundle. + SetLastCommittedUrl(GURL("http://a.example.com/")); + controller_->Track(TriggerContext::CreateEmpty(), bundle_str, + base::DoNothing()); + EXPECT_EQ(AutofillAssistantState::TRACKING, controller_->GetState()); + + // Execute script1 from the bundle, but report its result. + ASSERT_THAT(controller_->GetUserActions(), SizeIs(2)); + ASSERT_EQ("script1", controller_->GetUserActions()[0].chip().text); + + EXPECT_CALL(*mock_service_, OnGetNextActions(_, _, _, _, _)) + .WillOnce(RunOnceCallback<4>(true, "")); + + EXPECT_TRUE(controller_->PerformUserAction(0)); + + EXPECT_EQ(AutofillAssistantState::TRACKING, controller_->GetState()); + EXPECT_EQ("script1 was here", controller_->GetStatusMessage()); + + // Execute script2 from the server response. + ActionsResponseProto script2; + script2.add_actions()->mutable_tell()->set_message("script2 was here"); + SetupActionsForScript("script2", script2); + EXPECT_CALL(*mock_service_, OnGetNextActions(_, _, _, _, _)) + .WillOnce(RunOnceCallback<4>(true, "")); + + ASSERT_THAT(controller_->GetUserActions(), SizeIs(2)); + ASSERT_EQ("script2", controller_->GetUserActions()[1].chip().text); + EXPECT_TRUE(controller_->PerformUserAction(1)); + + EXPECT_EQ(AutofillAssistantState::TRACKING, controller_->GetState()); + EXPECT_EQ("script2 was here", controller_->GetStatusMessage()); +} + +TEST_F(ControllerTest, TrackWithScriptBundleWrongDomain) { + ScriptBundleProto bundle; + bundle.set_domain("a.example.com"); + AddRunnableScript(bundle.mutable_supports_scripts(), "domain a"); + std::string bundle_str; + bundle.SerializeToString(&bundle_str); + + SupportsScriptResponseProto script_response; + AddRunnableScript(&script_response, "domain b"); + SetNextScriptResponse(script_response); + + // Controller is on domain b, so the bundle is ignored and the scripts + // retrieved from the server. + SetLastCommittedUrl(GURL("http://b.example.com/")); + controller_->Track(TriggerContext::CreateEmpty(), bundle_str, + base::DoNothing()); + + EXPECT_EQ(AutofillAssistantState::TRACKING, controller_->GetState()); + ASSERT_THAT(controller_->GetUserActions(), SizeIs(1)); + EXPECT_EQ("domain b", controller_->GetUserActions()[0].chip().text); +} + +TEST_F(ControllerTest, TrackWithScriptBundleAfterSupportsScripts) { + ScriptBundleProto bundle; + bundle.set_domain("a.example.com"); + AddRunnableScript(bundle.mutable_supports_scripts(), "script1"); + auto* script1 = bundle.add_script_actions(); + script1->set_script_path("script1"); + script1->mutable_actions()->add_actions()->mutable_tell()->set_message( + "script1 was here"); + + std::string bundle_str; + bundle.SerializeToString(&bundle_str); + + SupportsScriptResponseProto server_script_response; + AddRunnableScript(&server_script_response, "script1"); + AddRunnableScript(&server_script_response, "script2"); + SetNextScriptResponse(server_script_response); + + // Get the script list from the server + SetLastCommittedUrl(GURL("http://a.example.com/")); + controller_->Track(TriggerContext::CreateEmpty(), "", base::DoNothing()); + + // Provide a bundle + controller_->Track(TriggerContext::CreateEmpty(), bundle_str, + base::DoNothing()); + + EXPECT_EQ(AutofillAssistantState::TRACKING, controller_->GetState()); + + // The response from the RPC won; we have 2 scripts instead of just one. + ASSERT_THAT(controller_->GetUserActions(), SizeIs(2)); + + // Execute script1 from the server. We can't use script1 actions from the + // bundle, since they might not correspond to the preconditions returned by + // the server. + ASSERT_EQ("script1", controller_->GetUserActions()[0].chip().text); + + EXPECT_CALL(*mock_service_, OnGetActions("script1", _, _, _, _, _)); + EXPECT_TRUE(controller_->PerformUserAction(0)); +} + +TEST_F(ControllerTest, TrackWithScriptBundleDuringSupportsScripts) { + // Ask for the the script list from the server. The GetScripts RPC hangs for + // now. + Service::ResponseCallback get_actions_callback_capture; + EXPECT_CALL(*mock_service_, OnGetScriptsForUrl(_, _, _)) + .WillOnce( + Invoke([&get_actions_callback_capture]( + const GURL& url, const TriggerContext& trigger_context, + Service::ResponseCallback& callback) { + get_actions_callback_capture = std::move(callback); + })); + SetLastCommittedUrl(GURL("http://a.example.com/")); + controller_->Track(TriggerContext::CreateEmpty(), "", base::DoNothing()); + + // Provide a bundle, which sets the scripts supported for the website. + ScriptBundleProto bundle; + bundle.set_domain("a.example.com"); + AddRunnableScript(bundle.mutable_supports_scripts(), "script1"); + auto* script1 = bundle.add_script_actions(); + script1->set_script_path("script1"); + script1->mutable_actions()->add_actions()->mutable_tell()->set_message( + "script1 was here"); + std::string bundle_str; + bundle.SerializeToString(&bundle_str); + controller_->Track(TriggerContext::CreateEmpty(), bundle_str, + base::DoNothing()); + EXPECT_EQ(AutofillAssistantState::TRACKING, controller_->GetState()); + EXPECT_THAT(controller_->GetUserActions(), SizeIs(1)); + + // The server responds, which overrides the scripts supported for the website. + // We now have definitions for two scripts. + SupportsScriptResponseProto server_script_response; + AddRunnableScript(&server_script_response, "script1"); + AddRunnableScript(&server_script_response, "script2"); + std::string server_script_response_str; + server_script_response.SerializeToString(&server_script_response_str); + std::move(get_actions_callback_capture).Run(true, server_script_response_str); + + EXPECT_THAT(controller_->GetUserActions(), SizeIs(2)); + + // The initial set of actions for script1 must be fetched from the RPC. The + // ones in the bundle must have been discarded when the set of scripts was + // updated. + ASSERT_EQ("script1", controller_->GetUserActions()[0].chip().text); + + EXPECT_CALL(*mock_service_, OnGetActions("script1", _, _, _, _, _)); + EXPECT_TRUE(controller_->PerformUserAction(0)); +} + TEST_F(ControllerTest, UnexpectedNavigationDuringPromptAction_Tracking) { SupportsScriptResponseProto script_response; AddRunnableScript(&script_response, "runnable"); @@ -1314,7 +1470,7 @@ SetupActionsForScript("runnable", runnable_script); SetLastCommittedUrl(GURL("http://example.com/")); - controller_->Track(TriggerContext::CreateEmpty(), base::DoNothing()); + controller_->Track(TriggerContext::CreateEmpty(), "", base::DoNothing()); EXPECT_EQ(AutofillAssistantState::TRACKING, controller_->GetState()); ASSERT_THAT(controller_->GetUserActions(), SizeIs(1)); EXPECT_EQ(controller_->GetUserActions()[0].chip().text, "runnable");
diff --git a/components/autofill_assistant/browser/protocol_utils.cc b/components/autofill_assistant/browser/protocol_utils.cc index 8f336e239..f823e24 100644 --- a/components/autofill_assistant/browser/protocol_utils.cc +++ b/components/autofill_assistant/browser/protocol_utils.cc
@@ -170,8 +170,8 @@ } // static -bool ProtocolUtils::ParseActions(ActionDelegate* delegate, - const std::string& response, +void ProtocolUtils::ParseActions(ActionDelegate* delegate, + const ActionsResponseProto& response_proto, std::string* return_global_payload, std::string* return_script_payload, std::vector<std::unique_ptr<Action>>* actions, @@ -180,12 +180,6 @@ DCHECK(actions); DCHECK(scripts); - ActionsResponseProto response_proto; - if (!response_proto.ParseFromString(response)) { - LOG(ERROR) << "Failed to parse assistant actions response."; - return false; - } - if (return_global_payload) { *return_global_payload = response_proto.global_payload(); } @@ -323,8 +317,6 @@ response_proto.update_script_list().scripts()) { ProtocolUtils::AddScript(script_proto, scripts); } - - return true; } } // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/protocol_utils.h b/components/autofill_assistant/browser/protocol_utils.h index 14e460d..458e936 100644 --- a/components/autofill_assistant/browser/protocol_utils.h +++ b/components/autofill_assistant/browser/protocol_utils.h
@@ -62,9 +62,9 @@ // are returned through |scripts| and used to update the list of cached // scripts. The bool |should_update_scripts| makes clear the destinction // between an empty list of |scripts| or the scripts field not even set in the - // proto. Return false if parse failed, otherwise return true. - static bool ParseActions(ActionDelegate* delegate, - const std::string& response, + // proto. + static void ParseActions(ActionDelegate* delegate, + const ActionsResponseProto& response, std::string* return_global_payload, std::string* return_script_payload, std::vector<std::unique_ptr<Action>>* actions,
diff --git a/components/autofill_assistant/browser/protocol_utils_unittest.cc b/components/autofill_assistant/browser/protocol_utils_unittest.cc index 741be933..9ce82836 100644 --- a/components/autofill_assistant/browser/protocol_utils_unittest.cc +++ b/components/autofill_assistant/browser/protocol_utils_unittest.cc
@@ -233,15 +233,6 @@ EXPECT_THAT(scripts, IsEmpty()); } -TEST(ProtocolUtilsTest, ParseActionsParseError) { - bool unused; - std::vector<std::unique_ptr<Action>> unused_actions; - std::vector<std::unique_ptr<Script>> unused_scripts; - EXPECT_FALSE(ProtocolUtils::ParseActions(nullptr, "invalid", nullptr, nullptr, - &unused_actions, &unused_scripts, - &unused)); -} - TEST(ProtocolUtilsTest, ParseActionsValid) { ActionsResponseProto proto; proto.set_global_payload("global_payload"); @@ -249,18 +240,14 @@ proto.add_actions()->mutable_tell(); proto.add_actions()->mutable_click(); - std::string proto_str; - proto.SerializeToString(&proto_str); - std::string global_payload; std::string script_payload; bool should_update_scripts = true; std::vector<std::unique_ptr<Action>> actions; std::vector<std::unique_ptr<Script>> scripts; - EXPECT_TRUE(ProtocolUtils::ParseActions(nullptr, proto_str, &global_payload, - &script_payload, &actions, &scripts, - &should_update_scripts)); + ProtocolUtils::ParseActions(nullptr, proto, &global_payload, &script_payload, + &actions, &scripts, &should_update_scripts); EXPECT_EQ("global_payload", global_payload); EXPECT_EQ("script_payload", script_payload); EXPECT_THAT(actions, SizeIs(2)); @@ -272,17 +259,13 @@ ActionsResponseProto proto; proto.mutable_update_script_list(); - std::string proto_str; - proto.SerializeToString(&proto_str); - bool should_update_scripts = false; std::vector<std::unique_ptr<Script>> scripts; std::vector<std::unique_ptr<Action>> unused_actions; - EXPECT_TRUE(ProtocolUtils::ParseActions( - nullptr, proto_str, /* global_payload= */ nullptr, - /* script_payload */ nullptr, &unused_actions, &scripts, - &should_update_scripts)); + ProtocolUtils::ParseActions(nullptr, proto, /* global_payload= */ nullptr, + /* script_payload */ nullptr, &unused_actions, + &scripts, &should_update_scripts); EXPECT_TRUE(should_update_scripts); EXPECT_TRUE(scripts.empty()); } @@ -298,17 +281,13 @@ // One invalid script. script_list->add_scripts(); - std::string proto_str; - proto.SerializeToString(&proto_str); - bool should_update_scripts = false; std::vector<std::unique_ptr<Script>> scripts; std::vector<std::unique_ptr<Action>> unused_actions; - EXPECT_TRUE(ProtocolUtils::ParseActions( - nullptr, proto_str, /* global_payload= */ nullptr, - /* script_payload= */ nullptr, &unused_actions, &scripts, - &should_update_scripts)); + ProtocolUtils::ParseActions(nullptr, proto, /* global_payload= */ nullptr, + /* script_payload= */ nullptr, &unused_actions, + &scripts, &should_update_scripts); EXPECT_TRUE(should_update_scripts); EXPECT_THAT(scripts, SizeIs(1)); EXPECT_THAT("a", Eq(scripts[0]->handle.path));
diff --git a/components/autofill_assistant/browser/script_executor.cc b/components/autofill_assistant/browser/script_executor.cc index 5c457225..c59430d 100644 --- a/components/autofill_assistant/browser/script_executor.cc +++ b/components/autofill_assistant/browser/script_executor.cc
@@ -99,6 +99,12 @@ callback_ = std::move(callback); DCHECK(delegate_->GetService()); + if (initial_actions_) { + OnGetActionsProto(true, *initial_actions_); + initial_actions_.reset(); + return; + } + DVLOG(2) << "GetActions for " << delegate_->GetCurrentURL().host(); delegate_->GetService()->GetActions( script_path_, delegate_->GetDeeplinkURL(), @@ -545,10 +551,19 @@ } void ScriptExecutor::OnGetActions(bool result, const std::string& response) { - bool success = result && ProcessNextActionResponse(response); - DVLOG(2) << __func__ << " result=" << result; + ActionsResponseProto response_proto; + if (result && !response_proto.ParseFromString(response)) { + DVLOG(1) << "Failed to parse assistant actions response."; + result = false; + } + OnGetActionsProto(result, response_proto); +} + +void ScriptExecutor::OnGetActionsProto(bool success, + const ActionsResponseProto& response) { + DVLOG(2) << __func__ << " success=" << success; if (should_stop_script_) { - // The last action forced the script to stop. Sending the result of the + // The last action forced the script to stop. Sending the success of the // action is considered best effort in this situation. Report a successful // run to the caller no matter what, so we don't confuse users with an error // message. @@ -561,6 +576,7 @@ return; } + ProcessNextActionResponse(response); if (!actions_.empty()) { ProcessNextAction(); return; @@ -569,24 +585,22 @@ RunCallback(true); } -bool ScriptExecutor::ProcessNextActionResponse(const std::string& response) { +void ScriptExecutor::ProcessNextActionResponse( + const ActionsResponseProto& response) { processed_actions_.clear(); actions_.clear(); + inhibit_result_report_ = response.inhibit_result_report(); bool should_update_scripts = false; std::vector<std::unique_ptr<Script>> scripts; - bool parse_result = ProtocolUtils::ParseActions( - this, response, &last_global_payload_, &last_script_payload_, &actions_, - &scripts, &should_update_scripts); - if (!parse_result) { - return false; - } + ProtocolUtils::ParseActions(this, response, &last_global_payload_, + &last_script_payload_, &actions_, &scripts, + &should_update_scripts); ReportPayloadsToListener(); if (should_update_scripts) { ReportScriptsUpdateToListener(std::move(scripts)); } - return true; } void ScriptExecutor::ReportPayloadsToListener() { @@ -632,7 +646,7 @@ if (actions_.size() <= processed_actions_.size()) { DCHECK_EQ(actions_.size(), processed_actions_.size()); DVLOG(2) << __func__ << ", get more actions"; - GetNextActions(); + GetNextActions(true); return; } @@ -662,7 +676,11 @@ base::TimeTicks::Now())); } -void ScriptExecutor::GetNextActions() { +void ScriptExecutor::GetNextActions(bool success) { + if (inhibit_result_report_) { + RunCallback(success); + return; + } delegate_->GetService()->GetNextActions( MergedTriggerContext( {delegate_->GetTriggerContext(), additional_context_.get()}), @@ -694,7 +712,7 @@ DVLOG(1) << "Action failed: " << processed_action.status() << ", get more actions"; // Report error immediately, interrupting action processing. - GetNextActions(); + GetNextActions(false); return; } ProcessNextAction();
diff --git a/components/autofill_assistant/browser/script_executor.h b/components/autofill_assistant/browser/script_executor.h index 749746f..f4ed444f 100644 --- a/components/autofill_assistant/browser/script_executor.h +++ b/components/autofill_assistant/browser/script_executor.h
@@ -93,6 +93,12 @@ friend std::ostream& operator<<(std::ostream& out, const Result& result); }; + // Optionally provides the initial set of actions to execute. If unset, the + // script executor fetches the actions from the service. + void SetActions(std::unique_ptr<ActionsResponseProto> initial_actions) { + initial_actions_ = std::move(initial_actions); + } + using RunScriptCallback = base::OnceCallback<void(const Result&)>; void Run(RunScriptCallback callback); @@ -307,7 +313,8 @@ }; void OnGetActions(bool result, const std::string& response); - bool ProcessNextActionResponse(const std::string& response); + void OnGetActionsProto(bool result, const ActionsResponseProto& response); + void ProcessNextActionResponse(const ActionsResponseProto& response); void ReportPayloadsToListener(); void ReportScriptsUpdateToListener( std::vector<std::unique_ptr<Script>> scripts); @@ -315,7 +322,7 @@ void RunCallbackWithResult(const Result& result); void ProcessNextAction(); void ProcessAction(Action* action); - void GetNextActions(); + void GetNextActions(bool success); void OnProcessedAction(base::TimeTicks start_time, std::unique_ptr<ProcessedActionProto> action); void CheckElementMatches(const Selector& selector, @@ -406,6 +413,13 @@ }; CurrentActionData current_action_data_; + // If set, get the initial set of actions from this proto instead of querying + // them from the backend. + std::unique_ptr<ActionsResponseProto> initial_actions_; + + // If true, don't report the result to the caller. + bool inhibit_result_report_ = false; + base::WeakPtrFactory<ScriptExecutor> weak_ptr_factory_{this}; DISALLOW_COPY_AND_ASSIGN(ScriptExecutor); };
diff --git a/components/autofill_assistant/browser/script_executor_unittest.cc b/components/autofill_assistant/browser/script_executor_unittest.cc index 1a791ae..883c28b 100644 --- a/components/autofill_assistant/browser/script_executor_unittest.cc +++ b/components/autofill_assistant/browser/script_executor_unittest.cc
@@ -1369,6 +1369,37 @@ EXPECT_EQ(NAVIGATION_ERROR, processed_actions_capture[1].status()); } +TEST_F(ScriptExecutorTest, InhibitResultReportSuccessfulAction) { + ActionsResponseProto actions_response; + actions_response.add_actions()->mutable_tell()->set_message("will suceed"); + actions_response.set_inhibit_result_report(true); + + EXPECT_CALL(mock_service_, OnGetActions(_, _, _, _, _, _)) + .WillOnce(RunOnceCallback<5>(true, Serialize(actions_response))); + + EXPECT_CALL(mock_service_, OnGetNextActions(_, _, _, _, _)).Times(0); + EXPECT_CALL(executor_callback_, + Run(Field(&ScriptExecutor::Result::success, true))); + executor_->Run(executor_callback_.Get()); +} + +TEST_F(ScriptExecutorTest, InhibitResultReportFailedAction) { + ActionsResponseProto actions_response; + actions_response.add_actions() + ->mutable_click() + ->mutable_element_to_click() + ->add_selectors("will fail"); + actions_response.set_inhibit_result_report(true); + + EXPECT_CALL(mock_service_, OnGetActions(_, _, _, _, _, _)) + .WillOnce(RunOnceCallback<5>(true, Serialize(actions_response))); + + EXPECT_CALL(mock_service_, OnGetNextActions(_, _, _, _, _)).Times(0); + EXPECT_CALL(executor_callback_, + Run(Field(&ScriptExecutor::Result::success, false))); + executor_->Run(executor_callback_.Get()); +} + TEST_F(ScriptExecutorTest, InterceptUserActions) { ActionsResponseProto actions_response; actions_response.add_actions()
diff --git a/components/autofill_assistant/browser/script_tracker.cc b/components/autofill_assistant/browser/script_tracker.cc index 2bfc8423..14c8357 100644 --- a/components/autofill_assistant/browser/script_tracker.cc +++ b/components/autofill_assistant/browser/script_tracker.cc
@@ -77,6 +77,23 @@ } } SortScripts(&interrupts_); + + // If there were script actions defined, clear them. If we have a new set of + // script definition, scripts with the same path might now have different + // precondition, so we can't keep them. + script_actions_.clear(); +} + +bool ScriptTracker::SetScriptActions( + const std::string& script_path, + std::unique_ptr<ActionsResponseProto> actions) { + for (auto& script_pair : available_scripts_) { + if (script_pair.first->handle.path == script_path) { + script_actions_.emplace(std::make_pair(script_path, std::move(actions))); + return true; + } + } + return false; } void ScriptTracker::CheckScripts() { @@ -131,6 +148,18 @@ script_path, std::move(context), last_global_payload_, last_script_payload_, /* listener= */ this, &scripts_state_, &interrupts_, delegate_); + + // Set the initial set of actions, the first time a script is run. + auto actions_iter = script_actions_.find(script_path); + if (actions_iter != script_actions_.end()) { + // TODO(b/138278201): Consider keeping the set of actions for another run of + // the script. This means not transferring ownership, but also guaranteeing + // that the content of script_actions_ doesn't change while a script is + // running. + executor_->SetActions(std::move(actions_iter->second)); + script_actions_.erase(actions_iter); + } + ScriptExecutor::RunScriptCallback run_script_callback = base::BindOnce( &ScriptTracker::OnScriptRun, weak_ptr_factory_.GetWeakPtr(), script_path, std::move(callback));
diff --git a/components/autofill_assistant/browser/script_tracker.h b/components/autofill_assistant/browser/script_tracker.h index 373540b..77696f8f 100644 --- a/components/autofill_assistant/browser/script_tracker.h +++ b/components/autofill_assistant/browser/script_tracker.h
@@ -97,6 +97,16 @@ // script running at a time. bool running() const { return executor_ != nullptr; } + // Sets a hardcoded set of initial actions for the given script. + // + // Actions specified here are only valid for the current set of scripts, set + // with SetScripts(). Calling SetScripts() clears them. + // + // If this returns false, the script actions was ignored, as there's was no + // definitions passed in the last call to SetScripts(). + bool SetScriptActions(const std::string& script_path, + std::unique_ptr<ActionsResponseProto> actions); + // Returns a dictionary describing the current execution context, which // is intended to be serialized as JSON string. The execution context is // useful when analyzing feedback forms and for debugging in general. @@ -176,6 +186,9 @@ // only occurse when |scripts_update| is not nullptr. std::unique_ptr<std::vector<std::unique_ptr<Script>>> scripts_update_; + // Known initial script actions, passed to the tracker. + std::map<std::string, std::unique_ptr<ActionsResponseProto>> script_actions_; + base::WeakPtrFactory<ScriptTracker> weak_ptr_factory_; DISALLOW_COPY_AND_ASSIGN(ScriptTracker);
diff --git a/components/autofill_assistant/browser/service.proto b/components/autofill_assistant/browser/service.proto index 02a02666..aaf192a 100644 --- a/components/autofill_assistant/browser/service.proto +++ b/components/autofill_assistant/browser/service.proto
@@ -362,6 +362,10 @@ // Should stop processing as soon as an action fails. repeated ActionProto actions = 3; + // If true, don't report the result to the server. Setting this to false + // implies that the given set of actions is complete. + optional bool inhibit_result_report = 6; + // List of scripts to update. // // The client is expected to update the cache of scripts with this new @@ -1626,3 +1630,25 @@ // Message to show in the popup. optional string message = 1; } + +// A set of script definition that can be provided by the caller, when using +// direct actions, to avoid having to send RPCs to get the data. +// +// These definitions are only valid for the given domain. They'll be ignored if +// data has already been retrieved from the server. +message ScriptBundleProto { + // The domain to which SupportsScriptResponseProto applies. This avoids + // having to send the SupportsScript RPC. + optional string domain = 1; + optional SupportsScriptResponseProto supports_scripts = 2; + + // Optional definition for scripts defined in supports_scripts. This avoids + // having to send the GetActions RPC to get the initial set of actions. + repeated ScriptActionsProto script_actions = 3; +} + +// Definition of an action. +message ScriptActionsProto { + optional string script_path = 1; + optional ActionsResponseProto actions = 2; +}
diff --git a/components/cast_certificate/cast_cert_validator.cc b/components/cast_certificate/cast_cert_validator.cc index 08c5af7..6cf222a 100644 --- a/components/cast_certificate/cast_cert_validator.cc +++ b/components/cast_certificate/cast_cert_validator.cc
@@ -303,14 +303,13 @@ net::der::GeneralizedTime verification_time; if (!net::der::EncodeTimeAsGeneralizedTime(time, &verification_time)) return CastCertError::ERR_UNEXPECTED; - net::CertPathBuilder::Result result; net::CertPathBuilder path_builder( target_cert.get(), trust_store, &path_builder_delegate, verification_time, net::KeyPurpose::CLIENT_AUTH, net::InitialExplicitPolicy::kFalse, {net::AnyPolicy()}, net::InitialPolicyMappingInhibit::kFalse, - net::InitialAnyPolicyInhibit::kFalse, &result); + net::InitialAnyPolicyInhibit::kFalse); path_builder.AddCertIssuerSource(&intermediate_cert_issuer_source); - path_builder.Run(); + net::CertPathBuilder::Result result = path_builder.Run(); if (!result.HasValidPath()) return MapToCastError(result);
diff --git a/components/cast_certificate/cast_crl.cc b/components/cast_certificate/cast_crl.cc index c2f38e4..03adf781 100644 --- a/components/cast_certificate/cast_crl.cc +++ b/components/cast_certificate/cast_crl.cc
@@ -137,13 +137,12 @@ net::SimplePathBuilderDelegate path_builder_delegate( 2048, net::SimplePathBuilderDelegate::DigestPolicy::kWeakAllowSha1); - net::CertPathBuilder::Result result; net::CertPathBuilder path_builder( parsed_cert.get(), trust_store, &path_builder_delegate, verification_time, net::KeyPurpose::ANY_EKU, net::InitialExplicitPolicy::kFalse, {net::AnyPolicy()}, net::InitialPolicyMappingInhibit::kFalse, - net::InitialAnyPolicyInhibit::kFalse, &result); - path_builder.Run(); + net::InitialAnyPolicyInhibit::kFalse); + net::CertPathBuilder::Result result = path_builder.Run(); if (!result.HasValidPath()) { VLOG(2) << "CRL - Issuer certificate verification failed."; // TODO(crbug.com/634443): Log the error information.
diff --git a/components/crash/content/app/breakpad_linux.cc b/components/crash/content/app/breakpad_linux.cc index bb5ee46..73075082 100644 --- a/components/crash/content/app/breakpad_linux.cc +++ b/components/crash/content/app/breakpad_linux.cc
@@ -1065,7 +1065,12 @@ #if !defined(ADDRESS_SANITIZER) static_assert(5 == kCrashIovSize - 1, "kCrashIovSize should equal 6"); #else - iov[6].iov_base = const_cast<char*>(g_asan_report_str); + if (g_asan_report_str != nullptr) { + iov[6].iov_base = const_cast<char*>(g_asan_report_str); + } else { + static char empty_asan_report[kMaxAsanReportSize + 1]; + iov[6].iov_base = empty_asan_report; + } iov[6].iov_len = kMaxAsanReportSize + 1; static_assert(6 == kCrashIovSize - 1, "kCrashIovSize should equal 7"); #endif
diff --git a/components/cronet/cronet_prefs_manager.cc b/components/cronet/cronet_prefs_manager.cc index f0200c2..9f1da27 100644 --- a/components/cronet/cronet_prefs_manager.cc +++ b/components/cronet/cronet_prefs_manager.cc
@@ -22,7 +22,7 @@ #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" #include "components/prefs/pref_service_factory.h" -#include "net/http/http_server_properties_manager.h" +#include "net/http/http_server_properties.h" #include "net/nqe/network_qualities_prefs_manager.h" #include "net/url_request/url_request_context_builder.h" @@ -99,9 +99,8 @@ } } -// Connects the HttpServerPropertiesManager's storage to the prefs. -class PrefServiceAdapter - : public net::HttpServerPropertiesManager::PrefDelegate { +// Connects the HttpServerProperties's storage to the prefs. +class PrefServiceAdapter : public net::HttpServerProperties::PrefDelegate { public: explicit PrefServiceAdapter(PrefService* pref_service) : pref_service_(pref_service), path_(kHttpServerPropertiesPref) { @@ -211,8 +210,7 @@ bool enable_network_quality_estimator, bool enable_host_cache_persistence, net::NetLog* net_log, - net::URLRequestContextBuilder* context_builder) - : http_server_properties_manager_(nullptr) { + net::URLRequestContextBuilder* context_builder) { DCHECK(network_task_runner->BelongsToCurrentThread()); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); @@ -256,14 +254,9 @@ pref_service_ = factory.Create(registry.get()); } - http_server_properties_manager_ = new net::HttpServerPropertiesManager( - std::make_unique<PrefServiceAdapter>(pref_service_.get()), net_log); - - // Passes |http_server_properties_manager_| ownership to |context_builder|. - // The ownership will be subsequently passed to UrlRequestContext. context_builder->SetHttpServerProperties( - std::unique_ptr<net::HttpServerPropertiesManager>( - http_server_properties_manager_)); + std::make_unique<net::HttpServerProperties>( + std::make_unique<PrefServiceAdapter>(pref_service_.get()), net_log)); } CronetPrefsManager::~CronetPrefsManager() {
diff --git a/components/cronet/cronet_prefs_manager.h b/components/cronet/cronet_prefs_manager.h index adf6550e..6805f56 100644 --- a/components/cronet/cronet_prefs_manager.h +++ b/components/cronet/cronet_prefs_manager.h
@@ -21,7 +21,6 @@ } // namespace base namespace net { -class HttpServerPropertiesManager; class HostCache; class NetLog; class NetworkQualitiesPrefsManager; @@ -64,11 +63,6 @@ std::unique_ptr<PrefService> pref_service_; scoped_refptr<JsonPrefStore> json_pref_store_; - // The ownership of this object is assumed by |net::URLRequestContextBuilder| - // in this class constructor. The ownership is later passed to - // |net::URLRequestContext|, which should outlive this class. - net::HttpServerPropertiesManager* http_server_properties_manager_; - // Manages the writing and reading of the network quality prefs. std::unique_ptr<net::NetworkQualitiesPrefsManager> network_qualities_prefs_manager_;
diff --git a/components/cronet/ios/cronet_environment.mm b/components/cronet/ios/cronet_environment.mm index 9d7308ed..86b98bc0c 100644 --- a/components/cronet/ios/cronet_environment.mm +++ b/components/cronet/ios/cronet_environment.mm
@@ -36,7 +36,7 @@ #include "net/cert/cert_verifier.h" #include "net/dns/host_resolver.h" #include "net/dns/mapped_host_resolver.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/http/http_stream_factory.h" #include "net/http/http_transaction_factory.h" #include "net/http/http_util.h"
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.h index 9abbb32..d543fa3 100644 --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.h +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings_test_utils.h
@@ -10,6 +10,7 @@ #include <string> #include <utility> +#include "base/message_loop/message_pump_type.h" #include "base/strings/string_piece.h" #include "base/task/single_thread_task_executor.h" #include "base/time/clock.h" @@ -66,7 +67,7 @@ base::StringPiece group_name); protected: - base::SingleThreadTaskExecutor io_task_executor_{base::MessagePump::Type::IO}; + base::SingleThreadTaskExecutor io_task_executor_{base::MessagePumpType::IO}; std::unique_ptr<DataReductionProxyTestContext> test_context_; std::unique_ptr<DataReductionProxySettings> settings_; base::Time last_update_time_;
diff --git a/components/download/internal/common/download_response_handler.cc b/components/download/internal/common/download_response_handler.cc index a4734db..1d5e394 100644 --- a/components/download/internal/common/download_response_handler.cc +++ b/components/download/internal/common/download_response_handler.cc
@@ -59,7 +59,8 @@ const std::string& request_origin, DownloadSource download_source, bool ignore_content_length_mismatch, - std::vector<GURL> url_chain) + std::vector<GURL> url_chain, + bool is_background_mode) : delegate_(delegate), started_(false), save_info_(std::move(save_info)), @@ -77,7 +78,8 @@ ignore_content_length_mismatch_(ignore_content_length_mismatch), is_partial_request_(save_info_->offset > 0), completed_(false), - abort_reason_(DOWNLOAD_INTERRUPT_REASON_NONE) { + abort_reason_(DOWNLOAD_INTERRUPT_REASON_NONE), + is_background_mode_(is_background_mode) { if (!is_parallel_request) { RecordDownloadCountWithSource(UNTHROTTLED_COUNT, download_source); } @@ -105,7 +107,8 @@ // caused by reason 2. As a result, downloads without strong validators are // treated as completed here. ignore_content_length_mismatch_ |= !head.headers->HasStrongValidators(); - RecordDownloadHttpResponseCode(head.headers->response_code()); + RecordDownloadHttpResponseCode(head.headers->response_code(), + is_background_mode_); RecordDownloadContentDisposition(create_info_->content_disposition); } @@ -243,6 +246,11 @@ if (reason == DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED) { base::UmaHistogramSparse("Download.MapErrorNetworkFailed.NetworkService", std::abs(status.error_code)); + if (is_background_mode_) { + base::UmaHistogramSparse( + "Download.MapErrorNetworkFailed.NetworkService.BackgroundDownload", + std::abs(status.error_code)); + } } if (started_) {
diff --git a/components/download/internal/common/download_stats.cc b/components/download/internal/common/download_stats.cc index 1191391..3e78d1c 100644 --- a/components/download/internal/common/download_stats.cc +++ b/components/download/internal/common/download_stats.cc
@@ -1247,11 +1247,17 @@ ui::PAGE_TRANSITION_LAST_CORE + 1); } -void RecordDownloadHttpResponseCode(int response_code) { - UMA_HISTOGRAM_CUSTOM_ENUMERATION( - "Download.HttpResponseCode", - net::HttpUtil::MapStatusCodeForHistogram(response_code), - net::HttpUtil::GetStatusCodesForHistogram()); +void RecordDownloadHttpResponseCode(int response_code, + bool is_background_mode) { + int status_code = net::HttpUtil::MapStatusCodeForHistogram(response_code); + std::vector<int> status_codes = net::HttpUtil::GetStatusCodesForHistogram(); + UMA_HISTOGRAM_CUSTOM_ENUMERATION("Download.HttpResponseCode", status_code, + status_codes); + if (is_background_mode) { + UMA_HISTOGRAM_CUSTOM_ENUMERATION( + "Download.HttpResponseCode.BackgroundDownload", status_code, + status_codes); + } } void RecordInProgressDBCount(InProgressDBCountTypes type) { @@ -1293,6 +1299,12 @@ else base::UmaHistogramSparse("MobileDownload.FirstBackground.Reason", reason); } + +void RecordBackgroundTargetDeterminationResult( + BackgroudTargetDeterminationResultTypes type) { + base::UmaHistogramEnumeration( + "MobileDownload.Background.TargetDeterminationResult", type); +} #endif // defined(OS_ANDROID) #if defined(OS_WIN)
diff --git a/components/download/internal/common/in_progress_download_manager.cc b/components/download/internal/common/in_progress_download_manager.cc index 37c6ec2..5bf82548 100644 --- a/components/download/internal/common/in_progress_download_manager.cc +++ b/components/download/internal/common/in_progress_download_manager.cc
@@ -31,6 +31,7 @@ #if defined(OS_ANDROID) #include "components/download/internal/common/android/download_collection_bridge.h" +#include "components/download/public/common/download_path_reservation_tracker.h" #endif namespace download { @@ -89,6 +90,7 @@ const GURL& tab_url, const GURL& tab_referrer_url, std::unique_ptr<service_manager::Connector> connector, + bool is_background_mode, const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner) { DCHECK(GetIOTaskRunner()->BelongsToCurrentThread()); UrlDownloadHandler::UniqueUrlDownloadHandlerPtr downloader( @@ -96,7 +98,7 @@ download_manager, std::move(params), std::move(request), std::move(url_loader_factory_getter), url_security_policy, site_url, tab_url, tab_referrer_url, is_new_download, false, - std::move(connector), main_task_runner) + std::move(connector), is_background_mode, main_task_runner) .release(), base::OnTaskRunnerDeleter(base::ThreadTaskRunnerHandle::Get())); @@ -147,7 +149,38 @@ FROM_HERE, base::BindOnce(std::move(callback), std::move(download_names))); } + +void OnPathReserved( + const DownloadItemImplDelegate::DownloadTargetCallback& callback, + DownloadDangerType danger_type, + const InProgressDownloadManager::IntermediatePathCallback& + intermediate_path_cb, + const base::FilePath& forced_file_path, + PathValidationResult result, + const base::FilePath& target_path) { + base::FilePath intermediate_path; + if (!target_path.empty() && + (result == PathValidationResult::SUCCESS || + result == download::PathValidationResult::SAME_AS_SOURCE)) { + if (!forced_file_path.empty()) { + DCHECK_EQ(target_path, forced_file_path); + intermediate_path = target_path; + } else if (intermediate_path_cb) { + intermediate_path = intermediate_path_cb.Run(target_path); + } + } + + RecordBackgroundTargetDeterminationResult( + intermediate_path.empty() + ? BackgroudTargetDeterminationResultTypes::kPathReservationFailed + : BackgroudTargetDeterminationResultTypes::kSuccess); + callback.Run(target_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, + danger_type, intermediate_path, + intermediate_path.empty() ? DOWNLOAD_INTERRUPT_REASON_FILE_FAILED + : DOWNLOAD_INTERRUPT_REASON_NONE); +} #endif + } // namespace bool InProgressDownloadManager::Delegate::InterceptDownload( @@ -263,6 +296,7 @@ std::move(url_loader_factory_getter), url_security_policy_, is_new_download, weak_factory_.GetWeakPtr(), site_url, tab_url, tab_referrer_url, connector_ ? connector_->Clone() : nullptr, + !delegate_ /* is_background_mode */, base::ThreadTaskRunnerHandle::Get())); } @@ -311,26 +345,40 @@ void InProgressDownloadManager::DetermineDownloadTarget( DownloadItemImpl* download, const DownloadTargetCallback& callback) { - base::FilePath target_path = download->GetTargetFilePath().empty() - ? download->GetForcedFilePath() - : download->GetTargetFilePath(); - base::FilePath intermediate_path = download->GetFullPath().empty() - ? download->GetForcedFilePath() - : download->GetFullPath(); #if defined(OS_ANDROID) + base::FilePath target_path = download->GetForcedFilePath().empty() + ? download->GetTargetFilePath() + : download->GetForcedFilePath(); + + if (target_path.empty()) { + callback.Run(target_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, + download->GetDangerType(), target_path, + DOWNLOAD_INTERRUPT_REASON_FILE_FAILED); + RecordBackgroundTargetDeterminationResult( + BackgroudTargetDeterminationResultTypes::kTargetPathMissing); + return; + } + // If final target is a content URI, the intermediate path should // be identical to it. - if (target_path.IsContentUri()) - intermediate_path = target_path; -#endif - if (!target_path.empty() && intermediate_path.empty()) { - if (intermediate_path_cb_) - intermediate_path = intermediate_path_cb_.Run(target_path); + if (target_path.IsContentUri()) { + callback.Run(target_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, + download->GetDangerType(), target_path, + DOWNLOAD_INTERRUPT_REASON_NONE); + RecordBackgroundTargetDeterminationResult( + BackgroudTargetDeterminationResultTypes::kSuccess); + return; } - callback.Run(target_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, - download->GetDangerType(), intermediate_path, - intermediate_path.empty() ? DOWNLOAD_INTERRUPT_REASON_FILE_FAILED - : DOWNLOAD_INTERRUPT_REASON_NONE); + + DownloadPathReservationTracker::GetReservedPath( + download, target_path, target_path.DirName(), default_download_dir_, + true /* create_directory */, + download->GetForcedFilePath().empty() + ? DownloadPathReservationTracker::UNIQUIFY + : DownloadPathReservationTracker::OVERWRITE, + base::Bind(&OnPathReserved, callback, download->GetDangerType(), + intermediate_path_cb_, download->GetForcedFilePath())); +#endif } void InProgressDownloadManager::ResumeInterruptedDownload(
diff --git a/components/download/internal/common/resource_downloader.cc b/components/download/internal/common/resource_downloader.cc index 912437b..aaeef1a6 100644 --- a/components/download/internal/common/resource_downloader.cc +++ b/components/download/internal/common/resource_downloader.cc
@@ -71,6 +71,7 @@ bool is_new_download, bool is_parallel_request, std::unique_ptr<service_manager::Connector> connector, + bool is_background_mode, const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { auto downloader = std::make_unique<ResourceDownloader>( delegate, std::move(request), params->render_process_host_id(), @@ -79,7 +80,7 @@ std::move(url_loader_factory_getter), url_security_policy, std::move(connector)); - downloader->Start(std::move(params), is_parallel_request); + downloader->Start(std::move(params), is_parallel_request, is_background_mode); return downloader; } @@ -146,7 +147,8 @@ void ResourceDownloader::Start( std::unique_ptr<DownloadUrlParameters> download_url_parameters, - bool is_parallel_request) { + bool is_parallel_request, + bool is_background_mode) { callback_ = download_url_parameters->callback(); upload_callback_ = download_url_parameters->upload_callback(); guid_ = download_url_parameters->guid(); @@ -163,7 +165,7 @@ download_url_parameters->request_origin(), download_url_parameters->download_source(), download_url_parameters->ignore_content_length_mismatch(), - std::vector<GURL>(1, resource_request_->url)); + std::vector<GURL>(1, resource_request_->url), is_background_mode); network::mojom::URLLoaderClientPtr url_loader_client_ptr; url_loader_client_binding_ = std::make_unique<mojo::Binding<network::mojom::URLLoaderClient>>( @@ -203,7 +205,8 @@ download::DownloadUrlParameters::RequestHeadersType(), std::string(), /* request_origin */ download::DownloadSource::NAVIGATION, - false /* ignore_content_length_mismatch */, std::move(url_chain)); + false /* ignore_content_length_mismatch */, std::move(url_chain), + false /* is_background_mode */); // Simulate on the new URLLoaderClient calls that happened on the old client. response_head->head.cert_status = cert_status;
diff --git a/components/download/internal/common/resource_downloader.h b/components/download/internal/common/resource_downloader.h index b2217c3..ed355ee3 100644 --- a/components/download/internal/common/resource_downloader.h +++ b/components/download/internal/common/resource_downloader.h
@@ -42,6 +42,7 @@ bool is_new_download, bool is_parallel_request, std::unique_ptr<service_manager::Connector> connector, + bool is_background_mode, const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); // Create a ResourceDownloader from a navigation that turns to be a download. @@ -95,7 +96,8 @@ // Helper method to start the network request. void Start( std::unique_ptr<download::DownloadUrlParameters> download_url_parameters, - bool is_parallel_request); + bool is_parallel_request, + bool is_background_mode); // Intercepts the navigation response. void InterceptResponse(
diff --git a/components/download/internal/common/url_download_handler_factory.cc b/components/download/internal/common/url_download_handler_factory.cc index c295bc9..d0634a03 100644 --- a/components/download/internal/common/url_download_handler_factory.cc +++ b/components/download/internal/common/url_download_handler_factory.cc
@@ -40,7 +40,8 @@ download::ResourceDownloader::BeginDownload( delegate, std::move(params), std::move(request), std::move(url_loader_factory_getter), url_security_policy, GURL(), - GURL(), GURL(), true, true, std::move(connector), task_runner) + GURL(), GURL(), true, true, std::move(connector), + false /* is_background_mode */, task_runner) .release(), base::OnTaskRunnerDeleter(base::ThreadTaskRunnerHandle::Get())); }
diff --git a/components/download/public/common/download_response_handler.h b/components/download/public/common/download_response_handler.h index 51a7337..9b67e71a 100644 --- a/components/download/public/common/download_response_handler.h +++ b/components/download/public/common/download_response_handler.h
@@ -53,7 +53,8 @@ const std::string& request_origin, DownloadSource download_source, bool ignore_content_length_mismatch, - std::vector<GURL> url_chain); + std::vector<GURL> url_chain, + bool is_background_mode); ~DownloadResponseHandler() override; // network::mojom::URLLoaderClient @@ -107,6 +108,8 @@ // Mojo interface ptr to send the completion status to the download sink. mojom::DownloadStreamClientPtr client_ptr_; + // Whether the download is running in background mode. + bool is_background_mode_; DISALLOW_COPY_AND_ASSIGN(DownloadResponseHandler); };
diff --git a/components/download/public/common/download_stats.h b/components/download/public/common/download_stats.h index e4735a5..9aff61c7 100644 --- a/components/download/public/common/download_stats.h +++ b/components/download/public/common/download_stats.h
@@ -440,7 +440,8 @@ const base::Optional<ui::PageTransition>& transition); COMPONENTS_DOWNLOAD_EXPORT void RecordDownloadHttpResponseCode( - int response_code); + int response_code, + bool is_background_mode); COMPONENTS_DOWNLOAD_EXPORT void RecordInProgressDBCount( InProgressDBCountTypes type); @@ -474,6 +475,24 @@ COMPONENTS_DOWNLOAD_EXPORT void RecordFirstBackgroundDownloadInterruptReason( DownloadInterruptReason reason, bool download_started); + +enum class BackgroudTargetDeterminationResultTypes { + // Target determination succeeded. + kSuccess = 0, + + // Target path doesn't exist. + kTargetPathMissing = 1, + + // Path reservation failed. + kPathReservationFailed = 2, + + kMaxValue = kPathReservationFailed +}; + +// Records whether download target determination is successfully completed in +// reduced mode. +COMPONENTS_DOWNLOAD_EXPORT void RecordBackgroundTargetDeterminationResult( + BackgroudTargetDeterminationResultTypes type); #endif // defined(OS_ANDROID) #if defined(OS_WIN)
diff --git a/components/download/public/common/in_progress_download_manager.h b/components/download/public/common/in_progress_download_manager.h index b9df800..a8c3506 100644 --- a/components/download/public/common/in_progress_download_manager.h +++ b/components/download/public/common/in_progress_download_manager.h
@@ -14,6 +14,7 @@ #include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h" #include "base/optional.h" +#include "build/build_config.h" #include "components/download/public/common/download_export.h" #include "components/download/public/common/download_file_factory.h" #include "components/download/public/common/download_item_impl_delegate.h" @@ -141,6 +142,7 @@ download_start_observer_ = observer; } +#if defined(OS_ANDROID) // Callback to generate an intermediate file path from the given target file // path; using IntermediatePathCallback = @@ -150,6 +152,11 @@ intermediate_path_cb_ = intermediate_path_cb; } + void set_default_download_dir(base::FilePath default_download_dir) { + default_download_dir_ = default_download_dir; + } +#endif + // Called to get all in-progress DownloadItemImpl. // TODO(qinmin): remove this method once InProgressDownloadManager owns // all in-progress downloads. @@ -251,9 +258,14 @@ // callback to check if an origin is secure. IsOriginSecureCallback is_origin_secure_cb_; - // callback to generate the intermediate file path. +#if defined(OS_ANDROID) + // Callback to generate the intermediate file path. IntermediatePathCallback intermediate_path_cb_; + // Default download directory. + base::FilePath default_download_dir_; +#endif + // A list of in-progress download items, could be null if DownloadManagerImpl // is managing all downloads. std::vector<std::unique_ptr<DownloadItemImpl>> in_progress_downloads_;
diff --git a/components/exo/wayland/clients/blur_main.cc b/components/exo/wayland/clients/blur_main.cc index c6de1318..4770413 100644 --- a/components/exo/wayland/clients/blur_main.cc +++ b/components/exo/wayland/clients/blur_main.cc
@@ -8,6 +8,7 @@ #include "base/at_exit.h" #include "base/command_line.h" +#include "base/message_loop/message_pump_type.h" #include "base/strings/string_number_conversions.h" #include "base/task/single_thread_task_executor.h" #include "components/exo/wayland/clients/blur.h" @@ -33,8 +34,7 @@ if (!params.FromCommandLine(*command_line)) return 1; - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); exo::wayland::clients::Blur client; if (!client.Init(params)) return 1;
diff --git a/components/exo/wayland/clients/explicit_synchronization.cc b/components/exo/wayland/clients/explicit_synchronization.cc index 13bcacc..cc346d2 100644 --- a/components/exo/wayland/clients/explicit_synchronization.cc +++ b/components/exo/wayland/clients/explicit_synchronization.cc
@@ -9,6 +9,7 @@ #include "base/at_exit.h" #include "base/command_line.h" #include "base/files/scoped_file.h" +#include "base/message_loop/message_pump_type.h" #include "base/task/single_thread_task_executor.h" #include "components/exo/wayland/clients/client_helper.h" #include "third_party/skia/include/core/SkCanvas.h" @@ -130,8 +131,7 @@ if (!params.FromCommandLine(*command_line)) return 1; - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); exo::wayland::clients::ExplicitSynchronizationClient client; if (!client.Init(params)) return 1;
diff --git a/components/exo/wayland/clients/fullscreen_shell_main.cc b/components/exo/wayland/clients/fullscreen_shell_main.cc index 5b36cbce..855fa68 100644 --- a/components/exo/wayland/clients/fullscreen_shell_main.cc +++ b/components/exo/wayland/clients/fullscreen_shell_main.cc
@@ -6,6 +6,7 @@ #include "base/at_exit.h" #include "base/command_line.h" +#include "base/message_loop/message_pump_type.h" #include "base/task/single_thread_task_executor.h" int main(int argc, char* argv[]) { @@ -21,8 +22,7 @@ if (!params.FromCommandLine(*command_line)) return 1; - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); exo::wayland::clients::FullscreenClient client; if (!client.Init(params))
diff --git a/components/exo/wayland/clients/rects.cc b/components/exo/wayland/clients/rects.cc index 34c0d369..8205cc3 100644 --- a/components/exo/wayland/clients/rects.cc +++ b/components/exo/wayland/clients/rects.cc
@@ -21,6 +21,7 @@ #include "base/containers/circular_deque.h" #include "base/logging.h" #include "base/memory/shared_memory.h" +#include "base/message_loop/message_pump_type.h" #include "base/scoped_generic.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" @@ -572,8 +573,7 @@ return 1; } - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); exo::wayland::clients::RectsClient client; return client.Run(params, max_frames_pending, num_rects, num_benchmark_runs, base::TimeDelta::FromMilliseconds(benchmark_interval_ms),
diff --git a/components/exo/wayland/clients/simple_main.cc b/components/exo/wayland/clients/simple_main.cc index 5e4367b..7e71d85 100644 --- a/components/exo/wayland/clients/simple_main.cc +++ b/components/exo/wayland/clients/simple_main.cc
@@ -8,6 +8,7 @@ #include "base/at_exit.h" #include "base/command_line.h" +#include "base/message_loop/message_pump_type.h" #include "base/task/single_thread_task_executor.h" #include "components/exo/wayland/clients/simple.h" @@ -24,8 +25,7 @@ if (!params.FromCommandLine(*command_line)) return 1; - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); exo::wayland::clients::Simple client; if (!client.Init(params)) return 1;
diff --git a/components/exo/wayland/clients/subsurface.cc b/components/exo/wayland/clients/subsurface.cc index e3ed80c..0ef02b65 100644 --- a/components/exo/wayland/clients/subsurface.cc +++ b/components/exo/wayland/clients/subsurface.cc
@@ -4,6 +4,7 @@ #include "base/at_exit.h" #include "base/command_line.h" +#include "base/message_loop/message_pump_type.h" #include "base/stl_util.h" #include "base/task/single_thread_task_executor.h" #include "components/exo/wayland/clients/client_base.h" @@ -154,8 +155,7 @@ if (!params.FromCommandLine(*command_line)) return 1; - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); exo::wayland::clients::SubSurfaceClient client; client.Run(params); return 1;
diff --git a/components/exo/wayland/clients/vulkan.cc b/components/exo/wayland/clients/vulkan.cc index d39f889..abdca8b 100644 --- a/components/exo/wayland/clients/vulkan.cc +++ b/components/exo/wayland/clients/vulkan.cc
@@ -4,6 +4,7 @@ #include "base/at_exit.h" #include "base/command_line.h" +#include "base/message_loop/message_pump_type.h" #include "base/stl_util.h" #include "base/task/single_thread_task_executor.h" #include "components/exo/wayland/clients/client_base.h" @@ -175,8 +176,7 @@ if (!params.FromCommandLine(*command_line)) return 1; - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); exo::wayland::clients::VulkanClient client; client.Run(params); return 1;
diff --git a/components/exo/wayland/clients/yuv.cc b/components/exo/wayland/clients/yuv.cc index 7b9cba13..32d91e2 100644 --- a/components/exo/wayland/clients/yuv.cc +++ b/components/exo/wayland/clients/yuv.cc
@@ -9,6 +9,7 @@ #include "base/at_exit.h" #include "base/command_line.h" +#include "base/message_loop/message_pump_type.h" #include "base/task/single_thread_task_executor.h" #include "components/exo/wayland/clients/client_base.h" #include "components/exo/wayland/clients/client_helper.h" @@ -136,8 +137,7 @@ params.bo_usage = GBM_BO_USE_SCANOUT | GBM_BO_USE_LINEAR | GBM_BO_USE_TEXTURING; - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); exo::wayland::clients::YuvClient client; client.Run(params); return 1;
diff --git a/components/favicon_base/favicon_url_parser.cc b/components/favicon_base/favicon_url_parser.cc index a9ea2b2b1..e9050c02 100644 --- a/components/favicon_base/favicon_url_parser.cc +++ b/components/favicon_base/favicon_url_parser.cc
@@ -31,12 +31,7 @@ const char kIconURLParameter[] = "iconurl/"; const char kSizeParameter[] = "size/"; - parsed->size_in_dip = gfx::kFaviconSize; - parsed->device_scale_factor = 1.0f; - parsed->path_index = std::string::npos; - // Use of the favicon server is never exposed for the legacy format (only used - // by extensions). - parsed->allow_favicon_server_fallback = false; + *parsed = chrome::ParsedFaviconPath(); if (path.empty()) return false; @@ -91,50 +86,39 @@ // Parse with FaviconUrlFormat::kFavicon2 format. bool ParseFaviconPathWithFavicon2Format(const std::string& path, chrome::ParsedFaviconPath* parsed) { - // Parameters which can be used in chrome://favicon2 path. See file - // "favicon_url_parser.h" for a description of what each one does. - const std::string kSizeParameter = "size"; - const std::string kScaleParameter = "scale_factor"; - const std::string kPageUrlParameter = "page_url"; - const std::string kIconUrlParameter = "icon_url"; - const std::string kAllowFallbackParameter = "allow_google_server_fallback"; - if (path.empty()) return false; - GURL query_url("chrome://favicon2/" + path); + GURL query_url = GURL("chrome://favicon2/").Resolve(path); - std::string size_str; - if (!net::GetValueForKeyInQuery(query_url, kSizeParameter, &size_str)) - parsed->size_in_dip = gfx::kFaviconSize; - else if (!base::StringToInt(size_str, &parsed->size_in_dip)) - return false; + *parsed = chrome::ParsedFaviconPath(); - std::string scale_str; - if (!net::GetValueForKeyInQuery(query_url, kScaleParameter, &scale_str)) - parsed->device_scale_factor = 1.0f; - else if (!webui::ParseScaleFactor(scale_str, &parsed->device_scale_factor)) - return false; - - if (!net::GetValueForKeyInQuery(query_url, kPageUrlParameter, - &parsed->page_url)) - parsed->page_url = ""; - - if (!net::GetValueForKeyInQuery(query_url, kIconUrlParameter, - &parsed->icon_url)) - parsed->icon_url = ""; + for (net::QueryIterator it(query_url); !it.IsAtEnd(); it.Advance()) { + const std::string key = it.GetKey(); + // Note: each of these keys can be used in chrome://favicon2 path. See file + // "favicon_url_parser.h" for a description of what each one does. + if (key == "allow_google_server_fallback") { + const std::string val = it.GetUnescapedValue(); + if (!(val == "0" || val == "1")) + return false; + parsed->allow_favicon_server_fallback = val == "1"; + } else if (key == "icon_url") { + parsed->icon_url = it.GetUnescapedValue(); + } else if (key == "page_url") { + parsed->page_url = it.GetUnescapedValue(); + } else if (key == "scale_factor" && + !webui::ParseScaleFactor(it.GetUnescapedValue(), + &parsed->device_scale_factor)) { + return false; + } else if (key == "size" && !base::StringToInt(it.GetUnescapedValue(), + &parsed->size_in_dip)) { + return false; + } + } if (parsed->page_url.empty() && parsed->icon_url.empty()) return false; - std::string allow_favicon_server_fallback; - if (!net::GetValueForKeyInQuery(query_url, kAllowFallbackParameter, - &allow_favicon_server_fallback)) - parsed->allow_favicon_server_fallback = false; - else if (!base::StringToInt(allow_favicon_server_fallback, - (int*)&parsed->allow_favicon_server_fallback)) - return false; - if (parsed->allow_favicon_server_fallback && parsed->page_url.empty()) { // Since the server is queried by page url, we'll fail if no non-empty page // url is provided and the fallback parameter is still set to true.
diff --git a/components/favicon_base/favicon_url_parser.h b/components/favicon_base/favicon_url_parser.h index b2feaa6b..aade746 100644 --- a/components/favicon_base/favicon_url_parser.h +++ b/components/favicon_base/favicon_url_parser.h
@@ -9,6 +9,8 @@ #include <string> +#include "ui/gfx/favicon_size.h" + namespace chrome { struct ParsedFaviconPath { @@ -23,18 +25,18 @@ std::string icon_url; // The size of the requested favicon in dip. - int size_in_dip; + int size_in_dip = gfx::kFaviconSize; // The device scale factor of the requested favicon. - float device_scale_factor; + float device_scale_factor = 1.0f; // TODO(victorvianna): Remove this parameter. // The index of the first character (relative to the path) where the the URL // from which the favicon is being requested is located. - size_t path_index; + size_t path_index = std::string::npos; // Whether we should allow making a request to the favicon server as fallback. - bool allow_favicon_server_fallback; + bool allow_favicon_server_fallback = false; }; // Enum describing the two possible url formats: the legacy chrome://favicon
diff --git a/components/feed/core/feed_scheduler_host.cc b/components/feed/core/feed_scheduler_host.cc index 4e6bd1d..05fb840 100644 --- a/components/feed/core/feed_scheduler_host.cc +++ b/components/feed/core/feed_scheduler_host.cc
@@ -569,18 +569,22 @@ return kDontRefreshRefreshSuppressed; } - if (attempt_age < GetTriggerThreshold(trigger)) { - DVLOG(2) << "Last attempt age of " << attempt_age - << " stopped refresh from trigger " << static_cast<int>(trigger); - return kDontRefreshNotStale; - } + // https://crbug.com/988165: When kThrottleBackgroundFetches == false, skip + // checks for quota and staleness for background fetching. + if (kThrottleBackgroundFetches.Get() || trigger != TriggerType::kFixedTimer) { + if (attempt_age < GetTriggerThreshold(trigger)) { + DVLOG(2) << "Last attempt age of " << attempt_age + << " stopped refresh from trigger " << static_cast<int>(trigger); + return kDontRefreshNotStale; + } - auto throttlerIter = throttlers_.find(user_class); - if (throttlerIter == throttlers_.end() || - !throttlerIter->second->RequestQuota()) { - DVLOG(2) << "Throttler stopped refresh from trigger " - << static_cast<int>(trigger); - return kDontRefreshRefreshThrottled; + auto throttlerIter = throttlers_.find(user_class); + if (throttlerIter == throttlers_.end() || + !throttlerIter->second->RequestQuota()) { + DVLOG(2) << "Throttler stopped refresh from trigger " + << static_cast<int>(trigger); + return kDontRefreshRefreshThrottled; + } } switch (trigger) {
diff --git a/components/feed/core/feed_scheduler_host_unittest.cc b/components/feed/core/feed_scheduler_host_unittest.cc index 78542e8..ece0df0 100644 --- a/components/feed/core/feed_scheduler_host_unittest.cc +++ b/components/feed/core/feed_scheduler_host_unittest.cc
@@ -654,6 +654,22 @@ EXPECT_EQ(3, refresh_call_count()); } +TEST_F(FeedSchedulerHostTest, OnFixedTimerThrottlingDisabled) { + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeatureWithParameters( + kInterestFeedContentSuggestions, + {{kThrottleBackgroundFetches.name, "false"}}); + + // Every call to OnFixedTimer() should cause a fetch. + scheduler()->OnFixedTimer(base::OnceClosure()); + EXPECT_EQ(1, refresh_call_count()); + scheduler()->OnReceiveNewContent(test_clock()->Now()); + + scheduler()->OnFixedTimer(base::OnceClosure()); + EXPECT_EQ(2, refresh_call_count()); + scheduler()->OnReceiveNewContent(test_clock()->Now()); +} + TEST_F(FeedSchedulerHostTest, ScheduleFixedTimerWakeUpOnSuccess) { // First wake up scheduled during Initialize(). EXPECT_EQ(1U, schedule_wake_up_times().size());
diff --git a/components/feed/feed_feature_list.cc b/components/feed/feed_feature_list.cc index 05839c2..d91a45fd 100644 --- a/components/feed/feed_feature_list.cc +++ b/components/feed/feed_feature_list.cc
@@ -15,6 +15,8 @@ &kInterestFeedContentSuggestions, "suppress_refresh_duration_minutes", 30}; const base::FeatureParam<int> kTimeoutDurationSeconds{ &kInterestFeedContentSuggestions, "timeout_duration_seconds", 30}; +const base::FeatureParam<bool> kThrottleBackgroundFetches{ + &kInterestFeedContentSuggestions, "throttle_background_fetches", true}; const base::Feature kInterestFeedNotifications{ "InterestFeedNotifications", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/components/feed/feed_feature_list.h b/components/feed/feed_feature_list.h index ddb9cdb..8744609 100644 --- a/components/feed/feed_feature_list.h +++ b/components/feed/feed_feature_list.h
@@ -17,6 +17,7 @@ extern const base::FeatureParam<std::string> kDisableTriggerTypes; extern const base::FeatureParam<int> kSuppressRefreshDurationMinutes; extern const base::FeatureParam<int> kTimeoutDurationSeconds; +extern const base::FeatureParam<bool> kThrottleBackgroundFetches; extern const base::Feature kInterestFeedNotifications;
diff --git a/components/grpc_support/test/get_stream_engine.cc b/components/grpc_support/test/get_stream_engine.cc index 2f019e8..5af279f 100644 --- a/components/grpc_support/test/get_stream_engine.cc +++ b/components/grpc_support/test/get_stream_engine.cc
@@ -20,7 +20,7 @@ #include "net/cert/mock_cert_verifier.h" #include "net/dns/mapped_host_resolver.h" #include "net/dns/mock_host_resolver.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/test/quic_simple_test_server.h" #include "net/url_request/url_request_test_util.h" @@ -49,25 +49,23 @@ UpdateHostResolverRules(); mock_cert_verifier_.reset(new net::MockCertVerifier()); mock_cert_verifier_->set_default_result(net::OK); - server_properties_.reset(new net::HttpServerPropertiesImpl()); - // Need to enable QUIC for the test server. auto params = std::make_unique<net::HttpNetworkSession::Params>(); params->enable_quic = true; params->enable_http2 = true; - net::AlternativeService alternative_service(net::kProtoQUIC, "", 443); - url::SchemeHostPort quic_hint_server( - "https", net::QuicSimpleTestServer::GetHost(), 443); - server_properties_->SetQuicAlternativeService( - quic_hint_server, alternative_service, base::Time::Max(), - quic::ParsedQuicVersionVector()); - request_context_->set_cert_verifier(mock_cert_verifier_.get()); request_context_->set_host_resolver(host_resolver_.get()); - request_context_->set_http_server_properties(server_properties_.get()); request_context_->set_http_network_session_params(std::move(params)); request_context_->Init(); + + // Need to enable QUIC for the test server. + net::AlternativeService alternative_service(net::kProtoQUIC, "", 443); + url::SchemeHostPort quic_hint_server( + "https", net::QuicSimpleTestServer::GetHost(), 443); + request_context_->http_server_properties()->SetQuicAlternativeService( + quic_hint_server, alternative_service, base::Time::Max(), + quic::ParsedQuicVersionVector()); } return request_context_.get(); } @@ -94,7 +92,6 @@ ~BidirectionalStreamTestURLRequestContextGetter() override {} int test_server_port_; - std::unique_ptr<net::HttpServerProperties> server_properties_; std::unique_ptr<net::MockCertVerifier> mock_cert_verifier_; std::unique_ptr<net::MappedHostResolver> host_resolver_; std::unique_ptr<net::TestURLRequestContext> request_context_;
diff --git a/components/gwp_asan/BUILD.gn b/components/gwp_asan/BUILD.gn index 3359d70e..7e6cc7a 100644 --- a/components/gwp_asan/BUILD.gn +++ b/components/gwp_asan/BUILD.gn
@@ -2,10 +2,17 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -source_set("unit_tests") { +import("//testing/test.gni") + +# Defined as a separate target so that on Android tests can be launched in a +# sub-thread instead of on the main thread to support multi-process tests. +# Can be removed after minSdkVersion >= Q +test("gwp_asan_unittests") { testonly = true deps = [ + "//base/test:run_all_unittests", "//components/gwp_asan/common:unit_tests", + "//testing/gtest", ] if (is_win || is_mac || is_linux) { deps += [
diff --git a/components/minidump_uploader/android/java/src/org/chromium/components/minidump_uploader/CrashFileManager.java b/components/minidump_uploader/android/java/src/org/chromium/components/minidump_uploader/CrashFileManager.java index 82b760d4..8839a511 100644 --- a/components/minidump_uploader/android/java/src/org/chromium/components/minidump_uploader/CrashFileManager.java +++ b/components/minidump_uploader/android/java/src/org/chromium/components/minidump_uploader/CrashFileManager.java
@@ -65,16 +65,27 @@ // define the id to be a sequence of non separator characters {`-`, `,` or `.`} private static final Pattern CRASH_LOCAL_ID_PATTERN = Pattern.compile("^[^.]+-([^-,]+?)\\."); - // Unlike the MINIDUMP_READY_FOR_UPLOAD_PATTERN below, this pattern omits a ".tryN" suffix. + // Unlike the MINIDUMP_ALL_READY_FOR_UPLOAD_PATTERN below, this pattern omits a ".tryN" suffix. private static final Pattern MINIDUMP_SANS_LOGCAT_PATTERN = Pattern.compile("\\.dmp([0-9]*)\\z"); - private static final Pattern MINIDUMP_READY_FOR_UPLOAD_PATTERN = + // Minidumps that are ready for uploading including forced uploads. + private static final Pattern MINIDUMP_ALL_READY_FOR_UPLOAD_PATTERN = Pattern.compile("\\.(dmp|forced)([0-9]*)(\\.try([0-9]+))\\z"); + // Minidumps that are ready for uploading excluding forced uploads. + private static final Pattern MINIDUMP_READY_FOR_UPLOAD_PATTERN = + Pattern.compile("\\.(dmp)([0-9]*)(\\.try([0-9]+))\\z"); + private static final Pattern UPLOADED_MINIDUMP_PATTERN = Pattern.compile("\\.up([0-9]*)(\\.try([0-9]+))\\z"); + private static final Pattern MINIDUMP_FORCED_UPLOAD_PATTERN = + Pattern.compile("\\.forced([0-9]*)(\\.try([0-9]+))\\z"); + + private static final Pattern MINIDUMP_SKIPPED_UPLOAD_PATTERN = + Pattern.compile("\\.skipped([0-9]*)(\\.try([0-9]+))\\z"); + private static final String NOT_YET_UPLOADED_MINIDUMP_SUFFIX = ".dmp"; private static final String UPLOADED_MINIDUMP_SUFFIX = ".up"; @@ -408,7 +419,31 @@ * Only returns files that we have tried to upload less than {@param maxTries} number of times. */ public File[] getMinidumpsReadyForUpload(int maxTries) { - return getFilesBelowMaxTries(listCrashFiles(MINIDUMP_READY_FOR_UPLOAD_PATTERN), maxTries); + return getFilesBelowMaxTries( + listCrashFiles(MINIDUMP_ALL_READY_FOR_UPLOAD_PATTERN), maxTries); + } + + /** + * Returns minidump files that could still be uploaded excluding forced uploads, + * sorted by modification time stamp. + */ + public File[] getMinidumpsNotForcedReadyForUpload() { + return listCrashFiles(MINIDUMP_READY_FOR_UPLOAD_PATTERN); + } + + /** + * Returns all minidump files that could still be uploaded, sorted by modification time stamp. + */ + public File[] getMinidumpsSkippedUpload() { + return listCrashFiles(MINIDUMP_SKIPPED_UPLOAD_PATTERN); + } + + /** + * Returns minidump files that are forced to be uploaded by the user, sorted by modification + * time stamp. + */ + public File[] getMinidumpsForcedUpload() { + return listCrashFiles(MINIDUMP_FORCED_UPLOAD_PATTERN); } /** @@ -596,7 +631,7 @@ * @param uid The uid of the app to check the minidump limit for. */ private void enforceMinidumpStorageRestrictions(int uid) { - File[] allMinidumpFiles = listCrashFiles(MINIDUMP_READY_FOR_UPLOAD_PATTERN); + File[] allMinidumpFiles = listCrashFiles(MINIDUMP_ALL_READY_FOR_UPLOAD_PATTERN); List<File> minidumpFilesWithCurrentUid = filterMinidumpFilesOnUid(allMinidumpFiles, uid); // If we have exceeded our cap per uid, delete the oldest minidump of the same uid
diff --git a/components/minidump_uploader/android/javatests/src/org/chromium/components/minidump_uploader/CrashFileManagerTest.java b/components/minidump_uploader/android/javatests/src/org/chromium/components/minidump_uploader/CrashFileManagerTest.java index b67106c..d7d0f71c 100644 --- a/components/minidump_uploader/android/javatests/src/org/chromium/components/minidump_uploader/CrashFileManagerTest.java +++ b/components/minidump_uploader/android/javatests/src/org/chromium/components/minidump_uploader/CrashFileManagerTest.java
@@ -328,6 +328,59 @@ @Test @SmallTest @Feature({"Android-AppBase"}) + public void testGetMinidumpsNotForcedReadyForUpload() throws IOException { + File forcedFile = new File(mTestRule.getCrashDir(), "456_def.forced" + TEST_PID + ".try2"); + forcedFile.createNewFile(); + forcedFile.setLastModified(mModificationTimestamp); + mModificationTimestamp += 1000; + + CrashFileManager crashFileManager = new CrashFileManager(mTestRule.getCacheDir()); + File[] expectedFiles = new File[] {mMultiDigitMaxTriesFile, mOneBelowMultiDigitMaxTriesFile, + mMaxTriesFile, mOneBelowMaxTriesFile, mDmpFile2, mDmpFile1}; + File[] actualFiles = crashFileManager.getMinidumpsNotForcedReadyForUpload(); + Assert.assertNotNull(actualFiles); + assertArrayEquals("Failed to get the correct minidump files in directory", expectedFiles, + actualFiles); + } + + @Test + @SmallTest + @Feature({"Android-AppBase"}) + public void testGetMinidumpsSkippedUpload() throws IOException { + File skippedFile = + new File(mTestRule.getCrashDir(), "456_def.skipped" + TEST_PID + ".try2"); + skippedFile.createNewFile(); + skippedFile.setLastModified(mModificationTimestamp); + mModificationTimestamp += 1000; + + CrashFileManager crashFileManager = new CrashFileManager(mTestRule.getCacheDir()); + File[] expectedFiles = new File[] {skippedFile}; + File[] actualFiles = crashFileManager.getMinidumpsSkippedUpload(); + Assert.assertNotNull(actualFiles); + assertArrayEquals("Failed to get the correct minidump files in directory", expectedFiles, + actualFiles); + } + + @Test + @SmallTest + @Feature({"Android-AppBase"}) + public void testGetMinidumpsForcedUpload() throws IOException { + File forcedFile = new File(mTestRule.getCrashDir(), "456_def.forced" + TEST_PID + ".try2"); + forcedFile.createNewFile(); + forcedFile.setLastModified(mModificationTimestamp); + mModificationTimestamp += 1000; + + CrashFileManager crashFileManager = new CrashFileManager(mTestRule.getCacheDir()); + File[] expectedFiles = new File[] {forcedFile}; + File[] actualFiles = crashFileManager.getMinidumpsForcedUpload(); + Assert.assertNotNull(actualFiles); + assertArrayEquals("Failed to get the correct minidump files in directory", expectedFiles, + actualFiles); + } + + @Test + @SmallTest + @Feature({"Android-AppBase"}) public void testGetFilesBelowMaxTries() { // No files in input -> return empty assertArrayEquals(new File[0],
diff --git a/components/nacl/loader/nacl_helper_linux.cc b/components/nacl/loader/nacl_helper_linux.cc index 6fddb88..5a98241 100644 --- a/components/nacl/loader/nacl_helper_linux.cc +++ b/components/nacl/loader/nacl_helper_linux.cc
@@ -25,6 +25,7 @@ #include "base/command_line.h" #include "base/files/scoped_file.h" #include "base/logging.h" +#include "base/message_loop/message_pump_type.h" #include "base/posix/eintr_wrapper.h" #include "base/posix/global_descriptors.h" #include "base/posix/unix_domain_socket.h" @@ -121,7 +122,7 @@ // The Mojo EDK must be initialized before using IPC. mojo::core::Init(); - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); #if defined(OS_NACL_NONSFI) CHECK(uses_nonsfi_mode); nacl::nonsfi::NonSfiListener listener;
diff --git a/components/nacl/loader/nacl_helper_win_64.cc b/components/nacl/loader/nacl_helper_win_64.cc index f3cb04d..767b9bd 100644 --- a/components/nacl/loader/nacl_helper_win_64.cc +++ b/components/nacl/loader/nacl_helper_win_64.cc
@@ -9,6 +9,7 @@ #include "base/command_line.h" #include "base/logging.h" +#include "base/message_loop/message_pump_type.h" #include "base/power_monitor/power_monitor.h" #include "base/power_monitor/power_monitor_device_source.h" #include "base/process/launch.h" @@ -35,7 +36,7 @@ // main() routine for the NaCl broker process. // This is necessary for supporting NaCl in Chrome on Win64. int NaClBrokerMain(const content::MainFunctionParams& parameters) { - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); base::PlatformThread::SetName("CrNaClBrokerMain"); mojo::core::Init();
diff --git a/components/nacl/loader/nacl_main.cc b/components/nacl/loader/nacl_main.cc index cdaa18b..8764024 100644 --- a/components/nacl/loader/nacl_main.cc +++ b/components/nacl/loader/nacl_main.cc
@@ -5,6 +5,7 @@ #include <utility> #include "base/command_line.h" +#include "base/message_loop/message_pump_type.h" #include "base/power_monitor/power_monitor.h" #include "base/power_monitor/power_monitor_device_source.h" #include "base/task/single_thread_task_executor.h" @@ -24,8 +25,7 @@ mojo::core::Init(); // The main thread of the plugin services IO. - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::IO); base::PlatformThread::SetName("CrNaClMain"); base::PowerMonitor::Initialize(
diff --git a/components/optimization_guide/hints_fetcher.cc b/components/optimization_guide/hints_fetcher.cc index d890e1e82..b8a0205 100644 --- a/components/optimization_guide/hints_fetcher.cc +++ b/components/optimization_guide/hints_fetcher.cc
@@ -143,6 +143,9 @@ if (net_status == net::OK && response_code == net::HTTP_OK && get_hints_response->ParseFromString(get_hints_response_data)) { + UMA_HISTOGRAM_COUNTS_100( + "OptimizationGuide.HintsFetcher.GetHintsRequest.HintCount", + get_hints_response->hints_size()); std::move(hints_fetched_callback_).Run(std::move(get_hints_response)); } else { std::move(hints_fetched_callback_).Run(base::nullopt);
diff --git a/components/optimization_guide/optimization_guide_prefs.cc b/components/optimization_guide/optimization_guide_prefs.cc index e759f55..05f11264 100644 --- a/components/optimization_guide/optimization_guide_prefs.cc +++ b/components/optimization_guide/optimization_guide_prefs.cc
@@ -24,13 +24,13 @@ // for until visited again after DataSaver was enabled. If The hash of the host // is in the dictionary, then it is on the blacklist and should not be used, the // |value| in the key-value pair is not used. -const char kHintsFetcherTopHostBlacklist[] = +const char kHintsFetcherDataSaverTopHostBlacklist[] = "optimization_guide.hintsfetcher.top_host_blacklist"; // An integer pref that stores the state of the blacklist for the top host // provider for blacklisting hosts after DataSaver is enabled. The state maps to // the HintsFetcherTopHostBlacklistState enum. -const char kHintsFetcherTopHostBlacklistState[] = +const char kHintsFetcherDataSaverTopHostBlacklistState[] = "optimization_guide.hintsfetcher.top_host_blacklist_state"; // A string pref that stores the version of the Optimization Hints component @@ -46,10 +46,10 @@ kHintsFetcherLastFetchAttempt, base::Time().ToDeltaSinceWindowsEpoch().InMicroseconds(), PrefRegistry::LOSSY_PREF); - registry->RegisterDictionaryPref(kHintsFetcherTopHostBlacklist, + registry->RegisterDictionaryPref(kHintsFetcherDataSaverTopHostBlacklist, PrefRegistry::LOSSY_PREF); registry->RegisterIntegerPref( - kHintsFetcherTopHostBlacklistState, + kHintsFetcherDataSaverTopHostBlacklistState, static_cast<int>(HintsFetcherTopHostBlacklistState::kNotInitialized), PrefRegistry::LOSSY_PREF); registry->RegisterStringPref(kPendingHintsProcessingVersion, "",
diff --git a/components/optimization_guide/optimization_guide_prefs.h b/components/optimization_guide/optimization_guide_prefs.h index 685efb3a..ca14ac9 100644 --- a/components/optimization_guide/optimization_guide_prefs.h +++ b/components/optimization_guide/optimization_guide_prefs.h
@@ -14,8 +14,8 @@ extern const char kHintLoadedCounts[]; extern const char kHintsFetcherLastFetchAttempt[]; -extern const char kHintsFetcherTopHostBlacklist[]; -extern const char kHintsFetcherTopHostBlacklistState[]; +extern const char kHintsFetcherDataSaverTopHostBlacklist[]; +extern const char kHintsFetcherDataSaverTopHostBlacklistState[]; extern const char kPendingHintsProcessingVersion[]; // State of |HintsFetcherTopHostsBlacklist|. The blacklist begins in
diff --git a/components/page_info_strings.grdp b/components/page_info_strings.grdp index 9a434e232..532169e3 100644 --- a/components/page_info_strings.grdp +++ b/components/page_info_strings.grdp
@@ -270,6 +270,9 @@ <message name="IDS_PAGE_INFO_TYPE_SERIAL" desc="The label used for the serial port permission controls in the Page Info popup."> Serial ports </message> + <message name="IDS_PAGE_INFO_TYPE_NATIVE_FILE_SYSTEM_WRITE" desc="The label used for the native file system write permission controls in the Page Info popup. The write permission determines whether sites are allowed to save to the original file that was selected by the user through the Native File System API."> + Files on device + </message> <message name="IDS_PAGE_INFO_TYPE_BLUETOOTH_SCANNING" desc="The label used for the Bluetooth scanning controls in the Page Info popup."> Bluetooth scanning </message>
diff --git a/components/page_info_strings_grdp/IDS_PAGE_INFO_TYPE_NATIVE_FILE_SYSTEM_WRITE.png.sha1 b/components/page_info_strings_grdp/IDS_PAGE_INFO_TYPE_NATIVE_FILE_SYSTEM_WRITE.png.sha1 new file mode 100644 index 0000000..89fb4b2 --- /dev/null +++ b/components/page_info_strings_grdp/IDS_PAGE_INFO_TYPE_NATIVE_FILE_SYSTEM_WRITE.png.sha1
@@ -0,0 +1 @@ +38a70bcecbe1c8daeb8341794641d670195ab398 \ No newline at end of file
diff --git a/components/password_manager/core/browser/browser_save_password_progress_logger.cc b/components/password_manager/core/browser/browser_save_password_progress_logger.cc index e52c611..5cd48880 100644 --- a/components/password_manager/core/browser/browser_save_password_progress_logger.cc +++ b/components/password_manager/core/browser/browser_save_password_progress_logger.cc
@@ -4,6 +4,8 @@ #include "components/password_manager/core/browser/browser_save_password_progress_logger.h" +#include <utility> + #include "base/strings/strcat.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" @@ -20,6 +22,10 @@ #include "components/password_manager/core/browser/password_manager.h" using autofill::AutofillUploadContents; +using autofill::FieldPropertiesFlags; +using autofill::FormStructure; +using autofill::PasswordAttribute; +using autofill::ServerFieldType; using base::NumberToString; namespace password_manager { @@ -98,7 +104,7 @@ void BrowserSavePasswordProgressLogger::LogFormSignatures( SavePasswordProgressLogger::StringID label, const autofill::PasswordForm& form) { - autofill::FormStructure form_structure(form.form_data); + FormStructure form_structure(form.form_data); std::string message = GetStringFromID(label) + ": {\n"; message += GetStringFromID(STRING_FORM_SIGNATURE) + ": " + FormSignatureToDebugString(form_structure.form_signature()) + "\n"; @@ -117,7 +123,7 @@ void BrowserSavePasswordProgressLogger::LogFormStructure( StringID label, - const autofill::FormStructure& form_structure) { + const FormStructure& form_structure) { std::string message = GetStringFromID(label) + ": {\n"; message += GetStringFromID(STRING_FORM_SIGNATURE) + ": " + FormSignatureToDebugString(form_structure.form_signature()) + "\n"; @@ -126,6 +132,7 @@ message += GetStringFromID(STRING_ACTION) + ": " + ScrubURL(form_structure.target_url()) + "\n"; message += FormStructureToFieldsLogString(form_structure); + message += FormStructurePasswordAttributesLogString(form_structure); message += "}"; SendLog(message); } @@ -143,8 +150,59 @@ SendLog(message); } +std::string +BrowserSavePasswordProgressLogger::FormStructurePasswordAttributesLogString( + const FormStructure& form) { + const base::Optional<std::pair<PasswordAttribute, bool>> attribute_vote = + form.get_password_attributes_vote(); + if (!attribute_vote.has_value()) + return std::string(); + std::string message; + const PasswordAttribute attribute = std::get<0>(attribute_vote.value()); + const bool attribute_value = std::get<1>(attribute_vote.value()); + + switch (attribute) { + case PasswordAttribute::kHasLowercaseLetter: + message += BinaryPasswordAttributeLogString( + STRING_PASSWORD_REQUIREMENTS_VOTE_FOR_LOWERCASE, attribute_value); + break; + + case PasswordAttribute::kHasUppercaseLetter: + message += BinaryPasswordAttributeLogString( + STRING_PASSWORD_REQUIREMENTS_VOTE_FOR_UPPERCASE, attribute_value); + break; + + case PasswordAttribute::kHasNumeric: + message += BinaryPasswordAttributeLogString( + STRING_PASSWORD_REQUIREMENTS_VOTE_FOR_NUMERICS, attribute_value); + break; + + case PasswordAttribute::kHasSpecialSymbol: + message += BinaryPasswordAttributeLogString( + STRING_PASSWORD_REQUIREMENTS_VOTE_FOR_SPECIAL_SYMBOL, + attribute_value); + if (attribute_value) { + std::string voted_symbol( + 1, static_cast<char>(form.get_password_symbol_vote())); + message += PasswordAttributeLogString( + STRING_PASSWORD_REQUIREMENTS_VOTE_FOR_SPECIFIC_SPECIAL_SYMBOL, + voted_symbol); + } + break; + + case PasswordAttribute::kPasswordAttributesCount: + break; + } + std::string password_length = + base::NumberToString(form.get_password_length_vote()); + message += PasswordAttributeLogString( + STRING_PASSWORD_REQUIREMENTS_VOTE_FOR_PASSWORD_LENGTH, password_length); + + return message; +} + std::string BrowserSavePasswordProgressLogger::FormStructureToFieldsLogString( - const autofill::FormStructure& form_structure) { + const FormStructure& form_structure) { std::string result; result += GetStringFromID(STRING_FIELDS) + ": " + "\n"; for (const auto& field : form_structure) { @@ -166,7 +224,7 @@ autofill::AutofillType::ServerFieldTypeToString(field->server_type()); } - for (autofill::ServerFieldType type : field->possible_types()) + for (ServerFieldType type : field->possible_types()) field_info += ", VOTE: " + autofill::AutofillType::ServerFieldTypeToString(type); @@ -175,32 +233,37 @@ if (field->properties_mask) { field_info += ", properties="; - field_info += - (field->properties_mask & autofill::FieldPropertiesFlags::USER_TYPED) - ? "T" - : "_"; + field_info += (field->properties_mask & FieldPropertiesFlags::USER_TYPED) + ? "T" + : "_"; field_info += (field->properties_mask & - autofill::FieldPropertiesFlags::AUTOFILLED_ON_PAGELOAD) + FieldPropertiesFlags::AUTOFILLED_ON_PAGELOAD) ? "Ap" : "__"; field_info += (field->properties_mask & - autofill::FieldPropertiesFlags::AUTOFILLED_ON_USER_TRIGGER) + FieldPropertiesFlags::AUTOFILLED_ON_USER_TRIGGER) ? "Au" : "__"; - field_info += - (field->properties_mask & autofill::FieldPropertiesFlags::HAD_FOCUS) - ? "F" - : "_"; - field_info += - (field->properties_mask & autofill::FieldPropertiesFlags::KNOWN_VALUE) - ? "K" - : "_"; + field_info += (field->properties_mask & FieldPropertiesFlags::HAD_FOCUS) + ? "F" + : "_"; + field_info += (field->properties_mask & FieldPropertiesFlags::KNOWN_VALUE) + ? "K" + : "_"; + } + + if (field->initial_value_hash().has_value()) { + field_info += ", initial value hash="; + field_info += field->initial_value_hash().value(); } std::string generation = GenerationTypeToString(field->generation_type()); if (!generation.empty()) field_info += ", GENERATION_EVENT: " + generation; + if (field->generated_password_changed()) + field_info += ", generated password changed"; + result += field_info + "\n"; } @@ -271,4 +334,17 @@ log_manager_->LogTextMessage(log); } +std::string BrowserSavePasswordProgressLogger::PasswordAttributeLogString( + StringID string_id, + const std::string& attribute_value) { + return GetStringFromID(string_id) + ": " + attribute_value + "\n"; +} + +std::string BrowserSavePasswordProgressLogger::BinaryPasswordAttributeLogString( + StringID string_id, + bool attribute_value) { + return PasswordAttributeLogString(string_id, + (attribute_value ? "yes" : "no")); +} + } // namespace password_manager
diff --git a/components/password_manager/core/browser/browser_save_password_progress_logger.h b/components/password_manager/core/browser/browser_save_password_progress_logger.h index 5152f836..7a072d5 100644 --- a/components/password_manager/core/browser/browser_save_password_progress_logger.h +++ b/components/password_manager/core/browser/browser_save_password_progress_logger.h
@@ -65,10 +65,22 @@ // outlive this logger. const autofill::LogManager* const log_manager_; - // Return string representation for FormStructure. + // Returns string representation for |FormStructure|. std::string FormStructureToFieldsLogString( const autofill::FormStructure& form); + // Returns string representation of password attributes for |FormStructure|. + std::string FormStructurePasswordAttributesLogString( + const autofill::FormStructure& form); + + // Returns the string representation of a password attribute. + std::string PasswordAttributeLogString(StringID string_id, + const std::string& attribute_value); + + // Returns the string representation of a binary password attribute. + std::string BinaryPasswordAttributeLogString(StringID string_id, + bool attribute_value); + DISALLOW_COPY_AND_ASSIGN(BrowserSavePasswordProgressLogger); };
diff --git a/components/password_manager/core/browser/leak_detection/leak_detection_api.proto b/components/password_manager/core/browser/leak_detection/leak_detection_api.proto index 8466c060..1ac9472 100644 --- a/components/password_manager/core/browser/leak_detection/leak_detection_api.proto +++ b/components/password_manager/core/browser/leak_detection/leak_detection_api.proto
@@ -1,6 +1,6 @@ syntax = "proto3"; -package leak_detection; +package google.internal.identity.passwords.leak.check.v1; option optimize_for = LITE_RUNTIME;
diff --git a/components/password_manager/core/browser/password_form_manager_unittest.cc b/components/password_manager/core/browser/password_form_manager_unittest.cc index 26d3af01..8b2ff26e 100644 --- a/components/password_manager/core/browser/password_form_manager_unittest.cc +++ b/components/password_manager/core/browser/password_form_manager_unittest.cc
@@ -169,10 +169,10 @@ MATCHER_P(HasPasswordAttributesVote, is_vote_expected, "") { base::Optional<std::pair<autofill::PasswordAttribute, bool>> vote = - arg.get_password_attributes_vote_for_testing(); + arg.get_password_attributes_vote(); EXPECT_EQ(is_vote_expected, vote.has_value()); if (vote.has_value()) { - size_t reported_length = arg.get_password_length_vote_for_testing(); + size_t reported_length = arg.get_password_length_vote(); EXPECT_LT(0u, reported_length); EXPECT_LE(reported_length, 5u /* actual password length */); }
diff --git a/components/password_manager/core/browser/votes_uploader.cc b/components/password_manager/core/browser/votes_uploader.cc index 97b30d3..422479e 100644 --- a/components/password_manager/core/browser/votes_uploader.cc +++ b/components/password_manager/core/browser/votes_uploader.cc
@@ -5,8 +5,8 @@ #include "components/password_manager/core/browser/votes_uploader.h" #include <ctype.h> - #include <algorithm> +#include <iostream> #include <utility> #include "base/hash/hash.h" #include "base/logging.h" @@ -36,6 +36,7 @@ using autofill::ValueElementPair; using Logger = autofill::SavePasswordProgressLogger; +using StringID = autofill::SavePasswordProgressLogger::StringID; namespace password_manager { @@ -342,7 +343,7 @@ if (password_manager_util::IsLoggingActive(client_)) { BrowserSavePasswordProgressLogger logger(client_->GetLogManager()); - logger.LogFormStructure(Logger::STRING_FORM_VOTES, form_structure); + logger.LogFormStructure(Logger::STRING_PASSWORD_FORM_VOTE, form_structure); } // Annotate the form with the source language of the page. @@ -397,11 +398,6 @@ // sure to receive them. form_structure.set_upload_required(UPLOAD_REQUIRED); - if (password_manager_util::IsLoggingActive(client_)) { - BrowserSavePasswordProgressLogger logger(client_->GetLogManager()); - logger.LogFormStructure(Logger::STRING_FORM_VOTES, form_structure); - } - // Annotate the form with the source language of the page. form_structure.set_page_language(client_->GetPageLanguage()); @@ -412,6 +408,11 @@ SetInitialHashValueOfUsernameField( form_to_upload.username_element_renderer_id, &form_structure); + if (password_manager_util::IsLoggingActive(client_)) { + BrowserSavePasswordProgressLogger logger(client_->GetLogManager()); + logger.LogFormStructure(Logger::STRING_FIRSTUSE_FORM_VOTE, form_structure); + } + download_manager->StartUploadRequest( form_structure, false /* was_autofilled */, available_field_types, std::string(), true /* observed_submission */, nullptr /* prefs */);
diff --git a/components/password_manager/core/browser/votes_uploader_unittest.cc b/components/password_manager/core/browser/votes_uploader_unittest.cc index a72bbf42..9643c8e 100644 --- a/components/password_manager/core/browser/votes_uploader_unittest.cc +++ b/components/password_manager/core/browser/votes_uploader_unittest.cc
@@ -248,14 +248,13 @@ votes_uploader.GeneratePasswordAttributesVote(password_value, &form_structure); base::Optional<std::pair<PasswordAttribute, bool>> vote = - form_structure.get_password_attributes_vote_for_testing(); + form_structure.get_password_attributes_vote(); int attribute_index = static_cast<int>(vote->first); if (vote->second) reported_true[attribute_index]++; else reported_false[attribute_index]++; - size_t reported_length = - form_structure.get_password_length_vote_for_testing(); + size_t reported_length = form_structure.get_password_length_vote(); if (reported_length == password_value.size()) { reported_actual_length++; } else { @@ -305,19 +304,19 @@ votes_uploader.GeneratePasswordAttributesVote(password_value, &form_structure); base::Optional<std::pair<PasswordAttribute, bool>> vote = - form_structure.get_password_attributes_vote_for_testing(); + form_structure.get_password_attributes_vote(); // Continue if the vote is not about special symbols or implies that no // special symbols are used. if (static_cast<int>(vote->first) != kSpecialSymbolsAttribute || !vote->second) { - EXPECT_EQ(form_structure.get_password_symbol_vote_for_testing(), 0); + EXPECT_EQ(form_structure.get_password_symbol_vote(), 0); continue; } number_of_symbol_votes += 1; - int symbol = form_structure.get_password_symbol_vote_for_testing(); + int symbol = form_structure.get_password_symbol_vote(); if (symbol == '-' || symbol == '!') correct_symbol_reported += 1; else @@ -336,10 +335,9 @@ votes_uploader.GeneratePasswordAttributesVote(ASCIIToUTF16("1"), &form_structure); base::Optional<std::pair<PasswordAttribute, bool>> vote = - form_structure.get_password_attributes_vote_for_testing(); + form_structure.get_password_attributes_vote(); EXPECT_TRUE(vote.has_value()); - size_t reported_length = - form_structure.get_password_length_vote_for_testing(); + size_t reported_length = form_structure.get_password_length_vote(); EXPECT_EQ(1u, reported_length); } @@ -352,7 +350,7 @@ "stuvwxyz!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"), &form_structure); base::Optional<std::pair<PasswordAttribute, bool>> vote = - form_structure.get_password_attributes_vote_for_testing(); + form_structure.get_password_attributes_vote(); EXPECT_TRUE(vote.has_value()); } @@ -369,7 +367,7 @@ votes_uploader.GeneratePasswordAttributesVote(base::UTF8ToUTF16(password), &form_structure); base::Optional<std::pair<PasswordAttribute, bool>> vote = - form_structure.get_password_attributes_vote_for_testing(); + form_structure.get_password_attributes_vote(); EXPECT_FALSE(vote.has_value()) << password; }
diff --git a/components/viz/demo/demo_main.cc b/components/viz/demo/demo_main.cc index b095759..8325ce4 100644 --- a/components/viz/demo/demo_main.cc +++ b/components/viz/demo/demo_main.cc
@@ -6,6 +6,7 @@ #include "base/command_line.h" #include "base/i18n/icu_util.h" #include "base/macros.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "base/task/thread_pool/thread_pool.h" @@ -49,8 +50,7 @@ private: // The exit manager is in charge of calling the dtors of singleton objects. base::AtExitManager exit_manager_; - base::SingleThreadTaskExecutor main_task_executor_{ - base::MessagePump::Type::UI}; + base::SingleThreadTaskExecutor main_task_executor_{base::MessagePumpType::UI}; DISALLOW_COPY_AND_ASSIGN(InitBase); }; @@ -61,7 +61,7 @@ InitMojo() : thread_("Mojo thread") { mojo::core::Init(); thread_.StartWithOptions( - base::Thread::Options(base::MessagePump::Type::IO, 0)); + base::Thread::Options(base::MessagePumpType::IO, 0)); ipc_support_ = std::make_unique<mojo::core::ScopedIPCSupport>( thread_.task_runner(), mojo::core::ScopedIPCSupport::ShutdownPolicy::CLEAN);
diff --git a/content/browser/android/ime_adapter_android.cc b/content/browser/android/ime_adapter_android.cc index ffeed4c..a9f3634 100644 --- a/content/browser/android/ime_adapter_android.cc +++ b/content/browser/android/ime_adapter_android.cc
@@ -184,9 +184,10 @@ ConvertUTF16ToJavaString(env, state.value); Java_ImeAdapterImpl_updateState( env, obj, static_cast<int>(state.type), state.flags, state.mode, - static_cast<int>(state.action), state.show_ime_if_needed, jstring_text, - state.selection_start, state.selection_end, state.composition_start, - state.composition_end, state.reply_to_request); + static_cast<int>(state.action), state.show_ime_if_needed, + state.always_hide_ime, jstring_text, state.selection_start, + state.selection_end, state.composition_start, state.composition_end, + state.reply_to_request); } void ImeAdapterAndroid::UpdateOnTouchDown() {
diff --git a/content/browser/appcache/appcache_fuzzer.cc b/content/browser/appcache/appcache_fuzzer.cc index 05f17d17..b3bf7cbe 100644 --- a/content/browser/appcache/appcache_fuzzer.cc +++ b/content/browser/appcache/appcache_fuzzer.cc
@@ -12,7 +12,6 @@ #include "base/test/test_timeouts.h" #include "content/browser/appcache/appcache_fuzzer.pb.h" #include "content/browser/appcache/chrome_appcache_service.h" -#include "content/browser/loader/navigation_url_loader_impl.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/test/test_browser_thread_bundle.h" #include "content/test/test_content_browser_client.h" @@ -48,21 +47,11 @@ appcache_service = base::MakeRefCounted<ChromeAppCacheService>( /*proxy=*/nullptr, /*partition=*/nullptr); - scoped_refptr<URLLoaderFactoryGetter> loader_factory_getter = - base::MakeRefCounted<URLLoaderFactoryGetter>(); - loader_factory_getter->SetNetworkFactoryForTesting( - mock_url_loader_factory, /* is_corb_enabled = */ true); - appcache_service->set_url_loader_factory_getter( - loader_factory_getter.get()); - - base::PostTask( - FROM_HERE, - {NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()}, - base::BindOnce(&ChromeAppCacheService::InitializeOnLoaderThread, - appcache_service, base::FilePath(), - /*browser_context=*/nullptr, - /*resource_context=*/nullptr, - /*special_storage_policy=*/nullptr)); + base::PostTask(FROM_HERE, {BrowserThread::UI}, + base::BindOnce(&ChromeAppCacheService::Initialize, + appcache_service, base::FilePath(), + /*browser_context=*/nullptr, + /*special_storage_policy=*/nullptr)); thread_bundle.RunUntilIdle(); }
diff --git a/content/browser/appcache/appcache_internals_ui.cc b/content/browser/appcache/appcache_internals_ui.cc index 92f2fa19..71d5409a 100644 --- a/content/browser/appcache/appcache_internals_ui.cc +++ b/content/browser/appcache/appcache_internals_ui.cc
@@ -19,7 +19,6 @@ #include "base/values.h" #include "content/browser/appcache/appcache.h" #include "content/browser/appcache/appcache_response.h" -#include "content/browser/loader/navigation_url_loader_impl.h" #include "content/browser/storage_partition_impl.h" #include "content/grit/content_resources.h" #include "content/public/browser/browser_context.h" @@ -163,11 +162,9 @@ void AppCacheInternalsUI::Proxy::Initialize( const scoped_refptr<ChromeAppCacheService>& chrome_appcache_service) { - if (!BrowserThread::CurrentlyOn( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID())) { + if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { base::PostTask( - FROM_HERE, - {NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()}, + FROM_HERE, {BrowserThread::UI}, base::BindOnce(&Proxy::Initialize, this, chrome_appcache_service)); return; } @@ -181,12 +178,9 @@ } void AppCacheInternalsUI::Proxy::Shutdown() { - if (!BrowserThread::CurrentlyOn( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID())) { - base::PostTask( - FROM_HERE, - {NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()}, - base::BindOnce(&Proxy::Shutdown, this)); + if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { + base::PostTask(FROM_HERE, {BrowserThread::UI}, + base::BindOnce(&Proxy::Shutdown, this)); return; } shutdown_called_ = true; @@ -198,12 +192,9 @@ } void AppCacheInternalsUI::Proxy::RequestAllAppCacheInfo() { - if (!BrowserThread::CurrentlyOn( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID())) { - base::PostTask( - FROM_HERE, - {NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()}, - base::BindOnce(&Proxy::RequestAllAppCacheInfo, this)); + if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { + base::PostTask(FROM_HERE, {BrowserThread::UI}, + base::BindOnce(&Proxy::RequestAllAppCacheInfo, this)); return; } if (appcache_service_) { @@ -218,24 +209,14 @@ void AppCacheInternalsUI::Proxy::OnAllAppCacheInfoReady( scoped_refptr<AppCacheInfoCollection> collection, int net_result_code) { - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - appcache_internals_ui_->OnAllAppCacheInfoReady(collection, partition_path_); - } else { - base::PostTask( - FROM_HERE, {BrowserThread::UI}, - base::BindOnce(&AppCacheInternalsUI::OnAllAppCacheInfoReady, - appcache_internals_ui_, collection, partition_path_)); - } + appcache_internals_ui_->OnAllAppCacheInfoReady(collection, partition_path_); } void AppCacheInternalsUI::Proxy::DeleteAppCache( const std::string& manifest_url) { - if (!BrowserThread::CurrentlyOn( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID())) { - base::PostTask( - FROM_HERE, - {NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()}, - base::BindOnce(&Proxy::DeleteAppCache, this, manifest_url)); + if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { + base::PostTask(FROM_HERE, {BrowserThread::UI}, + base::BindOnce(&Proxy::DeleteAppCache, this, manifest_url)); return; } if (appcache_service_) { @@ -248,24 +229,15 @@ void AppCacheInternalsUI::Proxy::OnAppCacheInfoDeleted( const std::string& manifest_url, int net_result_code) { - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - appcache_internals_ui_->OnAppCacheInfoDeleted(partition_path_, manifest_url, - net_result_code == net::OK); - } else { - base::PostTask(FROM_HERE, {BrowserThread::UI}, - base::BindOnce(&AppCacheInternalsUI::OnAppCacheInfoDeleted, - appcache_internals_ui_, partition_path_, - manifest_url, net_result_code == net::OK)); - } + appcache_internals_ui_->OnAppCacheInfoDeleted(partition_path_, manifest_url, + net_result_code == net::OK); } void AppCacheInternalsUI::Proxy::RequestAppCacheDetails( const std::string& manifest_url) { - if (!BrowserThread::CurrentlyOn( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID())) { + if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { base::PostTask( - FROM_HERE, - {NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()}, + FROM_HERE, {BrowserThread::UI}, base::BindOnce(&Proxy::RequestAppCacheDetails, this, manifest_url)); return; } @@ -286,25 +258,15 @@ std::sort(resource_info_vector->begin(), resource_info_vector->end(), SortByResourceUrl); } - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - appcache_internals_ui_->OnAppCacheDetailsReady( - partition_path_, manifest_gurl.spec(), std::move(resource_info_vector)); - } else { - base::PostTask( - FROM_HERE, {BrowserThread::UI}, - base::BindOnce(&AppCacheInternalsUI::OnAppCacheDetailsReady, - appcache_internals_ui_, partition_path_, - manifest_gurl.spec(), std::move(resource_info_vector))); - } + appcache_internals_ui_->OnAppCacheDetailsReady( + partition_path_, manifest_gurl.spec(), std::move(resource_info_vector)); } void AppCacheInternalsUI::Proxy::RequestFileDetails( const ProxyResponseEnquiry& response_enquiry) { - if (!BrowserThread::CurrentlyOn( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID())) { + if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { base::PostTask( - FROM_HERE, - {NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()}, + FROM_HERE, {BrowserThread::UI}, base::BindOnce(&Proxy::RequestFileDetails, this, response_enquiry)); return; } @@ -361,26 +323,11 @@ if (shutdown_called_) return; if (!response_info || net_result_code < 0) { - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - appcache_internals_ui_->OnFileDetailsFailed(response_enquiry, - net_result_code); - } else { - base::PostTask(FROM_HERE, {BrowserThread::UI}, - base::BindOnce(&AppCacheInternalsUI::OnFileDetailsFailed, - appcache_internals_ui_, response_enquiry, - net_result_code)); - } + appcache_internals_ui_->OnFileDetailsFailed(response_enquiry, + net_result_code); } else { - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - appcache_internals_ui_->OnFileDetailsReady( - response_enquiry, response_info, response_data, net_result_code); - } else { - base::PostTask( - FROM_HERE, {BrowserThread::UI}, - base::BindOnce(&AppCacheInternalsUI::OnFileDetailsReady, - appcache_internals_ui_, response_enquiry, - response_info, response_data, net_result_code)); - } + appcache_internals_ui_->OnFileDetailsReady(response_enquiry, response_info, + response_data, net_result_code); } preparing_response_ = false; HandleFileDetailsRequest();
diff --git a/content/browser/appcache/appcache_navigation_handle.cc b/content/browser/appcache/appcache_navigation_handle.cc index f47592a..106e9a7e 100644 --- a/content/browser/appcache/appcache_navigation_handle.cc +++ b/content/browser/appcache/appcache_navigation_handle.cc
@@ -5,11 +5,8 @@ #include "content/browser/appcache/appcache_navigation_handle.h" #include "base/bind.h" -#include "base/task/post_task.h" #include "content/browser/appcache/appcache_navigation_handle_core.h" #include "content/browser/appcache/chrome_appcache_service.h" -#include "content/browser/loader/navigation_url_loader_impl.h" -#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" namespace content { @@ -22,32 +19,16 @@ appcache_host_id_, process_id)) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - core_->Initialize(); - } else { - base::PostTask(FROM_HERE, {BrowserThread::IO}, - base::BindOnce(&AppCacheNavigationHandleCore::Initialize, - base::Unretained(core_.get()))); - } + core_->Initialize(); } AppCacheNavigationHandle::~AppCacheNavigationHandle() { DCHECK_CURRENTLY_ON(BrowserThread::UI); - if (!NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - // Delete the AppCacheNavigationHandleCore on the IO thread. - BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, core_.release()); - } } void AppCacheNavigationHandle::SetProcessId(int process_id) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - core_->SetProcessId(process_id); - } else { - base::PostTask(FROM_HERE, {BrowserThread::IO}, - base::BindOnce(&AppCacheNavigationHandleCore::SetProcessId, - base::Unretained(core_.get()), process_id)); - } + core_->SetProcessId(process_id); } } // namespace content
diff --git a/content/browser/appcache/appcache_navigation_handle_core.cc b/content/browser/appcache/appcache_navigation_handle_core.cc index 8dbfa2de..2f6cfcf0 100644 --- a/content/browser/appcache/appcache_navigation_handle_core.cc +++ b/content/browser/appcache/appcache_navigation_handle_core.cc
@@ -49,15 +49,13 @@ } AppCacheNavigationHandleCore::~AppCacheNavigationHandleCore() { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); precreated_host_.reset(nullptr); g_appcache_handle_map.Get().erase(appcache_host_id_); } void AppCacheNavigationHandleCore::Initialize() { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(precreated_host_.get() == nullptr); precreated_host_ = std::make_unique<AppCacheHost>( appcache_host_id_, process_id_, MSG_ROUTING_NONE, mojo::NullRemote(), @@ -71,8 +69,7 @@ // static std::unique_ptr<AppCacheHost> AppCacheNavigationHandleCore::GetPrecreatedHost( const base::UnguessableToken& host_id) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); auto index = g_appcache_handle_map.Get().find(host_id); if (index != g_appcache_handle_map.Get().end()) { AppCacheNavigationHandleCore* instance = index->second;
diff --git a/content/browser/appcache/appcache_quota_client.cc b/content/browser/appcache/appcache_quota_client.cc index a6a50cb..4c14a1d 100644 --- a/content/browser/appcache/appcache_quota_client.cc +++ b/content/browser/appcache/appcache_quota_client.cc
@@ -13,7 +13,6 @@ #include "base/bind_helpers.h" #include "base/task/post_task.h" #include "content/browser/appcache/appcache_service_impl.h" -#include "content/browser/loader/navigation_url_loader_impl.h" #include "content/public/browser/browser_task_traits.h" #include "third_party/blink/public/mojom/quota/quota_types.mojom.h" @@ -40,11 +39,6 @@ void RunDeleteOnIO(const base::Location& from_here, net::CompletionRepeatingCallback callback, int result) { - if (BrowserThread::CurrentlyOn(BrowserThread::IO)) { - std::move(callback).Run(result); - return; - } - base::PostTask(from_here, {BrowserThread::IO}, base::BindOnce(std::move(callback), result)); } @@ -104,8 +98,7 @@ } base::PostTaskAndReplyWithResult( - FROM_HERE, - {NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()}, + FROM_HERE, {BrowserThread::UI}, base::BindOnce( [](base::WeakPtr<AppCacheServiceImpl> service, const url::Origin& origin) -> int64_t { @@ -166,8 +159,8 @@ return; } - NavigationURLLoaderImpl::RunOrPostTaskOnLoaderThread( - FROM_HERE, + base::PostTask( + FROM_HERE, {BrowserThread::UI}, base::BindOnce(&AppCacheServiceImpl::DeleteAppCachesForOrigin, service_, origin, base::BindOnce(&RunDeleteOnIO, FROM_HERE, @@ -217,8 +210,7 @@ } base::PostTaskAndReplyWithResult( - FROM_HERE, - {NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()}, + FROM_HERE, {BrowserThread::UI}, base::BindOnce( [](base::WeakPtr<AppCacheServiceImpl> service, const std::string& opt_host) {
diff --git a/content/browser/appcache/appcache_service_impl.cc b/content/browser/appcache/appcache_service_impl.cc index 66c260d..ad73c40 100644 --- a/content/browser/appcache/appcache_service_impl.cc +++ b/content/browser/appcache/appcache_service_impl.cc
@@ -402,14 +402,9 @@ helper.first->Cancel(); pending_helpers_.clear(); if (quota_client_) { - if (BrowserThread::CurrentlyOn(BrowserThread::IO)) { - quota_client_->NotifyAppCacheDestroyed(); - } else { - base::PostTask( - FROM_HERE, {BrowserThread::IO}, - base::BindOnce(&AppCacheQuotaClient::NotifyAppCacheDestroyed, - base::Unretained(quota_client_))); - } + base::PostTask(FROM_HERE, {BrowserThread::IO}, + base::BindOnce(&AppCacheQuotaClient::NotifyAppCacheDestroyed, + base::Unretained(quota_client_))); } // Destroy storage_ first; ~AppCacheStorageImpl accesses other data members @@ -418,8 +413,7 @@ } void AppCacheServiceImpl::Initialize(const base::FilePath& cache_directory) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(!storage_.get()); cache_directory_ = cache_directory; auto storage = std::make_unique<AppCacheStorageImpl>(this); @@ -428,8 +422,7 @@ } void AppCacheServiceImpl::ScheduleReinitialize() { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); if (reinit_timer_.IsRunning()) return; @@ -457,8 +450,7 @@ } void AppCacheServiceImpl::Reinitialize() { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); AppCacheHistograms::CountReinitAttempt(!last_reinit_time_.is_null()); last_reinit_time_ = base::Time::Now(); @@ -474,8 +466,7 @@ void AppCacheServiceImpl::GetAllAppCacheInfo(AppCacheInfoCollection* collection, OnceCompletionCallback callback) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(collection); GetInfoHelper* helper = new GetInfoHelper(this, collection, std::move(callback)); @@ -485,8 +476,7 @@ void AppCacheServiceImpl::DeleteAppCacheGroup( const GURL& manifest_url, net::CompletionOnceCallback callback) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); DeleteHelper* helper = new DeleteHelper(this, manifest_url, std::move(callback)); helper->Start(); @@ -495,8 +485,7 @@ void AppCacheServiceImpl::DeleteAppCachesForOrigin( const url::Origin& origin, net::CompletionOnceCallback callback) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); DeleteOriginHelper* helper = new DeleteOriginHelper(this, origin, std::move(callback)); helper->Start(); @@ -505,8 +494,7 @@ void AppCacheServiceImpl::CheckAppCacheResponse(const GURL& manifest_url, int64_t cache_id, int64_t response_id) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); CheckResponseHelper* helper = new CheckResponseHelper( this, manifest_url, cache_id, response_id); helper->Start(); @@ -514,37 +502,32 @@ void AppCacheServiceImpl::set_special_storage_policy( storage::SpecialStoragePolicy* policy) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); special_storage_policy_ = policy; } void AppCacheServiceImpl::RegisterBackend( AppCacheBackendImpl* backend_impl) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(backends_.find(backend_impl->process_id()) == backends_.end()); backends_.insert({backend_impl->process_id(), backend_impl}); } void AppCacheServiceImpl::UnregisterBackend( AppCacheBackendImpl* backend_impl) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); backends_.erase(backend_impl->process_id()); } AppCacheHost* AppCacheServiceImpl::GetHost( const base::UnguessableToken& host_id) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); auto it = hosts_.find(host_id); return (it != hosts_.end()) ? (it->second.get()) : nullptr; } bool AppCacheServiceImpl::EraseHost(const base::UnguessableToken& host_id) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); return (hosts_.erase(host_id) != 0); } @@ -567,8 +550,7 @@ int32_t render_frame_id, int process_id, mojo::ReportBadMessageCallback bad_message_callback) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); if (GetHost(host_id)) { std::move(bad_message_callback).Run("ACSI_REGISTER"); return;
diff --git a/content/browser/appcache/appcache_service_impl.h b/content/browser/appcache/appcache_service_impl.h index fe35330..23771200 100644 --- a/content/browser/appcache/appcache_service_impl.h +++ b/content/browser/appcache/appcache_service_impl.h
@@ -171,18 +171,6 @@ void set_force_keep_session_state() { force_keep_session_state_ = true; } bool force_keep_session_state() const { return force_keep_session_state_; } - // The following two functions are invoked in the network service world to - // set/get a pointer to the URLLoaderFactoryGetter instance which is used to - // get to the network URL loader factory. - void set_url_loader_factory_getter( - URLLoaderFactoryGetter* loader_factory_getter) { - url_loader_factory_getter_ = loader_factory_getter; - } - - URLLoaderFactoryGetter* url_loader_factory_getter() const { - return url_loader_factory_getter_.get(); - } - base::WeakPtr<StoragePartitionImpl> partition() { return partition_; } // Returns a pointer to a registered host. It retains ownership. @@ -226,13 +214,7 @@ base::TimeDelta next_reinit_delay_; base::OneShotTimer reinit_timer_; base::ObserverList<Observer>::Unchecked observers_; - - // In the network service world contains the pointer to the - // URLLoaderFactoryGetter instance which is used to get to the network - // URL loader factory. - scoped_refptr<URLLoaderFactoryGetter> url_loader_factory_getter_; - // If NavigationLoaderOnUI is enabled, |partition_| will be used to get the - // network URL loader factory. + // |partition_| is used to get the network URL loader factory. base::WeakPtr<StoragePartitionImpl> partition_; private:
diff --git a/content/browser/appcache/appcache_storage_impl.cc b/content/browser/appcache/appcache_storage_impl.cc index 052fa37..85aaa36 100644 --- a/content/browser/appcache/appcache_storage_impl.cc +++ b/content/browser/appcache/appcache_storage_impl.cc
@@ -308,14 +308,10 @@ } if (storage_->service()->quota_client()) { - if (BrowserThread::CurrentlyOn(BrowserThread::IO)) { - storage_->service()->quota_client()->NotifyAppCacheReady(); - } else { - base::PostTask(FROM_HERE, {BrowserThread::IO}, - base::BindOnce(&AppCacheQuotaClient::NotifyAppCacheReady, - base::Unretained( - storage_->service()->quota_client()))); - } + base::PostTask( + FROM_HERE, {BrowserThread::IO}, + base::BindOnce(&AppCacheQuotaClient::NotifyAppCacheReady, + base::Unretained(storage_->service()->quota_client()))); } }
diff --git a/content/browser/appcache/appcache_subresource_url_factory.cc b/content/browser/appcache/appcache_subresource_url_factory.cc index ad1eaa1..c9eb0983 100644 --- a/content/browser/appcache/appcache_subresource_url_factory.cc +++ b/content/browser/appcache/appcache_subresource_url_factory.cc
@@ -67,8 +67,7 @@ network_loader_factory_(std::move(network_loader_factory)), local_client_binding_(this), host_(appcache_host) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); remote_binding_.set_connection_error_handler(base::BindOnce( &SubresourceLoader::OnConnectionError, base::Unretained(this))); base::SequencedTaskRunnerHandle::Get()->PostTask( @@ -341,19 +340,13 @@ network::mojom::URLLoaderFactoryPtr* loader_factory) { DCHECK(host.get()); scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory; - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - // The partition has shutdown, return without binding |loader_factory|. - if (!host->service()->partition()) - return; - network_loader_factory = - host->service() - ->partition() - ->GetURLLoaderFactoryForBrowserProcessWithCORBEnabled(); - } else { - network_loader_factory = host->service() - ->url_loader_factory_getter() - ->GetNetworkFactoryWithCORBEnabled(); - } + // The partition has shutdown, return without binding |loader_factory|. + if (!host->service()->partition()) + return; + network_loader_factory = + host->service() + ->partition() + ->GetURLLoaderFactoryForBrowserProcessWithCORBEnabled(); // This instance is effectively reference counted by the number of pipes open // to it and will get deleted when all clients drop their connections. // Please see OnConnectionError() for details. @@ -374,8 +367,7 @@ const network::ResourceRequest& request, network::mojom::URLLoaderClientPtr client, const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); // TODO(943887): Replace HasSecurityState() call with something that can // preserve security state after process shutdown. The security state check
diff --git a/content/browser/appcache/appcache_update_url_fetcher.cc b/content/browser/appcache/appcache_update_url_fetcher.cc index 23ea9767..5fb9a33 100644 --- a/content/browser/appcache/appcache_update_url_fetcher.cc +++ b/content/browser/appcache/appcache_update_url_fetcher.cc
@@ -32,7 +32,6 @@ fetch_type_(fetch_type), buffer_size_(buffer_size), request_(std::make_unique<UpdateURLLoaderRequest>( - job->service_->url_loader_factory_getter(), job->service_->partition(), url, buffer_size, @@ -250,8 +249,7 @@ result_ = AppCacheUpdateJob::UPDATE_OK; request_ = std::make_unique<UpdateURLLoaderRequest>( - job_->service_->url_loader_factory_getter(), job_->service_->partition(), - url_, buffer_size_, this); + job_->service_->partition(), url_, buffer_size_, this); Start(); return true; }
diff --git a/content/browser/appcache/appcache_update_url_loader_request.cc b/content/browser/appcache/appcache_update_url_loader_request.cc index 71eb340..422d3201 100644 --- a/content/browser/appcache/appcache_update_url_loader_request.cc +++ b/content/browser/appcache/appcache_update_url_loader_request.cc
@@ -7,7 +7,6 @@ #include "base/bind.h" #include "content/browser/appcache/appcache_request_handler.h" #include "content/browser/appcache/appcache_update_url_fetcher.h" -#include "content/browser/loader/navigation_url_loader_impl.h" #include "content/browser/storage_partition_impl.h" #include "net/base/ip_endpoint.h" #include "net/http/http_response_info.h" @@ -57,21 +56,15 @@ network::mojom::URLLoaderClientPtr client; client_binding_.Bind(mojo::MakeRequest(&client)); - scoped_refptr<network::SharedURLLoaderFactory> loader; - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - // The partition has shutdown, return without making the request. - if (!partition_) - return; - loader = partition_->GetURLLoaderFactoryForBrowserProcessWithCORBEnabled(); - } else { - loader = loader_factory_getter_->GetNetworkFactoryWithCORBEnabled(); - } - - loader->CreateLoaderAndStart( - mojo::MakeRequest(&url_loader_), -1, -1, - network::mojom::kURLLoadOptionSendSSLInfoWithResponse, request_, - std::move(client), - net::MutableNetworkTrafficAnnotationTag(kAppCacheTrafficAnnotation)); + // The partition has shutdown, return without making the request. + if (!partition_) + return; + partition_->GetURLLoaderFactoryForBrowserProcessWithCORBEnabled() + ->CreateLoaderAndStart( + mojo::MakeRequest(&url_loader_), -1, -1, + network::mojom::kURLLoadOptionSendSSLInfoWithResponse, request_, + std::move(client), + net::MutableNetworkTrafficAnnotationTag(kAppCacheTrafficAnnotation)); } void AppCacheUpdateJob::UpdateURLLoaderRequest::SetExtraRequestHeaders( @@ -209,13 +202,11 @@ } AppCacheUpdateJob::UpdateURLLoaderRequest::UpdateURLLoaderRequest( - URLLoaderFactoryGetter* loader_factory_getter, base::WeakPtr<StoragePartitionImpl> partition, const GURL& url, int buffer_size, URLFetcher* fetcher) : fetcher_(fetcher), - loader_factory_getter_(loader_factory_getter), partition_(std::move(partition)), client_binding_(this), buffer_size_(buffer_size),
diff --git a/content/browser/appcache/appcache_update_url_loader_request.h b/content/browser/appcache/appcache_update_url_loader_request.h index 1d7cf543..5c822f51 100644 --- a/content/browser/appcache/appcache_update_url_loader_request.h +++ b/content/browser/appcache/appcache_update_url_loader_request.h
@@ -26,16 +26,13 @@ namespace content { -class URLLoaderFactoryGetter; - // URLLoaderClient subclass for the UpdateRequestBase class. Provides // functionality to update the AppCache using functionality provided by the // network URL loader. class AppCacheUpdateJob::UpdateURLLoaderRequest : public network::mojom::URLLoaderClient { public: - UpdateURLLoaderRequest(URLLoaderFactoryGetter* loader_factory_getter, - base::WeakPtr<StoragePartitionImpl> partition, + UpdateURLLoaderRequest(base::WeakPtr<StoragePartitionImpl> partition, const GURL& url, int buffer_size, URLFetcher* fetcher); @@ -116,11 +113,7 @@ void MaybeStartReading(); URLFetcher* fetcher_; - // Used to retrieve the network URLLoader interface to issue network - // requests - scoped_refptr<URLLoaderFactoryGetter> loader_factory_getter_; - // If NavigationLoaderOnUI is enabled, |partition_| is used to get the network - // URLLoader. + // |partition_| is used to get the network URLLoader. base::WeakPtr<StoragePartitionImpl> partition_; network::ResourceRequest request_;
diff --git a/content/browser/appcache/chrome_appcache_service.cc b/content/browser/appcache/chrome_appcache_service.cc index 6fcb628..677890b 100644 --- a/content/browser/appcache/chrome_appcache_service.cc +++ b/content/browser/appcache/chrome_appcache_service.cc
@@ -23,21 +23,18 @@ base::WeakPtr<StoragePartitionImpl> partition) : AppCacheServiceImpl(quota_manager_proxy, std::move(partition)) {} -void ChromeAppCacheService::InitializeOnLoaderThread( +void ChromeAppCacheService::Initialize( const base::FilePath& cache_path, BrowserContext* browser_context, - ResourceContext* resource_context, scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); cache_path_ = cache_path; - DCHECK(!(browser_context && resource_context)); + DCHECK(browser_context); browser_context_ = browser_context; - resource_context_ = resource_context; // Init our base class. - Initialize(cache_path_); + AppCacheServiceImpl::Initialize(cache_path_); set_appcache_policy(this); set_special_storage_policy(special_storage_policy.get()); } @@ -95,42 +92,27 @@ bool ChromeAppCacheService::CanLoadAppCache(const GURL& manifest_url, const GURL& first_party) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); - // We don't prompt for read access. - if (browser_context_) { - return GetContentClient()->browser()->AllowAppCache( - manifest_url, first_party, browser_context_); - } - return GetContentClient()->browser()->AllowAppCacheOnIO( - manifest_url, first_party, resource_context_); + DCHECK_CURRENTLY_ON(BrowserThread::UI); + return GetContentClient()->browser()->AllowAppCache(manifest_url, first_party, + browser_context_); } bool ChromeAppCacheService::CanCreateAppCache( const GURL& manifest_url, const GURL& first_party) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); - if (browser_context_) { - return GetContentClient()->browser()->AllowAppCache( - manifest_url, first_party, browser_context_); - } - return GetContentClient()->browser()->AllowAppCacheOnIO( - manifest_url, first_party, resource_context_); + DCHECK_CURRENTLY_ON(BrowserThread::UI); + return GetContentClient()->browser()->AllowAppCache(manifest_url, first_party, + browser_context_); } ChromeAppCacheService::~ChromeAppCacheService() {} void ChromeAppCacheService::DeleteOnCorrectThread() const { - if (BrowserThread::CurrentlyOn( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID())) { + if (BrowserThread::CurrentlyOn(BrowserThread::UI)) { delete this; return; } - if (BrowserThread::IsThreadInitialized( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID())) { - BrowserThread::DeleteSoon( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID(), - FROM_HERE, this); + if (BrowserThread::IsThreadInitialized(BrowserThread::UI)) { + BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, this); return; } // Better to leak than crash on shutdown.
diff --git a/content/browser/appcache/chrome_appcache_service.h b/content/browser/appcache/chrome_appcache_service.h index 79e9e19..3ad1556b 100644 --- a/content/browser/appcache/chrome_appcache_service.h +++ b/content/browser/appcache/chrome_appcache_service.h
@@ -27,7 +27,6 @@ namespace content { class BrowserContext; -class ResourceContext; struct ChromeAppCacheServiceDeleter; @@ -51,15 +50,10 @@ ChromeAppCacheService(storage::QuotaManagerProxy* proxy, base::WeakPtr<StoragePartitionImpl> partition); - // If |cache_path| is empty we will use in-memory structs. If the - // NavigationLoaderOnUI feature is enabled, this is run on the UI thread with - // |browser_context| set and |resource_context| null. If it is disabled, this - // is run on the IO thread with |resource_context| set and |browser_context| - // null. - void InitializeOnLoaderThread( + // If |cache_path| is empty we will use in-memory structs. + void Initialize( const base::FilePath& cache_path, BrowserContext* browser_context, - ResourceContext* resource_context, scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy); void CreateBackend( @@ -106,7 +100,6 @@ void DeleteOnCorrectThread() const; BrowserContext* browser_context_ = nullptr; - ResourceContext* resource_context_ = nullptr; base::FilePath cache_path_; mojo::UniqueReceiverSet<blink::mojom::AppCacheBackend> receivers_;
diff --git a/content/browser/appcache/chrome_appcache_service_unittest.cc b/content/browser/appcache/chrome_appcache_service_unittest.cc index 44b0cc0..072f6d6a 100644 --- a/content/browser/appcache/chrome_appcache_service_unittest.cc +++ b/content/browser/appcache/chrome_appcache_service_unittest.cc
@@ -73,12 +73,8 @@ auto mock_policy = base::MakeRefCounted<MockSpecialStoragePolicy>(); mock_policy->AddProtected(kProtectedManifestURL.GetOrigin()); mock_policy->AddSessionOnly(kSessionOnlyManifestURL.GetOrigin()); - base::PostTask( - FROM_HERE, {BrowserThread::IO}, - base::BindOnce( - &ChromeAppCacheService::InitializeOnLoaderThread, appcache_service, - appcache_path, nullptr /* browser_context */, - browser_context_.GetResourceContext(), std::move(mock_policy))); + appcache_service->Initialize(appcache_path, &browser_context_, + std::move(mock_policy)); // Steps needed to initialize the storage of AppCache data. thread_bundle_.RunUntilIdle(); if (init_storage) {
diff --git a/content/browser/background_sync/background_sync_manager.cc b/content/browser/background_sync/background_sync_manager.cc index f2dde2b..c0099de 100644 --- a/content/browser/background_sync/background_sync_manager.cc +++ b/content/browser/background_sync/background_sync_manager.cc
@@ -682,6 +682,7 @@ registration->set_num_attempts(registration_proto.num_attempts()); registration->set_delay_until( base::Time::FromInternalValue(registration_proto.delay_until())); + registration->set_origin(registrations->origin); if (registration->is_suspended()) { suspended_periodic_sync_origins.insert(registration->origin()); } @@ -918,7 +919,8 @@ DevToolsBackgroundService::kPeriodicBackgroundSync, /* event_name= */ "Got next event delay", /* instance_id= */ registration.options()->tag, - {{"Next Attempt Delay (ms)", GetDelayAsString(delay)}}); + {{"Next Attempt Delay (ms)", + GetDelayAsString(registration.delay_until() - clock_->Now())}}); } AddOrUpdateActiveRegistration( @@ -1979,8 +1981,12 @@ std::string event_name = GetSyncEventName(registration->sync_type()) + (succeeded ? " event completed" : " event failed"); + base::TimeDelta display_delay = + registration->sync_type() == BackgroundSyncType::ONE_SHOT + ? delay + : registration->delay_until() - clock_->Now(); std::map<std::string, std::string> event_metadata = { - {"Next Attempt Delay (ms)", GetDelayAsString(delay)}}; + {"Next Attempt Delay (ms)", GetDelayAsString(display_delay)}}; if (!succeeded) { event_metadata.emplace("Failure Reason", GetEventStatusString(status_code));
diff --git a/content/browser/background_sync/background_sync_manager_unittest.cc b/content/browser/background_sync/background_sync_manager_unittest.cc index acec7a2..1ea99f3 100644 --- a/content/browser/background_sync/background_sync_manager_unittest.cc +++ b/content/browser/background_sync/background_sync_manager_unittest.cc
@@ -474,6 +474,11 @@ return false; } + url::Origin GetOriginForPeriodicSyncRegistration() { + DCHECK(callback_periodic_sync_registration_); + return callback_periodic_sync_registration_->origin(); + } + bool GetOneShotSyncRegistrations() { bool was_called = false; test_background_sync_manager()->GetOneShotSyncRegistrations( @@ -1005,6 +1010,19 @@ EXPECT_FALSE(GetRegistration(sync_options_2_)); } +TEST_F(BackgroundSyncManagerTest, RebootRecoveryPeriodicSync) { + sync_options_1_.min_interval = 1000; + EXPECT_TRUE(Register(sync_options_1_)); + EXPECT_TRUE(GetRegistration(sync_options_1_)); + + // Restart the manager. + SetupBackgroundSyncManager(); + + EXPECT_TRUE(GetRegistration(sync_options_1_)); + EXPECT_EQ(GetOriginForPeriodicSyncRegistration(), + url::Origin::Create(GURL(kScope1).GetOrigin())); +} + TEST_F(BackgroundSyncManagerTest, RebootRecoveryTwoServiceWorkers) { EXPECT_TRUE( RegisterWithServiceWorkerId(sw_registration_id_1_, sync_options_1_));
diff --git a/content/browser/browser_thread_unittest.cc b/content/browser/browser_thread_unittest.cc index 60a6dc10..76e6cb22 100644 --- a/content/browser/browser_thread_unittest.cc +++ b/content/browser/browser_thread_unittest.cc
@@ -11,6 +11,7 @@ #include "base/callback.h" #include "base/location.h" #include "base/message_loop/message_pump.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/sequenced_task_runner_helpers.h" #include "base/single_thread_task_runner.h" @@ -71,7 +72,7 @@ void BindToCurrentThread(base::TimerSlack timer_slack) override { sequence_manager_->BindToMessagePump( - base::MessagePump::Create(base::MessagePump::Type::DEFAULT)); + base::MessagePump::Create(base::MessagePumpType::DEFAULT)); sequence_manager_->SetTimerSlack(timer_slack); }
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index 376a4fb..53d6c37 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -5096,23 +5096,11 @@ auto* storage_partition = static_cast<StoragePartitionImpl*>( BrowserContext::GetStoragePartition( GetSiteInstance()->GetBrowserContext(), GetSiteInstance())); - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - storage_partition->GetPrefetchURLLoaderService()->GetFactory( - prefetch_loader_factory.InitWithNewPipeAndPassReceiver(), - frame_tree_node_->frame_tree_node_id(), - std::move(factory_bundle_for_prefetch), - EnsurePrefetchedSignedExchangeCache()); - } else { - base::PostTask( - FROM_HERE, {BrowserThread::IO}, - base::BindOnce( - &PrefetchURLLoaderService::GetFactory, - storage_partition->GetPrefetchURLLoaderService(), - prefetch_loader_factory.InitWithNewPipeAndPassReceiver(), - frame_tree_node_->frame_tree_node_id(), - std::move(factory_bundle_for_prefetch), - EnsurePrefetchedSignedExchangeCache())); - } + storage_partition->GetPrefetchURLLoaderService()->GetFactory( + prefetch_loader_factory.InitWithNewPipeAndPassReceiver(), + frame_tree_node_->frame_tree_node_id(), + std::move(factory_bundle_for_prefetch), + EnsurePrefetchedSignedExchangeCache()); } mojom::NavigationClient* navigation_client = nullptr; @@ -6229,19 +6217,9 @@ auto* appcache_service_impl = static_cast<AppCacheServiceImpl*>( GetProcess()->GetStoragePartition()->GetAppCacheService()); - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - appcache_service_impl->RegisterHostForFrame( - std::move(host_receiver), std::move(frontend_remote), host_id, - routing_id_, GetProcess()->GetID(), mojo::GetBadMessageCallback()); - } else { - base::PostTask( - FROM_HERE, {BrowserThread::IO}, - base::BindOnce(&AppCacheServiceImpl::RegisterHostForFrame, - appcache_service_impl->AsWeakPtr(), - std::move(host_receiver), std::move(frontend_remote), - host_id, routing_id_, GetProcess()->GetID(), - mojo::GetBadMessageCallback())); - } + appcache_service_impl->RegisterHostForFrame( + std::move(host_receiver), std::move(frontend_remote), host_id, + routing_id_, GetProcess()->GetID(), mojo::GetBadMessageCallback()); } std::unique_ptr<NavigationRequest>
diff --git a/content/browser/loader/cross_origin_read_blocking_checker.cc b/content/browser/loader/cross_origin_read_blocking_checker.cc index 7bbf739cf..f9756972 100644 --- a/content/browser/loader/cross_origin_read_blocking_checker.cc +++ b/content/browser/loader/cross_origin_read_blocking_checker.cc
@@ -6,7 +6,6 @@ #include "base/callback.h" #include "base/task/post_task.h" -#include "content/browser/loader/navigation_url_loader_impl.h" #include "content/public/browser/browser_task_traits.h" #include "net/base/io_buffer.h" #include "net/base/mime_sniffer.h" @@ -72,14 +71,14 @@ } void OnNetError() { - NavigationURLLoaderImpl::RunOrPostTaskOnLoaderThread( - FROM_HERE, base::BindOnce(&CrossOriginReadBlockingChecker::OnNetError, + base::PostTask(FROM_HERE, {BrowserThread::UI}, + base::BindOnce(&CrossOriginReadBlockingChecker::OnNetError, checker_, blob_reader_->net_error())); } void OnReadComplete(int bytes_read) { - NavigationURLLoaderImpl::RunOrPostTaskOnLoaderThread( - FROM_HERE, + base::PostTask( + FROM_HERE, {BrowserThread::UI}, base::BindOnce(&CrossOriginReadBlockingChecker::OnReadComplete, checker_, bytes_read, buffer_, blob_reader_->net_error())); @@ -116,15 +115,11 @@ blob_io_state_ = std::make_unique<BlobIOState>( weak_factory_.GetWeakPtr(), std::make_unique<storage::BlobDataHandle>(blob_data_handle)); - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - // base::Unretained is safe because |blob_io_state_| will be deleted on - // the IO thread. - base::PostTask(FROM_HERE, {BrowserThread::IO}, - base::BindOnce(&BlobIOState::StartSniffing, - base::Unretained(blob_io_state_.get()))); - } else { - blob_io_state_->StartSniffing(); - } + // base::Unretained is safe because |blob_io_state_| will be deleted on + // the IO thread. + base::PostTask(FROM_HERE, {BrowserThread::IO}, + base::BindOnce(&BlobIOState::StartSniffing, + base::Unretained(blob_io_state_.get()))); return; } DCHECK(corb_analyzer_->ShouldAllow()); @@ -132,10 +127,8 @@ } CrossOriginReadBlockingChecker::~CrossOriginReadBlockingChecker() { - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, - std::move(blob_io_state_)); - } + BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, + std::move(blob_io_state_)); } int CrossOriginReadBlockingChecker::GetNetError() {
diff --git a/content/browser/loader/navigation_url_loader_impl.cc b/content/browser/loader/navigation_url_loader_impl.cc index 1c8a8c7..50ef644e 100644 --- a/content/browser/loader/navigation_url_loader_impl.cc +++ b/content/browser/loader/navigation_url_loader_impl.cc
@@ -257,29 +257,10 @@ // Determines whether it is safe to redirect from |from_url| to |to_url|. bool IsRedirectSafe(const GURL& from_url, const GURL& to_url, - BrowserContext* browser_context, - ResourceContext* resource_context) { - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - return IsSafeRedirectTarget(from_url, to_url) && - GetContentClient()->browser()->IsSafeRedirectTarget(to_url, - browser_context); - } + BrowserContext* browser_context) { return IsSafeRedirectTarget(from_url, to_url) && - GetContentClient()->browser()->IsSafeRedirectTargetOnIO( - to_url, resource_context); -} - -// Runs |task| on the thread specified by |thread_id| if already on that thread, -// otherwise posts a task to that thread. -void RunOrPostTaskIfNecessary(const base::Location& from_here, - BrowserThread::ID thread_id, - base::OnceClosure task) { - if (BrowserThread::CurrentlyOn(thread_id)) { - std::move(task).Run(); - return; - } - - base::PostTask(from_here, {thread_id}, std::move(task)); + GetContentClient()->browser()->IsSafeRedirectTarget(to_url, + browser_context); } } // namespace @@ -309,7 +290,9 @@ const base::WeakPtr<NavigationURLLoaderImpl>& owner) : interceptors_(std::move(initial_interceptors)), resource_request_(std::move(resource_request)), +#if BUILDFLAG(ENABLE_PLUGINS) resource_context_(resource_context), +#endif url_(url), owner_(owner), response_loader_binding_(this), @@ -317,10 +300,11 @@ proxied_factory_info_(std::move(proxied_factory_info)), known_schemes_(std::move(known_schemes)), bypass_redirect_checks_(bypass_redirect_checks), - browser_context_(browser_context) {} + browser_context_(browser_context) { + } ~URLLoaderRequestController() override { - DCHECK_CURRENTLY_ON(GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); // If neither OnCompleted nor OnReceivedResponse has been invoked, the // request was canceled before receiving a response, so log a cancellation. @@ -370,7 +354,7 @@ bool needs_loader_factory_interceptor, base::Time ui_post_time, std::string accept_langs) { - DCHECK_CURRENTLY_ON(GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(!started_); ui_to_io_time_ += (base::Time::Now() - ui_post_time); global_request_id_ = MakeGlobalRequestID(); @@ -399,28 +383,10 @@ std::move(factory)); } - // TODO(http://crbug.com/824840): Find out if this is necessary with network - // service, and make it work on UI thread if so. - if (resource_request_->request_body && !IsNavigationLoaderOnUIEnabled()) { - bool result = - GetBodyBlobDataHandles(resource_request_->request_body.get(), - resource_context_, &blob_handles_); - // When network service is enabled, we are not supposed to get blobs - // here. See if this causes a crash to verify. - CHECK(result && blob_handles_.empty()); - } - std::string accept_value = network::kFrameAcceptHeader; - if (IsNavigationLoaderOnUIEnabled()) { - if (signed_exchange_utils::IsSignedExchangeHandlingEnabled( - browser_context_)) { - accept_value.append(kAcceptHeaderSignedExchangeSuffix); - } - } else { - if (signed_exchange_utils::IsSignedExchangeHandlingEnabledOnIO( - resource_context_)) { - accept_value.append(kAcceptHeaderSignedExchangeSuffix); - } + if (signed_exchange_utils::IsSignedExchangeHandlingEnabled( + browser_context_)) { + accept_value.append(kAcceptHeaderSignedExchangeSuffix); } resource_request_->headers.SetHeader(network::kAcceptHeader, accept_value); @@ -452,29 +418,19 @@ return; } - if (IsNavigationLoaderOnUIEnabled()) { - CreateInterceptorsForUI(request_info.get(), appcache_handle_core, - prefetched_signed_exchange_cache, - signed_exchange_prefetch_metric_recorder, - accept_langs); - } else { - CreateInterceptorsForIO( - request_info.get(), service_worker_navigation_handle_core, - appcache_handle_core, prefetched_signed_exchange_cache, - signed_exchange_prefetch_metric_recorder, accept_langs); - } - + CreateInterceptors(request_info.get(), appcache_handle_core, + prefetched_signed_exchange_cache, + signed_exchange_prefetch_metric_recorder, accept_langs); Restart(); } - void CreateInterceptorsForUI( - NavigationRequestInfo* request_info, - AppCacheNavigationHandleCore* appcache_handle_core, - scoped_refptr<PrefetchedSignedExchangeCache> - prefetched_signed_exchange_cache, - scoped_refptr<SignedExchangePrefetchMetricRecorder> - signed_exchange_prefetch_metric_recorder, - const std::string& accept_langs) { + void CreateInterceptors(NavigationRequestInfo* request_info, + AppCacheNavigationHandleCore* appcache_handle_core, + scoped_refptr<PrefetchedSignedExchangeCache> + prefetched_signed_exchange_cache, + scoped_refptr<SignedExchangePrefetchMetricRecorder> + signed_exchange_prefetch_metric_recorder, + const std::string& accept_langs) { if (prefetched_signed_exchange_cache) { std::unique_ptr<NavigationLoaderInterceptor> prefetched_signed_exchange_interceptor = @@ -535,77 +491,6 @@ } } - void CreateInterceptorsForIO( - NavigationRequestInfo* request_info, - ServiceWorkerNavigationHandleCore* service_worker_navigation_handle_core, - AppCacheNavigationHandleCore* appcache_handle_core, - scoped_refptr<PrefetchedSignedExchangeCache> - prefetched_signed_exchange_cache, - scoped_refptr<SignedExchangePrefetchMetricRecorder> - signed_exchange_prefetch_metric_recorder, - const std::string& accept_langs) { - DCHECK(!IsNavigationLoaderOnUIEnabled()); - if (prefetched_signed_exchange_cache) { - std::unique_ptr<NavigationLoaderInterceptor> - prefetched_signed_exchange_interceptor = - prefetched_signed_exchange_cache->MaybeCreateInterceptor( - request_info->common_params->url); - if (prefetched_signed_exchange_interceptor) { - interceptors_.push_back( - std::move(prefetched_signed_exchange_interceptor)); - } - } - - // Set-up an interceptor for service workers. - if (service_worker_navigation_handle_core) { - std::unique_ptr<NavigationLoaderInterceptor> service_worker_interceptor = - ServiceWorkerRequestHandler::CreateForNavigationIO( - resource_request_->url, service_worker_navigation_handle_core, - *request_info, &service_worker_provider_host_); - // The interceptor for service worker may not be created for some - // reasons (e.g. the origin is not secure). - if (service_worker_interceptor) - interceptors_.push_back(std::move(service_worker_interceptor)); - } - - // NetworkService cases only. - // Set-up an interceptor for AppCache if non-null |appcache_handle_core| - // is given. - if (appcache_handle_core) { - std::unique_ptr<NavigationLoaderInterceptor> appcache_interceptor = - AppCacheRequestHandler::InitializeForMainResourceNetworkService( - *resource_request_, appcache_handle_core->host()->GetWeakPtr()); - if (appcache_interceptor) - interceptors_.push_back(std::move(appcache_interceptor)); - } - - // Set-up an interceptor for SignedExchange handling if it is enabled. - if (signed_exchange_utils::IsSignedExchangeHandlingEnabledOnIO( - resource_context_)) { - auto network_loader_factory = network_loader_factory_; - interceptors_.push_back(CreateSignedExchangeRequestHandler( - *request_info, std::move(network_loader_factory), - std::move(signed_exchange_prefetch_metric_recorder), - std::move(accept_langs))); - } - - // See if embedders want to add interceptors. - std::vector<std::unique_ptr<URLLoaderRequestInterceptor>> - browser_interceptors = - GetContentClient() - ->browser() - ->WillCreateURLLoaderRequestInterceptors( - navigation_ui_data_.get(), request_info->frame_tree_node_id, - network_loader_factory_); - if (!browser_interceptors.empty()) { - for (auto& browser_interceptor : browser_interceptors) { - interceptors_.push_back( - std::make_unique<NavigationLoaderInterceptorBrowserContainer>( - std::move(browser_interceptor))); - } - } - } - // This could be called multiple times to follow a chain of redirects. void Restart() { // Clear |url_loader_| if it's not the default one (network). This allows @@ -635,7 +520,7 @@ void MaybeStartLoader( NavigationLoaderInterceptor* interceptor, SingleRequestURLLoaderFactory::RequestHandler single_request_handler) { - DCHECK_CURRENTLY_ON(GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(started_); if (single_request_handler) { @@ -687,16 +572,8 @@ // See if the next interceptor wants to handle the request. if (interceptor_index_ < interceptors_.size()) { auto* next_interceptor = interceptors_[interceptor_index_++].get(); - // Set either BrowserContext or ResourceContext depending on what thread - // the interceptors are running on. - BrowserContext* browser_context_to_use = nullptr; - ResourceContext* resource_context_to_use = nullptr; - if (IsNavigationLoaderOnUIEnabled()) - browser_context_to_use = browser_context_; - else - resource_context_to_use = resource_context_; next_interceptor->MaybeCreateLoader( - *resource_request_, browser_context_to_use, resource_context_to_use, + *resource_request_, browser_context_, nullptr /* resource_context */, base::BindOnce(&URLLoaderRequestController::MaybeStartLoader, base::Unretained(this), next_interceptor), base::BindOnce( @@ -787,13 +664,9 @@ network::mojom::URLLoaderFactoryPtr& non_network_factory = non_network_url_loader_factories_[resource_request_->url.scheme()]; if (!non_network_factory.is_bound()) { - RunOrPostTaskIfNecessary( - FROM_HERE, BrowserThread::UI, - base::BindOnce(&NavigationURLLoaderImpl :: - BindNonNetworkURLLoaderFactoryRequest, - owner_, frame_tree_node_id_, - resource_request_->url, - mojo::MakeRequest(&non_network_factory))); + owner_->BindNonNetworkURLLoaderFactoryRequest( + frame_tree_node_id_, resource_request_->url, + mojo::MakeRequest(&non_network_factory)); } factory = base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( @@ -837,7 +710,7 @@ const net::HttpRequestHeaders& modified_headers, PreviewsState new_previews_state, base::Time ui_post_time) { - DCHECK_CURRENTLY_ON(GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(!redirect_info_.new_url.is_empty()); ui_to_io_time_ += (base::Time::Now() - ui_post_time); @@ -1020,26 +893,15 @@ new network::ResourceResponse()); response->head = head; - // Make a copy of the ResourceResponse before it is passed to another - // thread. - // - // TODO(davidben): This copy could be avoided if ResourceResponse weren't - // reference counted and the loader stack passed unique ownership of the - // response. https://crbug.com/416050 - RunOrPostTaskIfNecessary( - FROM_HERE, BrowserThread::UI, - base::BindOnce(&NavigationURLLoaderImpl::OnReceiveResponse, owner_, - response->DeepCopy(), - std::move(url_loader_client_endpoints), - std::move(response_body_), global_request_id_, - is_download, ui_to_io_time_, base::Time::Now())); + owner_->OnReceiveResponse(response, std::move(url_loader_client_endpoints), + std::move(response_body_), global_request_id_, + is_download, ui_to_io_time_, base::Time::Now()); } void OnReceiveRedirect(const net::RedirectInfo& redirect_info, const network::ResourceResponseHead& head) override { if (!bypass_redirect_checks_ && - !IsRedirectSafe(url_, redirect_info.new_url, browser_context_, - resource_context_)) { + !IsRedirectSafe(url_, redirect_info.new_url, browser_context_)) { // Call CancelWithError instead of OnComplete so that if there is an // intercepting URLLoaderFactory (created through the embedder's // ContentBrowserClient::WillCreateURLLoaderFactory) it gets notified. @@ -1067,16 +929,10 @@ response->head = head; url_ = redirect_info.new_url; - // Make a copy of the ResourceResponse before it is passed to another - // thread. - // - // TODO(davidben): This copy could be avoided if ResourceResponse weren't - // reference counted and the loader stack passed unique ownership of the - // response. https://crbug.com/416050 base::PostTask( FROM_HERE, {BrowserThread::UI}, base::BindOnce(&NavigationURLLoaderImpl::OnReceiveRedirect, owner_, - redirect_info, response->DeepCopy(), base::Time::Now())); + redirect_info, response, base::Time::Now())); } void OnUploadProgress(int64_t current_position, @@ -1177,13 +1033,7 @@ // Service Worker related APIs will fail with NoDocumentURL error. // TODO(crbug/898733): Support SignedExchange loading and Service // Worker integration. - if (service_worker_provider_host_) { - DCHECK(!NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()); - service_worker_provider_host_->SetControllerRegistration( - nullptr, false /* notify_controllerchange */); - service_worker_provider_host_->UpdateUrls(GURL(), GURL()); - } else if (service_worker_navigation_handle_) { - DCHECK(NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()); + if (service_worker_navigation_handle_) { base::PostTask( FROM_HERE, {BrowserThread::IO}, base::BindOnce( @@ -1206,13 +1056,8 @@ std::vector<std::unique_ptr<blink::URLLoaderThrottle>> CreateURLLoaderThrottles() { - if (IsNavigationLoaderOnUIEnabled()) { - return GetContentClient()->browser()->CreateURLLoaderThrottles( - *resource_request_, browser_context_, web_contents_getter_, - navigation_ui_data_.get(), frame_tree_node_id_); - } - return GetContentClient()->browser()->CreateURLLoaderThrottlesOnIO( - *resource_request_, resource_context_, web_contents_getter_, + return GetContentClient()->browser()->CreateURLLoaderThrottles( + *resource_request_, browser_context_, web_contents_getter_, navigation_ui_data_.get(), frame_tree_node_id_); } @@ -1249,7 +1094,9 @@ GlobalRequestID global_request_id_; net::RedirectInfo redirect_info_; int redirect_limit_ = net::URLRequest::kMaxRedirects; +#if BUILDFLAG(ENABLE_PLUGINS) ResourceContext* resource_context_; +#endif base::Callback<WebContents*()> web_contents_getter_; std::unique_ptr<NavigationUIData> navigation_ui_data_; scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory_; @@ -1489,9 +1336,7 @@ bool needs_loader_factory_interceptor = false; std::unique_ptr<network::SharedURLLoaderFactoryInfo> network_factory_info = - IsNavigationLoaderOnUIEnabled() - ? partition->GetURLLoaderFactoryForBrowserProcess()->Clone() - : partition->url_loader_factory_getter()->GetNetworkFactoryInfo(); + partition->GetURLLoaderFactoryForBrowserProcess()->Clone(); if (header_client) { needs_loader_factory_interceptor = true; network::mojom::URLLoaderFactoryPtrInfo factory_info; @@ -1509,37 +1354,25 @@ request_info->is_main_frame, std::move(proxied_factory_request), std::move(proxied_factory_info), std::move(known_schemes), bypass_redirect_checks, weak_factory_.GetWeakPtr()); - RunOrPostTaskIfNecessary( - FROM_HERE, GetLoaderRequestControllerThreadID(), - base::BindOnce( - &URLLoaderRequestController::Start, - base::Unretained(request_controller_.get()), - std::move(network_factory_info), service_worker_navigation_handle, - service_worker_navigation_handle_core, appcache_handle_core, - std::move(prefetched_signed_exchange_cache), - std::move(signed_exchange_prefetch_metric_recorder), - std::move(request_info), std::move(navigation_ui_data), - std::move(factory_for_webui), needs_loader_factory_interceptor, - base::Time::Now(), std::move(accept_langs))); + request_controller_->Start( + std::move(network_factory_info), service_worker_navigation_handle, + service_worker_navigation_handle_core, appcache_handle_core, + std::move(prefetched_signed_exchange_cache), + std::move(signed_exchange_prefetch_metric_recorder), + std::move(request_info), std::move(navigation_ui_data), + std::move(factory_for_webui), needs_loader_factory_interceptor, + base::Time::Now(), std::move(accept_langs)); } NavigationURLLoaderImpl::~NavigationURLLoaderImpl() { - if (!IsNavigationLoaderOnUIEnabled()) { - BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, - request_controller_.release()); - } } void NavigationURLLoaderImpl::FollowRedirect( const std::vector<std::string>& removed_headers, const net::HttpRequestHeaders& modified_headers, PreviewsState new_previews_state) { - RunOrPostTaskIfNecessary( - FROM_HERE, GetLoaderRequestControllerThreadID(), - base::BindOnce(&URLLoaderRequestController::FollowRedirect, - base::Unretained(request_controller_.get()), - removed_headers, modified_headers, new_previews_state, - base::Time::Now())); + request_controller_->FollowRedirect(removed_headers, modified_headers, + new_previews_state, base::Time::Now()); } void NavigationURLLoaderImpl::OnReceiveResponse( @@ -1568,8 +1401,10 @@ // NavigationResourceHandler::OnResponseStarted() does. delegate_->OnResponseStarted( std::move(url_loader_client_endpoints), std::move(response_head), - std::move(response_body), global_request_id, is_download, - download_policy_, request_controller_->TakeSubresourceLoaderParams()); + std::move(response_body), + GlobalRequestID(global_request_id.child_id, global_request_id.request_id), + is_download, download_policy_, + request_controller_->TakeSubresourceLoaderParams()); } void NavigationURLLoaderImpl::OnReceiveRedirect( @@ -1591,9 +1426,8 @@ // static void NavigationURLLoaderImpl::SetURLLoaderFactoryInterceptorForTesting( const URLLoaderFactoryInterceptor& interceptor) { - DCHECK(!BrowserThread::IsThreadInitialized( - GetLoaderRequestControllerThreadID()) || - BrowserThread::CurrentlyOn(GetLoaderRequestControllerThreadID())); + DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::UI) || + BrowserThread::CurrentlyOn(BrowserThread::UI)); g_loader_factory_interceptor.Get() = interceptor; } @@ -1623,26 +1457,6 @@ return GlobalRequestID(-1, s_next_request_id--); } -// static -bool NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled() { - return base::FeatureList::IsEnabled(features::kNavigationLoaderOnUI); -} - -// static -BrowserThread::ID -NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID() { - return IsNavigationLoaderOnUIEnabled() ? BrowserThread::UI - : BrowserThread::IO; -} - -// static -void NavigationURLLoaderImpl::RunOrPostTaskOnLoaderThread( - const base::Location& from_here, - base::OnceClosure task) { - RunOrPostTaskIfNecessary(from_here, GetLoaderRequestControllerThreadID(), - std::move(task)); -} - void NavigationURLLoaderImpl::OnRequestStarted(base::TimeTicks timestamp) { DCHECK_CURRENTLY_ON(BrowserThread::UI); delegate_->OnRequestStarted(timestamp);
diff --git a/content/browser/loader/navigation_url_loader_impl.h b/content/browser/loader/navigation_url_loader_impl.h index 53bd288f..2f62b865 100644 --- a/content/browser/loader/navigation_url_loader_impl.h +++ b/content/browser/loader/navigation_url_loader_impl.h
@@ -89,31 +89,6 @@ // the IO thread. static GlobalRequestID MakeGlobalRequestID(); - // Returns true if URLLoaderRequestController will be run on the UI thread. - static bool IsNavigationLoaderOnUIEnabled(); - - // Returns the BrowserThread::ID that the URLLoaderRequestController will be - // running on. - static BrowserThread::ID GetLoaderRequestControllerThreadID(); - - // Runs |task| on the the loader thread if already on that thread, otherwise - // posts a task to the loader thread. - static void RunOrPostTaskOnLoaderThread(const base::Location& from_here, - base::OnceClosure task); - - // Deleter to use for objects that should be deleted on the loader thread. - struct DeleteOnLoaderThread { - template <typename T> - static void Destruct(const T* x) { - if (BrowserThread::CurrentlyOn(GetLoaderRequestControllerThreadID())) { - delete x; - } else { - BrowserThread::DeleteSoon(GetLoaderRequestControllerThreadID(), - FROM_HERE, x); - } - } - }; - private: class URLLoaderRequestController; void OnRequestStarted(base::TimeTicks timestamp);
diff --git a/content/browser/loader/prefetch_browsertest_base.cc b/content/browser/loader/prefetch_browsertest_base.cc index dc95ba2..d79108a 100644 --- a/content/browser/loader/prefetch_browsertest_base.cc +++ b/content/browser/loader/prefetch_browsertest_base.cc
@@ -8,7 +8,6 @@ #include "base/callback.h" #include "base/strings/utf_string_conversions.h" #include "base/task/post_task.h" -#include "content/browser/loader/navigation_url_loader_impl.h" #include "content/browser/loader/prefetch_url_loader_service.h" #include "content/browser/storage_partition_impl.h" #include "content/browser/web_package/signed_exchange_handler.h" @@ -57,21 +56,10 @@ StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>( BrowserContext::GetDefaultStoragePartition( shell()->web_contents()->GetBrowserContext())); - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - partition->GetPrefetchURLLoaderService() - ->RegisterPrefetchLoaderCallbackForTest(base::BindRepeating( - &PrefetchBrowserTestBase::OnPrefetchURLLoaderCalled, - base::Unretained(this))); - } else { - base::PostTask( - FROM_HERE, {BrowserThread::IO}, - base::BindOnce( - &PrefetchURLLoaderService::RegisterPrefetchLoaderCallbackForTest, - base::RetainedRef(partition->GetPrefetchURLLoaderService()), - base::BindRepeating( - &PrefetchBrowserTestBase::OnPrefetchURLLoaderCalled, - base::Unretained(this)))); - } + partition->GetPrefetchURLLoaderService() + ->RegisterPrefetchLoaderCallbackForTest(base::BindRepeating( + &PrefetchBrowserTestBase::OnPrefetchURLLoaderCalled, + base::Unretained(this))); } void PrefetchBrowserTestBase::RegisterResponse(const std::string& url, @@ -97,8 +85,7 @@ } void PrefetchBrowserTestBase::OnPrefetchURLLoaderCalled() { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); base::AutoLock lock(lock_); prefetch_url_loader_called_++; }
diff --git a/content/browser/loader/prefetch_url_loader.cc b/content/browser/loader/prefetch_url_loader.cc index 70e2dd3..6399b98d 100644 --- a/content/browser/loader/prefetch_url_loader.cc +++ b/content/browser/loader/prefetch_url_loader.cc
@@ -6,7 +6,6 @@ #include "base/bind.h" #include "base/feature_list.h" -#include "content/browser/loader/navigation_url_loader_impl.h" #include "content/browser/web_package/prefetched_signed_exchange_cache.h" #include "content/browser/web_package/prefetched_signed_exchange_cache_adapter.h" #include "content/browser/web_package/signed_exchange_prefetch_handler.h" @@ -37,7 +36,6 @@ scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory, URLLoaderThrottlesGetter url_loader_throttles_getter, BrowserContext* browser_context, - ResourceContext* resource_context, scoped_refptr<SignedExchangePrefetchMetricRecorder> signed_exchange_prefetch_metric_recorder, scoped_refptr<PrefetchedSignedExchangeCache> @@ -51,7 +49,6 @@ forwarding_client_(std::move(client)), url_loader_throttles_getter_(url_loader_throttles_getter), browser_context_(browser_context), - resource_context_(resource_context), signed_exchange_prefetch_metric_recorder_( std::move(signed_exchange_prefetch_metric_recorder)), accept_langs_(accept_langs) { @@ -64,19 +61,10 @@ network::kAcceptHeader, kSignedExchangeEnabledAcceptHeaderForPrefetch); if (prefetched_signed_exchange_cache && resource_request.is_signed_exchange_prefetch_cache_enabled) { - BrowserContext::BlobContextGetter getter; - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - getter = BrowserContext::GetBlobStorageContext(browser_context_); - } else { - getter = base::BindRepeating( - [](base::WeakPtr<storage::BlobStorageContext> context) { - return context; - }, - std::move(blob_storage_context)); - } prefetched_signed_exchange_cache_adapter_ = std::make_unique<PrefetchedSignedExchangeCacheAdapter>( - std::move(prefetched_signed_exchange_cache), std::move(getter), + std::move(prefetched_signed_exchange_cache), + BrowserContext::GetBlobStorageContext(browser_context_), resource_request.url, this); } } @@ -255,12 +243,8 @@ } bool PrefetchURLLoader::IsSignedExchangeHandlingEnabled() { - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - return signed_exchange_utils::IsSignedExchangeHandlingEnabled( - browser_context_); - } - return signed_exchange_utils::IsSignedExchangeHandlingEnabledOnIO( - resource_context_); + return signed_exchange_utils::IsSignedExchangeHandlingEnabled( + browser_context_); } } // namespace content
diff --git a/content/browser/loader/prefetch_url_loader.h b/content/browser/loader/prefetch_url_loader.h index 650a974b5..9dedca5 100644 --- a/content/browser/loader/prefetch_url_loader.h +++ b/content/browser/loader/prefetch_url_loader.h
@@ -37,7 +37,6 @@ namespace content { class BrowserContext; -class ResourceContext; class PrefetchedSignedExchangeCacheAdapter; class SignedExchangePrefetchHandler; class SignedExchangePrefetchMetricRecorder; @@ -50,11 +49,11 @@ using URLLoaderThrottlesGetter = base::RepeatingCallback< std::vector<std::unique_ptr<blink::URLLoaderThrottle>>()>; - // |url_loader_throttles_getter| and |resource_context| may be used when - // a prefetch handler needs to additionally create a request (e.g. for - // fetching certificate if the prefetch was for a signed exchange). - // |frame_tree_node_id_getter| is called only on UI thread when NetworkService - // is not enabled, but can be also called on IO thread otherwise. + // |url_loader_throttles_getter| may be used when a prefetch handler needs to + // additionally create a request (e.g. for fetching certificate if the + // prefetch was for a signed exchange). |frame_tree_node_id_getter| is called + // only on UI thread when NetworkService is not enabled, but can be also + // called on IO thread otherwise. PrefetchURLLoader( int32_t routing_id, int32_t request_id, @@ -66,7 +65,6 @@ scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory, URLLoaderThrottlesGetter url_loader_throttles_getter, BrowserContext* browser_context, - ResourceContext* resource_context, scoped_refptr<SignedExchangePrefetchMetricRecorder> signed_exchange_prefetch_metric_recorder, scoped_refptr<PrefetchedSignedExchangeCache> @@ -131,7 +129,6 @@ URLLoaderThrottlesGetter url_loader_throttles_getter_; BrowserContext* browser_context_; - ResourceContext* resource_context_; std::unique_ptr<mojo::DataPipeDrainer> pipe_drainer_;
diff --git a/content/browser/loader/prefetch_url_loader_service.cc b/content/browser/loader/prefetch_url_loader_service.cc index b9d4133..c61eb542 100644 --- a/content/browser/loader/prefetch_url_loader_service.cc +++ b/content/browser/loader/prefetch_url_loader_service.cc
@@ -62,31 +62,18 @@ // Create a RendererPreferenceWatcher to observe updates in the preferences. blink::mojom::RendererPreferenceWatcherPtr watcher_ptr; preference_watcher_request_ = mojo::MakeRequest(&watcher_ptr); - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) - preference_watcher_binding_.Bind(std::move(preference_watcher_request_)); + preference_watcher_binding_.Bind(std::move(preference_watcher_request_)); GetContentClient()->browser()->RegisterRendererPreferenceWatcher( browser_context, std::move(watcher_ptr)); } -void PrefetchURLLoaderService::InitializeResourceContext( - ResourceContext* resource_context, - ChromeBlobStorageContext* blob_storage_context) { - DCHECK_CURRENTLY_ON(BrowserThread::IO); - DCHECK(!NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()); - DCHECK(!resource_context_); - resource_context_ = resource_context; - blob_storage_context_ = blob_storage_context->context()->AsWeakPtr(); - preference_watcher_binding_.Bind(std::move(preference_watcher_request_)); -} - void PrefetchURLLoaderService::GetFactory( mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver, int frame_tree_node_id, std::unique_ptr<network::SharedURLLoaderFactoryInfo> factories, scoped_refptr<PrefetchedSignedExchangeCache> prefetched_signed_exchange_cache) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); auto factory_bundle = network::SharedURLLoaderFactory::Create(std::move(factories)); loader_factory_receivers_.Add( @@ -106,12 +93,9 @@ const net::MutableNetworkTrafficAnnotationTag& traffic_annotation, scoped_refptr<network::SharedURLLoaderFactory> network_loader_factory, base::RepeatingCallback<int(void)> frame_tree_node_id_getter) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_EQ(static_cast<int>(ResourceType::kPrefetch), resource_request.resource_type); - DCHECK(NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled() || - resource_context_); if (prefetch_load_callback_for_testing_) prefetch_load_callback_for_testing_.Run(); @@ -135,8 +119,7 @@ base::BindRepeating( &PrefetchURLLoaderService::CreateURLLoaderThrottles, this, resource_request, frame_tree_node_id_getter), - browser_context_, resource_context_, - signed_exchange_prefetch_metric_recorder_, + browser_context_, signed_exchange_prefetch_metric_recorder_, std::move(prefetched_signed_exchange_cache), blob_storage_context_, accept_langs_), std::move(request)); @@ -152,8 +135,7 @@ const network::ResourceRequest& resource_request, network::mojom::URLLoaderClientPtr client, const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); const auto& current_context = *loader_factory_receivers_.current_context(); int frame_tree_node_id = current_context.frame_tree_node_id; CreateLoaderAndStart( @@ -164,8 +146,7 @@ void PrefetchURLLoaderService::Clone( network::mojom::URLLoaderFactoryRequest request) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); loader_factory_receivers_.Add( this, std::move(request), std::make_unique<BindContext>( @@ -182,15 +163,8 @@ const network::ResourceRequest& request, base::RepeatingCallback<int(void)> frame_tree_node_id_getter) { int frame_tree_node_id = frame_tree_node_id_getter.Run(); - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - return GetContentClient()->browser()->CreateURLLoaderThrottles( - request, browser_context_, - base::BindRepeating(&WebContents::FromFrameTreeNodeId, - frame_tree_node_id), - nullptr /* navigation_ui_data */, frame_tree_node_id); - } - return GetContentClient()->browser()->CreateURLLoaderThrottlesOnIO( - request, resource_context_, + return GetContentClient()->browser()->CreateURLLoaderThrottles( + request, browser_context_, base::BindRepeating(&WebContents::FromFrameTreeNodeId, frame_tree_node_id), nullptr /* navigation_ui_data */, frame_tree_node_id);
diff --git a/content/browser/loader/prefetch_url_loader_service.h b/content/browser/loader/prefetch_url_loader_service.h index 8af30497..8000c0e 100644 --- a/content/browser/loader/prefetch_url_loader_service.h +++ b/content/browser/loader/prefetch_url_loader_service.h
@@ -10,7 +10,6 @@ #include "base/callback.h" #include "base/macros.h" #include "base/memory/ref_counted.h" -#include "content/browser/loader/navigation_url_loader_impl.h" #include "content/browser/web_package/signed_exchange_prefetch_metric_recorder.h" #include "content/common/content_export.h" #include "content/public/browser/browser_thread.h" @@ -35,25 +34,18 @@ namespace content { class BrowserContext; -class ChromeBlobStorageContext; class PrefetchedSignedExchangeCache; -class ResourceContext; class URLLoaderFactoryGetter; class CONTENT_EXPORT PrefetchURLLoaderService final : public base::RefCountedThreadSafe< PrefetchURLLoaderService, - NavigationURLLoaderImpl::DeleteOnLoaderThread>, + content::BrowserThread::DeleteOnUIThread>, public blink::mojom::RendererPreferenceWatcher, public network::mojom::URLLoaderFactory { public: explicit PrefetchURLLoaderService(BrowserContext* browser_context); - // Must be called on the IO thread. - void InitializeResourceContext( - ResourceContext* resource_context, - ChromeBlobStorageContext* blob_storage_context); - void GetFactory( mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver, int frame_tree_node_id, @@ -95,7 +87,7 @@ private: friend class base::DeleteHelper<content::PrefetchURLLoaderService>; - friend struct NavigationURLLoaderImpl::DeleteOnLoaderThread; + friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; struct BindContext; ~PrefetchURLLoaderService() override; @@ -122,8 +114,6 @@ scoped_refptr<URLLoaderFactoryGetter> loader_factory_getter_; BrowserContext* browser_context_ = nullptr; - // Not used when NavigationLoaderOnUI is enabled. - ResourceContext* resource_context_ = nullptr; mojo::ReceiverSet<network::mojom::URLLoaderFactory, std::unique_ptr<BindContext>>
diff --git a/content/browser/media/capture/desktop_capture_device.cc b/content/browser/media/capture/desktop_capture_device.cc index 0ad210b..a555344 100644 --- a/content/browser/media/capture/desktop_capture_device.cc +++ b/content/browser/media/capture/desktop_capture_device.cc
@@ -587,9 +587,9 @@ : thread_("desktopCaptureThread") { #if defined(OS_WIN) || defined(OS_MACOSX) // On Windows/OSX the thread must be a UI thread. - base::MessagePumpType thread_type = base::MessagePump::Type::UI; + base::MessagePumpType thread_type = base::MessagePumpType::UI; #else - base::MessagePumpType thread_type = base::MessagePump::Type::DEFAULT; + base::MessagePumpType thread_type = base::MessagePumpType::DEFAULT; #endif thread_.StartWithOptions(base::Thread::Options(thread_type, 0));
diff --git a/content/browser/notifications/platform_notification_context_impl.cc b/content/browser/notifications/platform_notification_context_impl.cc index 2722cebb..93ae69a 100644 --- a/content/browser/notifications/platform_notification_context_impl.cc +++ b/content/browser/notifications/platform_notification_context_impl.cc
@@ -625,17 +625,19 @@ void PlatformNotificationContextImpl:: SynchronizeDisplayedNotificationsForServiceWorkerRegistration( + base::Time start_time, const GURL& origin, int64_t service_worker_registration_id, ReadAllResultCallback callback, std::set<std::string> notification_ids, bool supports_synchronization) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - LazyInitialize(base::BindOnce( - &PlatformNotificationContextImpl:: - DoReadAllNotificationDataForServiceWorkerRegistration, - this, origin, service_worker_registration_id, std::move(callback), - std::move(notification_ids), supports_synchronization)); + LazyInitialize( + base::BindOnce(&PlatformNotificationContextImpl:: + DoReadAllNotificationDataForServiceWorkerRegistration, + this, start_time, origin, service_worker_registration_id, + std::move(callback), std::move(notification_ids), + supports_synchronization)); } void PlatformNotificationContextImpl:: @@ -653,20 +655,22 @@ // Rely on the database only std::set<std::string> notification_ids; SynchronizeDisplayedNotificationsForServiceWorkerRegistration( - origin, service_worker_registration_id, std::move(callback), - std::move(notification_ids), /* supports_synchronization= */ false); + base::Time::Now(), origin, service_worker_registration_id, + std::move(callback), std::move(notification_ids), + /* supports_synchronization= */ false); return; } - service->GetDisplayedNotifications( - base::BindOnce( - &PlatformNotificationContextImpl:: - SynchronizeDisplayedNotificationsForServiceWorkerRegistration, - this, origin, service_worker_registration_id, std::move(callback))); + service->GetDisplayedNotifications(base::BindOnce( + &PlatformNotificationContextImpl:: + SynchronizeDisplayedNotificationsForServiceWorkerRegistration, + this, base::Time::Now(), origin, service_worker_registration_id, + std::move(callback))); } void PlatformNotificationContextImpl:: DoReadAllNotificationDataForServiceWorkerRegistration( + base::Time start_time, const GURL& origin, int64_t service_worker_registration_id, ReadAllResultCallback callback, @@ -700,7 +704,7 @@ DCHECK(NotificationIdGenerator::IsPersistentNotification( it->notification_id)); if (displayed_notifications.count(it->notification_id) || - CanTrigger(*it)) { + CanTrigger(*it) || it->creation_time_millis >= start_time) { ++it; } else { obsolete_notifications.push_back(it->notification_id);
diff --git a/content/browser/notifications/platform_notification_context_impl.h b/content/browser/notifications/platform_notification_context_impl.h index 83d7c93..4bf25bf1 100644 --- a/content/browser/notifications/platform_notification_context_impl.h +++ b/content/browser/notifications/platform_notification_context_impl.h
@@ -178,6 +178,7 @@ // Updates the database (and the result callback) based on // |displayed_notifications| if |supports_synchronization|. void SynchronizeDisplayedNotificationsForServiceWorkerRegistration( + base::Time start_time, const GURL& origin, int64_t service_worker_registration_id, ReadAllResultCallback callback, @@ -188,6 +189,7 @@ // called on the |task_runner_| thread. |callback| will be invoked on the // UI thread when the operation has completed. void DoReadAllNotificationDataForServiceWorkerRegistration( + base::Time start_time, const GURL& origin, int64_t service_worker_registration_id, ReadAllResultCallback callback,
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 75c23880..41e0376 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -100,7 +100,6 @@ #include "content/browser/histogram_controller.h" #include "content/browser/indexed_db/indexed_db_context_impl.h" #include "content/browser/indexed_db/indexed_db_dispatcher_host.h" -#include "content/browser/loader/navigation_url_loader_impl.h" #include "content/browser/media/capture/audio_mirroring_manager.h" #include "content/browser/media/media_internals.h" #include "content/browser/media/midi_host.h" @@ -1283,10 +1282,12 @@ : public mojom::ChildProcessHostBootstrap, public mojom::ChildProcessHost { public: - IOThreadHostImpl(base::WeakPtr<RenderProcessHostImpl> weak_host, + IOThreadHostImpl(int render_process_id, + base::WeakPtr<RenderProcessHostImpl> weak_host, mojo::PendingReceiver<mojom::ChildProcessHostBootstrap> bootstrap_receiver) - : weak_host_(std::move(weak_host)), + : render_process_id_(render_process_id), + weak_host_(std::move(weak_host)), bootstrap_receiver_(this, std::move(bootstrap_receiver)) {} ~IOThreadHostImpl() override = default; @@ -1299,6 +1300,11 @@ // mojom::ChildProcessHost implementation: void BindHostReceiver(mojo::GenericPendingReceiver receiver) override { + GetContentClient()->browser()->BindHostReceiverForRendererOnIOThread( + render_process_id_, &receiver); + if (!receiver) + return; + base::PostTask(FROM_HERE, {BrowserThread::UI}, base::BindOnce(&IOThreadHostImpl::BindHostReceiverOnUIThread, weak_host_, std::move(receiver))); @@ -1311,6 +1317,7 @@ weak_host->OnBindHostReceiver(std::move(receiver)); } + const int render_process_id_; const base::WeakPtr<RenderProcessHostImpl> weak_host_; mojo::Receiver<mojom::ChildProcessHostBootstrap> bootstrap_receiver_; mojo::Receiver<mojom::ChildProcessHost> receiver_{this}; @@ -1668,13 +1675,7 @@ channel_->Unpause(false /* flush */); // Call the embedder first so that their IPC filters have priority. - service_manager::mojom::ServiceRequest service_request; - GetContentClient()->browser()->RenderProcessWillLaunch(this, - &service_request); - if (service_request.is_pending()) { - GetRendererInterface()->CreateEmbedderRendererService( - std::move(service_request)); - } + GetContentClient()->browser()->RenderProcessWillLaunch(this); #if defined(OS_ANDROID) // Initialize the java audio manager so that media session tests will pass. @@ -1808,7 +1809,7 @@ mojo::PendingRemote<mojom::ChildProcessHostBootstrap> bootstrap_remote; io_thread_host_impl_.emplace( - io_task_runner, instance_weak_factory_->GetWeakPtr(), + io_task_runner, GetID(), instance_weak_factory_->GetWeakPtr(), bootstrap_remote.InitWithNewPipeAndPassReceiver()); child_process_->Initialize(std::move(bootstrap_remote)); @@ -2120,19 +2121,12 @@ base::BindRepeating(&CreateReportingServiceProxy, GetID())); #endif // BUILDFLAG(ENABLE_REPORTING) - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - AddUIThreadInterface( - registry.get(), - base::BindRepeating( - &ChromeAppCacheService::CreateBackendForRequest, - base::Unretained(storage_partition_impl_->GetAppCacheService()), - GetID())); - } else { - registry->AddInterface(base::BindRepeating( - &ChromeAppCacheService::CreateBackendForRequest, - base::Unretained(storage_partition_impl_->GetAppCacheService()), - GetID())); - } + AddUIThreadInterface( + registry.get(), + base::BindRepeating( + &ChromeAppCacheService::CreateBackendForRequest, + base::Unretained(storage_partition_impl_->GetAppCacheService()), + GetID())); AddUIThreadInterface( registry.get(),
diff --git a/content/browser/scheduler/browser_io_task_environment.cc b/content/browser/scheduler/browser_io_task_environment.cc index d9f9cc5..e89790f 100644 --- a/content/browser/scheduler/browser_io_task_environment.cc +++ b/content/browser/scheduler/browser_io_task_environment.cc
@@ -4,6 +4,7 @@ #include "content/browser/scheduler/browser_io_task_environment.h" +#include "base/message_loop/message_pump_type.h" #include "base/task/sequence_manager/sequence_manager.h" #include "base/task/sequence_manager/task_queue.h" #include "content/public/browser/browser_thread.h" @@ -17,7 +18,7 @@ BrowserIOTaskEnvironment::BrowserIOTaskEnvironment() : sequence_manager_(CreateUnboundSequenceManager( SequenceManager::Settings::Builder() - .SetMessagePumpType(base::MessagePump::Type::IO) + .SetMessagePumpType(base::MessagePumpType::IO) .Build())) { Init(sequence_manager_.get()); } @@ -47,7 +48,7 @@ base::TimerSlack timer_slack) { DCHECK(sequence_manager_); sequence_manager_->BindToMessagePump( - base::MessagePump::Create(base::MessagePump::Type::IO)); + base::MessagePump::Create(base::MessagePumpType::IO)); sequence_manager_->SetTimerSlack(timer_slack); sequence_manager_->SetDefaultTaskRunner(GetDefaultTaskRunner()); }
diff --git a/content/browser/scheduler/browser_task_queues_unittest.cc b/content/browser/scheduler/browser_task_queues_unittest.cc index 9e5d6739..38550246 100644 --- a/content/browser/scheduler/browser_task_queues_unittest.cc +++ b/content/browser/scheduler/browser_task_queues_unittest.cc
@@ -7,7 +7,8 @@ #include <array> #include <memory> -#include "base/message_loop/message_loop.h" +#include "base/message_loop/message_pump.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/task/sequence_manager/sequence_manager.h" #include "base/test/bind_test_util.h" @@ -19,7 +20,6 @@ namespace content { namespace { -using ::base::MessageLoop; using ::base::RunLoop; using ::base::sequence_manager::CreateSequenceManagerOnCurrentThreadWithPump; using ::base::sequence_manager::SequenceManager; @@ -35,7 +35,7 @@ protected: BrowserTaskQueuesTest() : sequence_manager_(CreateSequenceManagerOnCurrentThreadWithPump( - base::MessagePump::Create(base::MessagePump::Type::DEFAULT))), + base::MessagePump::Create(base::MessagePumpType::DEFAULT))), queues_(std::make_unique<BrowserTaskQueues>( BrowserThread::UI, sequence_manager_.get(),
diff --git a/content/browser/scheduler/browser_ui_thread_scheduler.cc b/content/browser/scheduler/browser_ui_thread_scheduler.cc index 4fd4b3f..0925f8f 100644 --- a/content/browser/scheduler/browser_ui_thread_scheduler.cc +++ b/content/browser/scheduler/browser_ui_thread_scheduler.cc
@@ -10,6 +10,7 @@ #include "base/logging.h" #include "base/memory/ptr_util.h" #include "base/message_loop/message_pump.h" +#include "base/message_loop/message_pump_type.h" #include "base/process/process.h" #include "base/run_loop.h" #include "base/task/sequence_manager/sequence_manager.h" @@ -38,7 +39,7 @@ : owned_sequence_manager_( base::sequence_manager::CreateUnboundSequenceManager( base::sequence_manager::SequenceManager::Settings::Builder() - .SetMessagePumpType(base::MessagePump::Type::UI) + .SetMessagePumpType(base::MessagePumpType::UI) .Build())), task_queues_(BrowserThread::UI, owned_sequence_manager_.get(), @@ -49,7 +50,7 @@ handle_->GetDefaultTaskRunner()); owned_sequence_manager_->BindToMessagePump( - base::MessagePump::Create(base::MessagePump::Type::UI)); + base::MessagePump::Create(base::MessagePumpType::UI)); } BrowserUIThreadScheduler::BrowserUIThreadScheduler(
diff --git a/content/browser/service_worker/embedded_worker_test_helper.cc b/content/browser/service_worker/embedded_worker_test_helper.cc index 8698fcc4..8ee9a09 100644 --- a/content/browser/service_worker/embedded_worker_test_helper.cc +++ b/content/browser/service_worker/embedded_worker_test_helper.cc
@@ -35,10 +35,6 @@ } private: - void CreateEmbedderRendererService( - service_manager::mojom::ServiceRequest service_request) override { - NOTREACHED(); - } void CreateView(mojom::CreateViewParamsPtr) override { NOTREACHED(); } void CreateFrame(mojom::CreateFrameParamsPtr) override { NOTREACHED(); } void SetUpEmbeddedWorkerChannelForServiceWorker(
diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc index a95ea42..120cf3b 100644 --- a/content/browser/service_worker/service_worker_context_wrapper.cc +++ b/content/browser/service_worker/service_worker_context_wrapper.cc
@@ -23,7 +23,6 @@ #include "base/task/post_task.h" #include "base/threading/thread_task_runner_handle.h" #include "content/browser/blob_storage/chrome_blob_storage_context.h" -#include "content/browser/loader/navigation_url_loader_impl.h" #include "content/browser/service_worker/embedded_worker_status.h" #include "content/browser/service_worker/service_worker_context_watcher.h" #include "content/browser/service_worker/service_worker_process_manager.h" @@ -207,13 +206,11 @@ // forward observer methods to observers outside of content. core_observer_list_->AddObserver(this); - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - watcher_ = base::MakeRefCounted<ServiceWorkerContextWatcher>( - this, - base::BindRepeating(&ServiceWorkerContextWrapper::OnRegistrationUpdated, - base::Unretained(this)), - base::DoNothing(), base::DoNothing()); - } + watcher_ = base::MakeRefCounted<ServiceWorkerContextWatcher>( + this, + base::BindRepeating(&ServiceWorkerContextWrapper::OnRegistrationUpdated, + base::Unretained(this)), + base::DoNothing(), base::DoNothing()); } void ServiceWorkerContextWrapper::Init( @@ -1533,7 +1530,6 @@ bool ServiceWorkerContextWrapper::HasRegistrationForOrigin( const GURL& origin) const { DCHECK_CURRENTLY_ON(BrowserThread::UI); - DCHECK(NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()); return !registrations_initialized_ || registrations_for_origin_.find(origin) != registrations_for_origin_.end();
diff --git a/content/browser/service_worker/service_worker_navigation_loader_interceptor.cc b/content/browser/service_worker/service_worker_navigation_loader_interceptor.cc index df8431f..9edcb07 100644 --- a/content/browser/service_worker/service_worker_navigation_loader_interceptor.cc +++ b/content/browser/service_worker/service_worker_navigation_loader_interceptor.cc
@@ -11,7 +11,6 @@ #include "base/optional.h" #include "base/task/post_task.h" #include "content/browser/frame_host/navigation_request_info.h" -#include "content/browser/loader/navigation_url_loader_impl.h" #include "content/browser/service_worker/service_worker_context_core.h" #include "content/browser/service_worker/service_worker_context_wrapper.h" #include "content/browser/service_worker/service_worker_controllee_request_handler.h" @@ -164,7 +163,6 @@ const ServiceWorkerNavigationLoaderInterceptorParams& params, base::WeakPtr<ServiceWorkerNavigationHandle> handle) : handle_(std::move(handle)), params_(params) { - DCHECK(NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()); DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(handle_); }
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc index abda4f3b..435ff14 100644 --- a/content/browser/storage_partition_impl.cc +++ b/content/browser/storage_partition_impl.cc
@@ -37,7 +37,6 @@ #include "content/browser/cookie_store/cookie_store_context.h" #include "content/browser/fileapi/browser_file_system_helper.h" #include "content/browser/gpu/shader_cache_factory.h" -#include "content/browser/loader/navigation_url_loader_impl.h" #include "content/browser/loader/prefetch_url_loader_service.h" #include "content/browser/native_file_system/native_file_system_manager_impl.h" #include "content/browser/notifications/platform_notification_context_impl.h" @@ -777,15 +776,8 @@ if (GetContentIndexContext()) GetContentIndexContext()->Shutdown(); - if (GetAppCacheService()) { - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - GetAppCacheService()->Shutdown(); - } else { - base::PostTask( - FROM_HERE, {BrowserThread::IO}, - base::BindOnce(&ChromeAppCacheService::Shutdown, appcache_service_)); - } - } + if (GetAppCacheService()) + GetAppCacheService()->Shutdown(); if (GetGeneratedCodeCacheContext()) GetGeneratedCodeCacheContext()->Shutdown(); @@ -914,9 +906,6 @@ partition->blob_registry_ = BlobRegistryWrapper::Create(blob_context, partition->filesystem_context_); - partition->appcache_service_->set_url_loader_factory_getter( - partition->url_loader_factory_getter_.get()); - partition->prefetch_url_loader_service_ = base::MakeRefCounted<PrefetchURLLoaderService>(context);
diff --git a/content/browser/storage_partition_impl_map.cc b/content/browser/storage_partition_impl_map.cc index cc007b25..2d76c4b 100644 --- a/content/browser/storage_partition_impl_map.cc +++ b/content/browser/storage_partition_impl_map.cc
@@ -29,7 +29,6 @@ #include "content/browser/code_cache/generated_code_cache_context.h" #include "content/browser/cookie_store/cookie_store_context.h" #include "content/browser/fileapi/browser_file_system_helper.h" -#include "content/browser/loader/navigation_url_loader_impl.h" #include "content/browser/loader/prefetch_url_loader_service.h" #include "content/browser/resource_context_impl.h" #include "content/browser/storage_partition_impl.h" @@ -490,29 +489,13 @@ InitializeResourceContext(browser_context_); } - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - partition->GetAppCacheService()->InitializeOnLoaderThread( - in_memory ? base::FilePath() - : partition->GetPath().Append(kAppCacheDirname), - browser_context_, nullptr /* resource_context */, - browser_context_->GetSpecialStoragePolicy()); - } + partition->GetAppCacheService()->Initialize( + in_memory ? base::FilePath() + : partition->GetPath().Append(kAppCacheDirname), + browser_context_, browser_context_->GetSpecialStoragePolicy()); // Check first to avoid memory leak in unittests. if (BrowserThread::IsThreadInitialized(BrowserThread::IO)) { - if (!NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - base::PostTask( - FROM_HERE, {BrowserThread::IO}, - base::BindOnce( - &ChromeAppCacheService::InitializeOnLoaderThread, - partition->GetAppCacheService(), - in_memory ? base::FilePath() - : partition->GetPath().Append(kAppCacheDirname), - nullptr /* browser_context */, - browser_context_->GetResourceContext(), - base::RetainedRef(browser_context_->GetSpecialStoragePolicy()))); - } - partition->GetCacheStorageContext()->SetBlobParametersForCache( ChromeBlobStorageContext::GetFor(browser_context_)); @@ -522,16 +505,6 @@ partition->GetServiceWorkerContext(), browser_context_->GetResourceContext())); - if (!NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - base::PostTask( - FROM_HERE, {BrowserThread::IO}, - base::BindOnce(&PrefetchURLLoaderService::InitializeResourceContext, - partition->GetPrefetchURLLoaderService(), - browser_context_->GetResourceContext(), - base::RetainedRef(ChromeBlobStorageContext::GetFor( - browser_context_)))); - } - base::PostTask(FROM_HERE, {BrowserThread::IO}, base::BindOnce(&BackgroundFetchContext::InitializeOnIOThread, partition->GetBackgroundFetchContext()));
diff --git a/content/browser/utility_process_host.cc b/content/browser/utility_process_host.cc index 5321f77..f969e4d8 100644 --- a/content/browser/utility_process_host.cc +++ b/content/browser/utility_process_host.cc
@@ -225,7 +225,7 @@ UtilityProcessHost::~UtilityProcessHost() { DCHECK_CURRENTLY_ON(BrowserThread::IO); - if (client_ && !in_process_thread_) + if (client_ && launch_state_ == LaunchState::kLaunchComplete) client_->OnProcessTerminatedNormally(); }
diff --git a/content/browser/web_package/prefetched_signed_exchange_cache.cc b/content/browser/web_package/prefetched_signed_exchange_cache.cc index 68858647d..ae7abdd 100644 --- a/content/browser/web_package/prefetched_signed_exchange_cache.cc +++ b/content/browser/web_package/prefetched_signed_exchange_cache.cc
@@ -12,7 +12,6 @@ #include "components/link_header_util/link_header_util.h" #include "content/browser/loader/cross_origin_read_blocking_checker.h" #include "content/browser/loader/navigation_loader_interceptor.h" -#include "content/browser/loader/navigation_url_loader_impl.h" #include "content/browser/navigation_subresource_loader_params.h" #include "content/browser/web_package/signed_exchange_utils.h" #include "content/public/browser/browser_task_traits.h" @@ -262,18 +261,12 @@ return; } - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - base::PostTask( - FROM_HERE, {BrowserThread::IO}, - base::BindOnce( - &InnerResponseURLLoader::CreateMojoBlobReader, - weak_factory_.GetWeakPtr(), std::move(pipe_producer_handle), - std::make_unique<storage::BlobDataHandle>(*blob_data_handle_))); - } else { - CreateMojoBlobReader( - weak_factory_.GetWeakPtr(), std::move(pipe_producer_handle), - std::make_unique<storage::BlobDataHandle>(*blob_data_handle_)); - } + base::PostTask( + FROM_HERE, {BrowserThread::IO}, + base::BindOnce( + &InnerResponseURLLoader::CreateMojoBlobReader, + weak_factory_.GetWeakPtr(), std::move(pipe_producer_handle), + std::make_unique<storage::BlobDataHandle>(*blob_data_handle_))); client_->OnStartLoadingResponseBody(std::move(pipe_consumer_handle)); } @@ -306,8 +299,8 @@ static void BlobReaderCompleteOnIO( base::WeakPtr<InnerResponseURLLoader> loader, net::Error result) { - NavigationURLLoaderImpl::RunOrPostTaskOnLoaderThread( - FROM_HERE, base::BindOnce(&InnerResponseURLLoader::BlobReaderComplete, + base::PostTask(FROM_HERE, {BrowserThread::UI}, + base::BindOnce(&InnerResponseURLLoader::BlobReaderComplete, std::move(loader), result)); } @@ -634,8 +627,7 @@ void PrefetchedSignedExchangeCache::Store( std::unique_ptr<const Entry> cached_exchange) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); if (exchanges_.size() > kMaxEntrySize) return; DCHECK(cached_exchange->outer_url().is_valid()); @@ -655,8 +647,7 @@ std::unique_ptr<NavigationLoaderInterceptor> PrefetchedSignedExchangeCache::MaybeCreateInterceptor(const GURL& outer_url) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); const auto it = exchanges_.find(outer_url); if (it == exchanges_.end()) return nullptr; @@ -672,14 +663,12 @@ const PrefetchedSignedExchangeCache::EntryMap& PrefetchedSignedExchangeCache::GetExchanges() { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); return exchanges_; } void PrefetchedSignedExchangeCache::RecordHistograms() { - BrowserThread::ID thread_id = - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID(); + BrowserThread::ID thread_id = BrowserThread::UI; if (!BrowserThread::CurrentlyOn(thread_id)) { base::PostTask( FROM_HERE, {thread_id}, @@ -715,8 +704,7 @@ PrefetchedSignedExchangeCache::GetInfoListForNavigation( const Entry& main_exchange, const base::Time& now) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); const url::Origin outer_url_origin = url::Origin::Create(main_exchange.outer_url());
diff --git a/content/browser/web_package/prefetched_signed_exchange_cache_adapter.cc b/content/browser/web_package/prefetched_signed_exchange_cache_adapter.cc index ffe17eb..8463e8a 100644 --- a/content/browser/web_package/prefetched_signed_exchange_cache_adapter.cc +++ b/content/browser/web_package/prefetched_signed_exchange_cache_adapter.cc
@@ -5,7 +5,6 @@ #include "content/browser/web_package/prefetched_signed_exchange_cache_adapter.h" #include "base/task/post_task.h" -#include "content/browser/loader/navigation_url_loader_impl.h" #include "content/browser/loader/prefetch_url_loader.h" #include "content/public/browser/browser_task_traits.h" #include "storage/browser/blob/blob_builder_from_stream.h" @@ -84,21 +83,15 @@ length_hint = cached_exchange_->inner_response()->content_length; } blob_is_streaming_ = true; - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - base::PostTaskAndReplyWithResult( - FROM_HERE, {BrowserThread::IO}, - base::BindOnce( - &PrefetchedSignedExchangeCacheAdapter::CreateBlobBuilderFromStream, - weak_factory_.GetWeakPtr(), std::move(body), length_hint, - blob_context_getter_), - base::BindOnce( - &PrefetchedSignedExchangeCacheAdapter::SetBlobBuilderFromStream, - weak_factory_.GetWeakPtr())); - } else { - blob_builder_from_stream_ = - CreateBlobBuilderFromStream(weak_factory_.GetWeakPtr(), std::move(body), - length_hint, blob_context_getter_); - } + base::PostTaskAndReplyWithResult( + FROM_HERE, {BrowserThread::IO}, + base::BindOnce( + &PrefetchedSignedExchangeCacheAdapter::CreateBlobBuilderFromStream, + weak_factory_.GetWeakPtr(), std::move(body), length_hint, + blob_context_getter_), + base::BindOnce( + &PrefetchedSignedExchangeCacheAdapter::SetBlobBuilderFromStream, + weak_factory_.GetWeakPtr())); } void PrefetchedSignedExchangeCacheAdapter::OnComplete( @@ -112,12 +105,8 @@ storage::BlobBuilderFromStream* builder, std::unique_ptr<storage::BlobDataHandle> result) { blob_is_streaming_ = false; - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, - std::move(blob_builder_from_stream_)); - } else { - blob_builder_from_stream_.reset(); - } + BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, + std::move(blob_builder_from_stream_)); cached_exchange_->SetBlobDataHandle(std::move(result)); MaybeCallOnSignedExchangeStored(); } @@ -189,8 +178,8 @@ storage::BlobBuilderFromStream* builder, std::unique_ptr<storage::BlobDataHandle> result) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - NavigationURLLoaderImpl::RunOrPostTaskOnLoaderThread( - FROM_HERE, + base::PostTask( + FROM_HERE, {BrowserThread::UI}, base::BindOnce(&PrefetchedSignedExchangeCacheAdapter::StreamingBlobDone, adapter, builder, std::move(result))); }
diff --git a/content/browser/web_package/signed_exchange_devtools_proxy.cc b/content/browser/web_package/signed_exchange_devtools_proxy.cc index 096b871..afcfd64 100644 --- a/content/browser/web_package/signed_exchange_devtools_proxy.cc +++ b/content/browser/web_package/signed_exchange_devtools_proxy.cc
@@ -116,20 +116,17 @@ frame_tree_node_id_getter_(frame_tree_node_id_getter), devtools_navigation_token_(devtools_navigation_token), devtools_enabled_(report_raw_headers) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); } SignedExchangeDevToolsProxy::~SignedExchangeDevToolsProxy() { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); } void SignedExchangeDevToolsProxy::ReportError( const std::string& message, base::Optional<SignedExchangeError::FieldIndexPair> error_field) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); errors_.push_back(SignedExchangeError(message, std::move(error_field))); RunOrPostTaskIfNotOnUiThread( FROM_HERE, @@ -186,8 +183,7 @@ const base::Optional<SignedExchangeEnvelope>& envelope, const scoped_refptr<net::X509Certificate>& certificate, const net::SSLInfo* ssl_info) { - DCHECK_CURRENTLY_ON( - NavigationURLLoaderImpl::GetLoaderRequestControllerThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); if (!devtools_enabled_) return; base::Optional<net::SSLInfo> ssl_info_opt;
diff --git a/content/browser/web_package/signed_exchange_handler.cc b/content/browser/web_package/signed_exchange_handler.cc index acf890d..ceaecb1 100644 --- a/content/browser/web_package/signed_exchange_handler.cc +++ b/content/browser/web_package/signed_exchange_handler.cc
@@ -17,7 +17,6 @@ #include "content/browser/frame_host/frame_tree_node.h" #include "content/browser/frame_host/render_frame_host_impl.h" #include "content/browser/loader/merkle_integrity_source_stream.h" -#include "content/browser/loader/navigation_url_loader_impl.h" #include "content/browser/renderer_host/render_process_host_impl.h" #include "content/browser/web_package/signed_exchange_cert_fetcher_factory.h" #include "content/browser/web_package/signed_exchange_certificate_chain.h" @@ -92,15 +91,6 @@ const net::CertVerifyResult&, const net::ct::CTVerifyResult&)>; -void OnVerifyCertUI(VerifyCallback callback, - int32_t error_code, - const net::CertVerifyResult& cv_result, - const net::ct::CTVerifyResult& ct_result) { - NavigationURLLoaderImpl::RunOrPostTaskOnLoaderThread( - FROM_HERE, - base::BindOnce(std::move(callback), error_code, cv_result, ct_result)); -} - void VerifyCert(const scoped_refptr<net::X509Certificate>& certificate, const GURL& url, const std::string& ocsp_result, @@ -108,8 +98,8 @@ base::RepeatingCallback<int(void)> frame_tree_node_id_getter, VerifyCallback callback) { VerifyCallback wrapped_callback = mojo::WrapCallbackWithDefaultInvokeIfNotRun( - base::BindOnce(OnVerifyCertUI, std::move(callback)), net::ERR_FAILED, - net::CertVerifyResult(), net::ct::CTVerifyResult()); + std::move(callback), net::ERR_FAILED, net::CertVerifyResult(), + net::ct::CTVerifyResult()); network::mojom::NetworkContext* network_context = g_network_context_for_testing;
diff --git a/content/browser/web_package/signed_exchange_subresource_prefetch_browsertest.cc b/content/browser/web_package/signed_exchange_subresource_prefetch_browsertest.cc index 81790df..dff544c8f 100644 --- a/content/browser/web_package/signed_exchange_subresource_prefetch_browsertest.cc +++ b/content/browser/web_package/signed_exchange_subresource_prefetch_browsertest.cc
@@ -23,7 +23,6 @@ #include "base/time/time_override.h" #include "content/browser/blob_storage/chrome_blob_storage_context.h" #include "content/browser/frame_host/render_frame_host_impl.h" -#include "content/browser/loader/navigation_url_loader_impl.h" #include "content/browser/loader/prefetch_browsertest_base.h" #include "content/browser/web_package/mock_signed_exchange_handler.h" #include "content/browser/web_package/prefetched_signed_exchange_cache.h" @@ -64,25 +63,8 @@ scoped_refptr<PrefetchedSignedExchangeCache> cache = rfh->EnsurePrefetchedSignedExchangeCache(); PrefetchedSignedExchangeCache::EntryMap results; - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - for (const auto& exchanges_it : cache->GetExchanges()) { - results[exchanges_it.first] = exchanges_it.second->Clone(); - } - } else { - base::RunLoop run_loop; - base::PostTaskAndReply( - FROM_HERE, {BrowserThread::IO}, - base::BindOnce( - [](scoped_refptr<PrefetchedSignedExchangeCache> cache, - PrefetchedSignedExchangeCache::EntryMap* results) { - for (const auto& exchanges_it : cache->GetExchanges()) { - (*results)[exchanges_it.first] = exchanges_it.second->Clone(); - } - }, - cache, &results), - run_loop.QuitClosure()); - run_loop.Run(); - } + for (const auto& exchanges_it : cache->GetExchanges()) + results[exchanges_it.first] = exchanges_it.second->Clone(); return results; }
diff --git a/content/browser/web_package/signed_exchange_utils.cc b/content/browser/web_package/signed_exchange_utils.cc index 67f53bb..1de0421 100644 --- a/content/browser/web_package/signed_exchange_utils.cc +++ b/content/browser/web_package/signed_exchange_utils.cc
@@ -37,15 +37,6 @@ devtools_proxy->ReportError(error_message, std::move(error_field)); } -bool IsSignedExchangeHandlingEnabledOnIO(ResourceContext* context) { - if (!GetContentClient()->browser()->AllowSignedExchangeOnIO(context)) - return false; - - return base::FeatureList::IsEnabled(features::kSignedHTTPExchange) || - base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableExperimentalWebPlatformFeatures); -} - bool IsSignedExchangeHandlingEnabled(BrowserContext* context) { if (!GetContentClient()->browser()->AllowSignedExchange(context)) return false;
diff --git a/content/browser/web_package/signed_exchange_utils.h b/content/browser/web_package/signed_exchange_utils.h index 7983318..3fc101b 100644 --- a/content/browser/web_package/signed_exchange_utils.h +++ b/content/browser/web_package/signed_exchange_utils.h
@@ -24,7 +24,6 @@ namespace content { class BrowserContext; -class ResourceContext; class SignedExchangeDevToolsProxy; namespace signed_exchange_utils { @@ -48,10 +47,7 @@ base::nullopt); // Returns true when SignedHTTPExchange feature is enabled. This must be called -// on the IO thread. -CONTENT_EXPORT bool IsSignedExchangeHandlingEnabledOnIO( - ResourceContext* context); -// Same as above but called on UI thread. +// on the UI thread. CONTENT_EXPORT bool IsSignedExchangeHandlingEnabled(BrowserContext* context); // Returns true when SignedExchangeReportingForDistributors feature is enabled.
diff --git a/content/browser/worker_host/worker_script_fetch_initiator.cc b/content/browser/worker_host/worker_script_fetch_initiator.cc index 0115cce5..d652a74 100644 --- a/content/browser/worker_host/worker_script_fetch_initiator.cc +++ b/content/browser/worker_host/worker_script_fetch_initiator.cc
@@ -20,7 +20,6 @@ #include "content/browser/file_url_loader_factory.h" #include "content/browser/fileapi/file_system_url_loader_factory.h" #include "content/browser/loader/browser_initiated_resource_request.h" -#include "content/browser/loader/navigation_url_loader_impl.h" #include "content/browser/navigation_subresource_loader_params.h" #include "content/browser/service_worker/service_worker_context_wrapper.h" #include "content/browser/service_worker/service_worker_navigation_handle.h" @@ -176,49 +175,13 @@ AddAdditionalRequestHeaders(resource_request.get(), browser_context); - // When navigation on UI is enabled, service worker and appcache work on the - // UI thread. - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - CreateScriptLoaderOnUI( - worker_process_id, std::move(resource_request), storage_partition, - std::move(factory_bundle_for_browser), - std::move(subresource_loader_factories), - std::move(service_worker_context), service_worker_handle, - appcache_handle_core, std::move(blob_url_loader_factory), - std::move(url_loader_factory_override), std::move(callback)); - return; - } - - // Otherwise, bounce to the IO thread to setup service worker and appcache - // support in case the request for the worker script will need to be - // intercepted by them. - // - // This passes |resource_context| to the IO thread. |resource_context| will - // not be destroyed before the task runs, because the shutdown sequence is: - // 1. (UI thread) StoragePartitionImpl destructs. - // 2. (IO thread) ResourceContext destructs. - // Since |storage_partition| is alive, we must be before step 1, so this - // task we post to the IO thread must run before step 2. - base::PostTask( - FROM_HERE, {BrowserThread::IO}, - base::BindOnce( - &WorkerScriptFetchInitiator::CreateScriptLoaderOnIO, - worker_process_id, std::move(resource_request), - storage_partition->url_loader_factory_getter(), - std::move(factory_bundle_for_browser), - std::move(subresource_loader_factories), resource_context, - std::move(service_worker_context), service_worker_handle->core(), - appcache_handle_core, - blob_url_loader_factory ? blob_url_loader_factory->Clone() : nullptr, - url_loader_factory_override ? url_loader_factory_override->Clone() - : nullptr, - std::move(callback))); -} - -BrowserThread::ID WorkerScriptFetchInitiator::GetLoaderThreadID() { - return NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled() - ? BrowserThread::UI - : BrowserThread::IO; + CreateScriptLoaderOnUI( + worker_process_id, std::move(resource_request), storage_partition, + std::move(factory_bundle_for_browser), + std::move(subresource_loader_factories), + std::move(service_worker_context), service_worker_handle, + appcache_handle_core, std::move(blob_url_loader_factory), + std::move(url_loader_factory_override), std::move(callback)); } std::unique_ptr<blink::URLLoaderFactoryBundleInfo> @@ -374,119 +337,8 @@ WorkerScriptFetcher::CreateAndStart( std::make_unique<WorkerScriptLoaderFactory>( - worker_process_id, service_worker_handle, - /*service_worker_handle_core=*/nullptr, std::move(appcache_host), - browser_context_getter, - base::RepeatingCallback<ResourceContext*(void)>(), - std::move(url_loader_factory)), - std::move(throttles), std::move(resource_request), - base::BindOnce(WorkerScriptFetchInitiator::DidCreateScriptLoader, - std::move(callback), - std::move(subresource_loader_factories))); -} - -void WorkerScriptFetchInitiator::CreateScriptLoaderOnIO( - int worker_process_id, - std::unique_ptr<network::ResourceRequest> resource_request, - scoped_refptr<URLLoaderFactoryGetter> loader_factory_getter, - std::unique_ptr<blink::URLLoaderFactoryBundleInfo> - factory_bundle_for_browser_info, - std::unique_ptr<blink::URLLoaderFactoryBundleInfo> - subresource_loader_factories, - ResourceContext* resource_context, - scoped_refptr<ServiceWorkerContextWrapper> service_worker_context, - ServiceWorkerNavigationHandleCore* service_worker_handle_core, - AppCacheNavigationHandleCore* appcache_handle_core, - std::unique_ptr<network::SharedURLLoaderFactoryInfo> - blob_url_loader_factory_info, - std::unique_ptr<network::SharedURLLoaderFactoryInfo> - url_loader_factory_override_info, - CompletionCallback callback) { - DCHECK_CURRENTLY_ON(BrowserThread::IO); - DCHECK(resource_context); - DCHECK(service_worker_handle_core); - - auto resource_type = - static_cast<ResourceType>(resource_request->resource_type); - auto provider_type = blink::mojom::ServiceWorkerProviderType::kUnknown; - switch (resource_type) { - case ResourceType::kWorker: - provider_type = - blink::mojom::ServiceWorkerProviderType::kForDedicatedWorker; - break; - case ResourceType::kSharedWorker: - provider_type = blink::mojom::ServiceWorkerProviderType::kForSharedWorker; - break; - default: - NOTREACHED() << resource_request->resource_type; - break; - } - - // Create the URL loader factory for WorkerScriptLoaderFactory to use to load - // the main script. - scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory; - if (blob_url_loader_factory_info) { - // If we have a blob_url_loader_factory just use that directly rather than - // creating a new URLLoaderFactoryBundle. - url_loader_factory = network::SharedURLLoaderFactory::Create( - std::move(blob_url_loader_factory_info)); - } else if (url_loader_factory_override_info) { - // For unit tests. - url_loader_factory = network::SharedURLLoaderFactory::Create( - std::move(url_loader_factory_override_info)); - } else { - // Add the default factory to the bundle for browser. - DCHECK(factory_bundle_for_browser_info); - - // Get the direct network factory from |loader_factory_getter|. This doesn't - // support reconnection to the network service after a crash, but it's OK - // since it's used only for a single request to fetch the worker's main - // script during startup. If the network service crashes, worker startup - // should simply fail. - network::mojom::URLLoaderFactoryPtr network_factory_ptr; - loader_factory_getter->CloneNetworkFactory( - mojo::MakeRequest(&network_factory_ptr)); - factory_bundle_for_browser_info->pending_default_factory() = - network_factory_ptr.PassInterface(); - url_loader_factory = base::MakeRefCounted<blink::URLLoaderFactoryBundle>( - std::move(factory_bundle_for_browser_info)); - } - - // It's safe for |appcache_handle_core| to be a raw pointer. The core is owned - // by AppCacheNavigationHandle on the UI thread, which posts a task to delete - // the core on the IO thread on destruction, which must happen after this - // task. - base::WeakPtr<AppCacheHost> appcache_host = - appcache_handle_core ? appcache_handle_core->host()->GetWeakPtr() - : nullptr; - - // Create a ResourceContext getter using |service_worker_context|. - // This context is aware of shutdown and safely returns a nullptr - // instead of a destroyed ResourceContext in that case. - auto resource_context_getter = base::BindRepeating( - &ServiceWorkerContextWrapper::resource_context, service_worker_context); - - // Start loading a web worker main script. - // TODO(nhiroki): Figure out what we should do in |wc_getter| for loading web - // worker's main script. Returning the WebContents of the closest ancestor's - // frame is a possible option, but it doesn't work when a shared worker - // creates a dedicated worker after the closest ancestor's frame is gone. The - // frame tree node ID has the same issue. - base::RepeatingCallback<WebContents*()> wc_getter = - base::BindRepeating([]() -> WebContents* { return nullptr; }); - std::vector<std::unique_ptr<blink::URLLoaderThrottle>> throttles = - GetContentClient()->browser()->CreateURLLoaderThrottlesOnIO( - *resource_request, resource_context, wc_getter, - nullptr /* navigation_ui_data */, - RenderFrameHost::kNoFrameTreeNodeId); - - WorkerScriptFetcher::CreateAndStart( - std::make_unique<WorkerScriptLoaderFactory>( - worker_process_id, - /*service_worker_handle=*/nullptr, service_worker_handle_core, - std::move(appcache_host), - base::RepeatingCallback<BrowserContext*(void)>(), - resource_context_getter, std::move(url_loader_factory)), + worker_process_id, service_worker_handle, std::move(appcache_host), + browser_context_getter, std::move(url_loader_factory)), std::move(throttles), std::move(resource_request), base::BindOnce(WorkerScriptFetchInitiator::DidCreateScriptLoader, std::move(callback), @@ -500,8 +352,7 @@ blink::mojom::WorkerMainScriptLoadParamsPtr main_script_load_params, base::Optional<SubresourceLoaderParams> subresource_loader_params, bool success) { - // This can be the UI thread or IO thread. - DCHECK_CURRENTLY_ON(GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); // If a URLLoaderFactory for AppCache is supplied, use that. if (subresource_loader_params &&
diff --git a/content/browser/worker_host/worker_script_fetch_initiator.h b/content/browser/worker_host/worker_script_fetch_initiator.h index 063ee41..ff075b53b 100644 --- a/content/browser/worker_host/worker_script_fetch_initiator.h +++ b/content/browser/worker_host/worker_script_fetch_initiator.h
@@ -28,20 +28,16 @@ namespace network { class SharedURLLoaderFactory; -class SharedURLLoaderFactoryInfo; } // namespace network namespace content { class AppCacheNavigationHandleCore; class BrowserContext; -class ResourceContext; class ServiceWorkerContextWrapper; class ServiceWorkerNavigationHandle; -class ServiceWorkerNavigationHandleCore; class ServiceWorkerObjectHost; class StoragePartitionImpl; -class URLLoaderFactoryGetter; struct SubresourceLoaderParams; // PlzWorker: @@ -78,12 +74,6 @@ const std::string& storage_domain, CompletionCallback callback); - // Returns the BrowserThread::ID that the WorkerScriptLoaderFactory will be - // running on. - // TODO(crbug.com/824840): Remove this when non-NavigationLoaderOnUI code is - // removed. - static BrowserThread::ID GetLoaderThreadID(); - private: // Creates a loader factory bundle. Must be called on the UI thread. static std::unique_ptr<blink::URLLoaderFactoryBundleInfo> CreateFactoryBundle( @@ -99,24 +89,6 @@ network::ResourceRequest* resource_request, BrowserContext* browser_context); - static void CreateScriptLoaderOnIO( - int worker_process_id, - std::unique_ptr<network::ResourceRequest> resource_request, - scoped_refptr<URLLoaderFactoryGetter> loader_factory_getter, - std::unique_ptr<blink::URLLoaderFactoryBundleInfo> - factory_bundle_for_browser_info, - std::unique_ptr<blink::URLLoaderFactoryBundleInfo> - subresource_loader_factories, - ResourceContext* resource_context, - scoped_refptr<ServiceWorkerContextWrapper> service_worker_context, - ServiceWorkerNavigationHandleCore* service_worker_handle_core, - AppCacheNavigationHandleCore* appcache_handle_core, - std::unique_ptr<network::SharedURLLoaderFactoryInfo> - blob_url_loader_factory_info, - std::unique_ptr<network::SharedURLLoaderFactoryInfo> - url_loader_factory_override_info, - CompletionCallback callback); - static void CreateScriptLoaderOnUI( int worker_process_id, std::unique_ptr<network::ResourceRequest> resource_request,
diff --git a/content/browser/worker_host/worker_script_fetcher.cc b/content/browser/worker_host/worker_script_fetcher.cc index 34a5b98..91b7666 100644 --- a/content/browser/worker_host/worker_script_fetcher.cc +++ b/content/browser/worker_host/worker_script_fetcher.cc
@@ -55,7 +55,7 @@ std::vector<std::unique_ptr<blink::URLLoaderThrottle>> throttles, std::unique_ptr<network::ResourceRequest> resource_request, CreateAndStartCallback callback) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); // This fetcher will delete itself. See the class level comment. (new WorkerScriptFetcher(std::move(script_loader_factory), std::move(resource_request), std::move(callback))) @@ -70,16 +70,16 @@ resource_request_(std::move(resource_request)), callback_(std::move(callback)), response_url_loader_binding_(this) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); } WorkerScriptFetcher::~WorkerScriptFetcher() { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); } void WorkerScriptFetcher::Start( std::vector<std::unique_ptr<blink::URLLoaderThrottle>> throttles) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); auto shared_url_loader_factory = base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( @@ -103,13 +103,13 @@ void WorkerScriptFetcher::OnReceiveResponse( const network::ResourceResponseHead& response_head) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); response_head_ = response_head; } void WorkerScriptFetcher::OnStartLoadingResponseBody( mojo::ScopedDataPipeConsumerHandle response_body) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); base::WeakPtr<WorkerScriptLoader> script_loader = script_loader_factory_->GetScriptLoader(); @@ -171,7 +171,7 @@ void WorkerScriptFetcher::OnReceiveRedirect( const net::RedirectInfo& redirect_info, const network::ResourceResponseHead& response_head) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); redirect_infos_.push_back(redirect_info); redirect_response_heads_.push_back(response_head); url_loader_->FollowRedirect({}, /* removed_headers */ @@ -194,7 +194,7 @@ void WorkerScriptFetcher::OnComplete( const network::URLLoaderCompletionStatus& status) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); // We can reach here only when loading fails before receiving a response_head. DCHECK_NE(net::OK, status.error_code); std::move(callback_).Run(nullptr /* main_script_load_params */,
diff --git a/content/browser/worker_host/worker_script_loader.cc b/content/browser/worker_host/worker_script_loader.cc index d1e8465..021683d 100644 --- a/content/browser/worker_host/worker_script_loader.cc +++ b/content/browser/worker_host/worker_script_loader.cc
@@ -8,14 +8,12 @@ #include "base/task/post_task.h" #include "content/browser/appcache/appcache_request_handler.h" #include "content/browser/loader/navigation_loader_interceptor.h" -#include "content/browser/loader/navigation_url_loader_impl.h" #include "content/browser/service_worker/service_worker_navigation_handle.h" #include "content/browser/service_worker/service_worker_navigation_handle_core.h" #include "content/browser/service_worker/service_worker_request_handler.h" #include "content/browser/worker_host/worker_script_fetch_initiator.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" -#include "content/public/browser/resource_context.h" #include "net/url_request/redirect_util.h" #include "services/network/public/cpp/shared_url_loader_factory.h" @@ -28,47 +26,31 @@ uint32_t options, const network::ResourceRequest& resource_request, network::mojom::URLLoaderClientPtr client, - base::WeakPtr<ServiceWorkerNavigationHandle> service_worker_handle /* UI */, - base::WeakPtr<ServiceWorkerNavigationHandleCore> - service_worker_handle_core /* IO */, + base::WeakPtr<ServiceWorkerNavigationHandle> service_worker_handle, base::WeakPtr<AppCacheHost> appcache_host, const BrowserContextGetter& browser_context_getter, - const ResourceContextGetter& resource_context_getter, scoped_refptr<network::SharedURLLoaderFactory> default_loader_factory, const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) - : process_id_(process_id), - routing_id_(routing_id), + : routing_id_(routing_id), request_id_(request_id), options_(options), resource_request_(resource_request), client_(std::move(client)), service_worker_handle_(std::move(service_worker_handle)), - service_worker_handle_core_(std::move(service_worker_handle_core)), browser_context_getter_(browser_context_getter), - resource_context_getter_(resource_context_getter), default_loader_factory_(std::move(default_loader_factory)), traffic_annotation_(traffic_annotation), url_loader_client_binding_(this) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); std::unique_ptr<NavigationLoaderInterceptor> service_worker_interceptor; - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - if (!service_worker_handle_) { - // The DedicatedWorkerHost or SharedWorkerHost is already destroyed. - Abort(); - return; - } - service_worker_interceptor = ServiceWorkerRequestHandler::CreateForWorkerUI( - resource_request_, process_id, service_worker_handle_); - } else { - if (!service_worker_handle_core_) { - // The DedicatedWorkerHost or SharedWorkerHost is already destroyed. - Abort(); - return; - } - service_worker_interceptor = ServiceWorkerRequestHandler::CreateForWorkerIO( - resource_request_, process_id_, service_worker_handle_core_.get()); + if (!service_worker_handle_) { + // The DedicatedWorkerHost or SharedWorkerHost is already destroyed. + Abort(); + return; } + service_worker_interceptor = ServiceWorkerRequestHandler::CreateForWorkerUI( + resource_request_, process_id, service_worker_handle_); if (service_worker_interceptor) interceptors_.push_back(std::move(service_worker_interceptor)); @@ -85,57 +67,39 @@ } WorkerScriptLoader::~WorkerScriptLoader() { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); } base::WeakPtr<WorkerScriptLoader> WorkerScriptLoader::GetWeakPtr() { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); return weak_factory_.GetWeakPtr(); } void WorkerScriptLoader::Abort() { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); CommitCompleted(network::URLLoaderCompletionStatus(net::ERR_ABORTED)); } void WorkerScriptLoader::Start() { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(!completed_); // The DedicatedWorkerHost or SharedWorkerHost is already destroyed. - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled() && - !service_worker_handle_) { - Abort(); - return; - } - if (!NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled() && - !service_worker_handle_core_) { + if (!service_worker_handle_) { Abort(); return; } - BrowserContext* browser_context = nullptr; - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - browser_context = browser_context_getter_.Run(); - if (!browser_context) { - Abort(); - return; - } - } - - ResourceContext* resource_context = nullptr; - if (!NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - resource_context = resource_context_getter_.Run(); - if (!resource_context) { - Abort(); - return; - } + BrowserContext* browser_context = browser_context_getter_.Run(); + if (!browser_context) { + Abort(); + return; } if (interceptor_index_ < interceptors_.size()) { auto* interceptor = interceptors_[interceptor_index_++].get(); interceptor->MaybeCreateLoader( - resource_request_, browser_context, resource_context, + resource_request_, browser_context, nullptr /* resource_context */, base::BindOnce(&WorkerScriptLoader::MaybeStartLoader, weak_factory_.GetWeakPtr(), interceptor), base::BindOnce(&WorkerScriptLoader::LoadFromNetwork, @@ -149,7 +113,7 @@ void WorkerScriptLoader::MaybeStartLoader( NavigationLoaderInterceptor* interceptor, SingleRequestURLLoaderFactory::RequestHandler single_request_handler) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(!completed_); DCHECK(interceptor); @@ -183,7 +147,7 @@ } void WorkerScriptLoader::LoadFromNetwork(bool reset_subresource_loader_params) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(!completed_); default_loader_used_ = true; @@ -206,7 +170,7 @@ const std::vector<std::string>& removed_headers, const net::HttpRequestHeaders& modified_headers, const base::Optional<GURL>& new_url) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(!new_url.has_value()) << "Redirect with modified URL was not " "supported yet. crbug.com/845683"; DCHECK(redirect_info_); @@ -238,19 +202,19 @@ // state or propagating state to a new URLLoader upon redirect. void WorkerScriptLoader::SetPriority(net::RequestPriority priority, int32_t intra_priority_value) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); if (url_loader_) url_loader_->SetPriority(priority, intra_priority_value); } void WorkerScriptLoader::PauseReadingBodyFromNet() { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); if (url_loader_) url_loader_->PauseReadingBodyFromNet(); } void WorkerScriptLoader::ResumeReadingBodyFromNet() { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); if (url_loader_) url_loader_->ResumeReadingBodyFromNet(); } @@ -263,14 +227,14 @@ void WorkerScriptLoader::OnReceiveResponse( const network::ResourceResponseHead& response_head) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); client_->OnReceiveResponse(response_head); } void WorkerScriptLoader::OnReceiveRedirect( const net::RedirectInfo& redirect_info, const network::ResourceResponseHead& response_head) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); if (--redirect_limit_ == 0) { CommitCompleted( network::URLLoaderCompletionStatus(net::ERR_TOO_MANY_REDIRECTS)); @@ -285,30 +249,30 @@ int64_t current_position, int64_t total_size, OnUploadProgressCallback ack_callback) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); client_->OnUploadProgress(current_position, total_size, std::move(ack_callback)); } void WorkerScriptLoader::OnReceiveCachedMetadata(mojo_base::BigBuffer data) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); client_->OnReceiveCachedMetadata(std::move(data)); } void WorkerScriptLoader::OnTransferSizeUpdated(int32_t transfer_size_diff) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); client_->OnTransferSizeUpdated(transfer_size_diff); } void WorkerScriptLoader::OnStartLoadingResponseBody( mojo::ScopedDataPipeConsumerHandle consumer) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); client_->OnStartLoadingResponseBody(std::move(consumer)); } void WorkerScriptLoader::OnComplete( const network::URLLoaderCompletionStatus& status) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); CommitCompleted(status); } @@ -320,7 +284,7 @@ network::mojom::URLLoaderPtr* response_url_loader, network::mojom::URLLoaderClientRequest* response_client_request, ThrottlingURLLoader* url_loader) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); // TODO(crbug/898755): This is odd that NavigationLoaderInterceptor:: // MaybeCreateLoader() is called directly from WorkerScriptLoader. But @@ -348,15 +312,13 @@ void WorkerScriptLoader::CommitCompleted( const network::URLLoaderCompletionStatus& status) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(!completed_); completed_ = true; if (status.error_code == net::OK) { if (service_worker_handle_) { service_worker_handle_->OnBeginWorkerCommit(); - } else if (service_worker_handle_core_) { - service_worker_handle_core_->OnBeginWorkerCommit(); } }
diff --git a/content/browser/worker_host/worker_script_loader.h b/content/browser/worker_host/worker_script_loader.h index a39d326..872c263 100644 --- a/content/browser/worker_host/worker_script_loader.h +++ b/content/browser/worker_host/worker_script_loader.h
@@ -31,7 +31,6 @@ class NavigationLoaderInterceptor; class ResourceContext; class ServiceWorkerNavigationHandle; -class ServiceWorkerNavigationHandleCore; // The URLLoader for loading a shared worker script. Only used for the main // script request. @@ -68,13 +67,9 @@ uint32_t options, const network::ResourceRequest& resource_request, network::mojom::URLLoaderClientPtr client, - base::WeakPtr<ServiceWorkerNavigationHandle> - service_worker_handle /* UI */, - base::WeakPtr<ServiceWorkerNavigationHandleCore> - service_worker_handle_core /* IO */, + base::WeakPtr<ServiceWorkerNavigationHandle> service_worker_handle, base::WeakPtr<AppCacheHost> appcache_host, const BrowserContextGetter& browser_context_getter, - const ResourceContextGetter& resource_context_getter, scoped_refptr<network::SharedURLLoaderFactory> default_loader_factory, const net::MutableNetworkTrafficAnnotationTag& traffic_annotation); ~WorkerScriptLoader() override; @@ -139,16 +134,13 @@ base::Optional<SubresourceLoaderParams> subresource_loader_params_; - const int process_id_; const int32_t routing_id_; const int32_t request_id_; const uint32_t options_; network::ResourceRequest resource_request_; network::mojom::URLLoaderClientPtr client_; base::WeakPtr<ServiceWorkerNavigationHandle> service_worker_handle_; - base::WeakPtr<ServiceWorkerNavigationHandleCore> service_worker_handle_core_; BrowserContextGetter browser_context_getter_; - ResourceContextGetter resource_context_getter_; scoped_refptr<network::SharedURLLoaderFactory> default_loader_factory_; net::MutableNetworkTrafficAnnotationTag traffic_annotation_;
diff --git a/content/browser/worker_host/worker_script_loader_factory.cc b/content/browser/worker_host/worker_script_loader_factory.cc index 7e84237..cd7b4d8b 100644 --- a/content/browser/worker_host/worker_script_loader_factory.cc +++ b/content/browser/worker_host/worker_script_loader_factory.cc
@@ -23,29 +23,23 @@ WorkerScriptLoaderFactory::WorkerScriptLoaderFactory( int process_id, - ServiceWorkerNavigationHandle* service_worker_handle /* UI only */, - ServiceWorkerNavigationHandleCore* service_worker_handle_core /* IO only */, + ServiceWorkerNavigationHandle* service_worker_handle, base::WeakPtr<AppCacheHost> appcache_host, const BrowserContextGetter& browser_context_getter, - const ResourceContextGetter& resource_context_getter, scoped_refptr<network::SharedURLLoaderFactory> loader_factory) : process_id_(process_id), appcache_host_(std::move(appcache_host)), browser_context_getter_(browser_context_getter), - resource_context_getter_(resource_context_getter), loader_factory_(std::move(loader_factory)) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); if (service_worker_handle) { service_worker_handle_ = service_worker_handle->AsWeakPtr(); } - if (service_worker_handle_core) { - service_worker_handle_core_ = service_worker_handle_core->AsWeakPtr(); - } } WorkerScriptLoaderFactory::~WorkerScriptLoaderFactory() { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); } void WorkerScriptLoaderFactory::CreateLoaderAndStart( @@ -56,7 +50,7 @@ const network::ResourceRequest& resource_request, network::mojom::URLLoaderClientPtr client, const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) { - DCHECK_CURRENTLY_ON(WorkerScriptFetchInitiator::GetLoaderThreadID()); + DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(resource_request.resource_type == static_cast<int>(ResourceType::kWorker) || resource_request.resource_type == @@ -67,9 +61,8 @@ // Create a WorkerScriptLoader to load the script. auto script_loader = std::make_unique<WorkerScriptLoader>( process_id_, routing_id, request_id, options, resource_request, - std::move(client), service_worker_handle_, service_worker_handle_core_, - appcache_host_, browser_context_getter_, resource_context_getter_, - loader_factory_, traffic_annotation); + std::move(client), service_worker_handle_, appcache_host_, + browser_context_getter_, loader_factory_, traffic_annotation); script_loader_ = script_loader->GetWeakPtr(); mojo::MakeStrongBinding(std::move(script_loader), std::move(request)); }
diff --git a/content/browser/worker_host/worker_script_loader_factory.h b/content/browser/worker_host/worker_script_loader_factory.h index afd3fef..6e28078 100644 --- a/content/browser/worker_host/worker_script_loader_factory.h +++ b/content/browser/worker_host/worker_script_loader_factory.h
@@ -19,7 +19,6 @@ class AppCacheHost; class BrowserContext; class ServiceWorkerNavigationHandle; -class ServiceWorkerNavigationHandleCore; class ResourceContext; class WorkerScriptLoader; @@ -46,21 +45,11 @@ // by a feature like service worker. Typically it will load the script from // the NetworkService. However, it may internally contain non-NetworkService // factories used for non-http(s) URLs, e.g., a chrome-extension:// URL. - // - // NavigationLoaderOnUI: - // |service_worker_handle| and |browser_context_getter| can be - // used. - // - // Non-NavigationLoaderOnUI: - // |service_worker_handle_core| and |resource_context_getter| can - // be used. WorkerScriptLoaderFactory( int process_id, ServiceWorkerNavigationHandle* service_worker_handle, - ServiceWorkerNavigationHandleCore* service_worker_handle_core, base::WeakPtr<AppCacheHost> appcache_host, const BrowserContextGetter& browser_context_getter, - const ResourceContextGetter& resource_context_getter, scoped_refptr<network::SharedURLLoaderFactory> loader_factory); ~WorkerScriptLoaderFactory() override; @@ -80,10 +69,8 @@ private: const int process_id_; base::WeakPtr<ServiceWorkerNavigationHandle> service_worker_handle_; - base::WeakPtr<ServiceWorkerNavigationHandleCore> service_worker_handle_core_; base::WeakPtr<AppCacheHost> appcache_host_; BrowserContextGetter browser_context_getter_; - ResourceContextGetter resource_context_getter_; scoped_refptr<network::SharedURLLoaderFactory> loader_factory_; // This is owned by StrongBinding associated with the given URLLoaderRequest,
diff --git a/content/browser/worker_host/worker_script_loader_factory_unittest.cc b/content/browser/worker_host/worker_script_loader_factory_unittest.cc index 7f73d13c..0f9c979 100644 --- a/content/browser/worker_host/worker_script_loader_factory_unittest.cc +++ b/content/browser/worker_host/worker_script_loader_factory_unittest.cc
@@ -6,7 +6,6 @@ #include "base/bind_helpers.h" #include "base/run_loop.h" -#include "content/browser/loader/navigation_url_loader_impl.h" #include "content/browser/service_worker/embedded_worker_test_helper.h" #include "content/browser/service_worker/service_worker_context_core.h" #include "content/browser/service_worker/service_worker_context_wrapper.h" @@ -44,10 +43,6 @@ base::BindRepeating(&ServiceWorkerContextWrapper::browser_context, helper_->context_wrapper()); - resource_context_getter_ = - base::BindRepeating(&ServiceWorkerContextWrapper::resource_context, - helper_->context_wrapper()); - // Set up the network factory. network_loader_factory_instance_ = std::make_unique<FakeNetworkURLLoaderFactory>(); @@ -88,15 +83,14 @@ std::unique_ptr<ServiceWorkerNavigationHandle> service_worker_handle_; WorkerScriptLoaderFactory::BrowserContextGetter browser_context_getter_; - WorkerScriptLoaderFactory::ResourceContextGetter resource_context_getter_; }; TEST_F(WorkerScriptLoaderFactoryTest, ServiceWorkerProviderHost) { // Make the factory. auto factory = std::make_unique<WorkerScriptLoaderFactory>( - kProcessId, service_worker_handle_.get(), service_worker_handle_->core(), + kProcessId, service_worker_handle_.get(), /*appcache_host=*/nullptr, browser_context_getter_, - resource_context_getter_, network_loader_factory_); + network_loader_factory_); // Load the script. GURL url("https://www.example.com/worker.js"); @@ -119,9 +113,8 @@ TEST_F(WorkerScriptLoaderFactoryTest, NullServiceWorkerHandle) { // Make the factory. auto factory = std::make_unique<WorkerScriptLoaderFactory>( - kProcessId, service_worker_handle_.get(), service_worker_handle_->core(), - nullptr /* appcache_host */, browser_context_getter_, - resource_context_getter_, network_loader_factory_); + kProcessId, service_worker_handle_.get(), nullptr /* appcache_host */, + browser_context_getter_, network_loader_factory_); // Destroy the handle. service_worker_handle_.reset(); @@ -137,47 +130,14 @@ EXPECT_EQ(net::ERR_ABORTED, client.completion_status().error_code); } -// Test a null resource context when the request starts. This happens when -// shutdown starts between the constructor and when CreateLoaderAndStart is -// invoked. -TEST_F(WorkerScriptLoaderFactoryTest, NullResourceContext) { - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - // Resource context is irrelevant. - return; - } - - // Make the factory. - auto factory = std::make_unique<WorkerScriptLoaderFactory>( - kProcessId, service_worker_handle_.get(), service_worker_handle_->core(), - nullptr /* appcache_host */, browser_context_getter_, - resource_context_getter_, network_loader_factory_); - - // Set a null resource context. - helper_->context_wrapper()->InitializeResourceContext(nullptr); - - // Load the script. - GURL url("https://www.example.com/worker.js"); - network::TestURLLoaderClient client; - network::mojom::URLLoaderPtr loader = - CreateTestLoaderAndStart(url, factory.get(), &client); - client.RunUntilComplete(); - EXPECT_EQ(net::ERR_ABORTED, client.completion_status().error_code); -} - // Test a null browser context when the request starts. This happens when // shutdown starts between the constructor and when CreateLoaderAndStart is // invoked. TEST_F(WorkerScriptLoaderFactoryTest, NullBrowserContext) { - if (!NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - // Browser context is irrelevant. - return; - } - // Make the factory. auto factory = std::make_unique<WorkerScriptLoaderFactory>( - kProcessId, service_worker_handle_.get(), service_worker_handle_->core(), - nullptr /* appcache_host */, browser_context_getter_, - resource_context_getter_, network_loader_factory_); + kProcessId, service_worker_handle_.get(), nullptr /* appcache_host */, + browser_context_getter_, network_loader_factory_); // Set a null browser context. helper_->context_wrapper()->Shutdown();
diff --git a/content/common/renderer.mojom b/content/common/renderer.mojom index 462be9b..183fe6cc 100644 --- a/content/common/renderer.mojom +++ b/content/common/renderer.mojom
@@ -7,10 +7,10 @@ import "content/common/document_scoped_interface_bundle.mojom"; import "content/common/native_types.mojom"; import "ipc/constants.mojom"; +import "mojo/public/mojom/base/generic_pending_receiver.mojom"; import "mojo/public/mojom/base/time.mojom"; import "mojo/public/mojom/base/unguessable_token.mojom"; import "services/network/public/mojom/network_types.mojom"; -import "services/service_manager/public/mojom/service.mojom"; import "third_party/blink/public/mojom/renderer_preferences.mojom"; import "third_party/blink/public/mojom/service_worker/embedded_worker.mojom"; import "third_party/blink/public/mojom/user_agent/user_agent_metadata.mojom"; @@ -171,12 +171,6 @@ // This should be used for implementing browser-to-renderer control messages // which need to retain FIFO with respect to legacy IPC messages. interface Renderer { - // Tells the renderer to ask its embedder to bind |service_request| to an - // embedder-provided renderer-side service implementation. This is required to - // ensure that embedder-provided renderer-side service is initialized at the - // appropriate time. - CreateEmbedderRendererService(service_manager.mojom.Service& service_request); - // Tells the renderer to create a new view. CreateView(CreateViewParams params);
diff --git a/content/common/text_input_state.cc b/content/common/text_input_state.cc index ac32684..c08a3309 100644 --- a/content/common/text_input_state.cc +++ b/content/common/text_input_state.cc
@@ -6,18 +6,7 @@ namespace content { -TextInputState::TextInputState() - : type(ui::TEXT_INPUT_TYPE_NONE), - mode(ui::TEXT_INPUT_MODE_DEFAULT), - action(ui::TextInputAction::kDefault), - flags(0), - selection_start(0), - selection_end(0), - composition_start(-1), - composition_end(-1), - can_compose_inline(true), - show_ime_if_needed(false), - reply_to_request(false) {} +TextInputState::TextInputState() = default; TextInputState::TextInputState(const TextInputState& other) = default;
diff --git a/content/common/text_input_state.h b/content/common/text_input_state.h index f2a1523c..2ce7f20c 100644 --- a/content/common/text_input_state.h +++ b/content/common/text_input_state.h
@@ -21,44 +21,47 @@ TextInputState(const TextInputState& other); // Type of the input field. - ui::TextInputType type; + ui::TextInputType type = ui::TEXT_INPUT_TYPE_NONE; // The mode of input field. - ui::TextInputMode mode; + ui::TextInputMode mode = ui::TEXT_INPUT_MODE_DEFAULT; // The action of the input field. - ui::TextInputAction action; + ui::TextInputAction action = ui::TextInputAction::kDefault; // The flags of input field (autocorrect, autocomplete, etc.) - int flags; + int flags = 0; // The value of input field. base::string16 value; // The cursor position of the current selection start, or the caret position // if nothing is selected. - int selection_start; + int selection_start = 0; // The cursor position of the current selection end, or the caret position if // nothing is selected. - int selection_end; + int selection_end = 0; // The start position of the current composition, or -1 if there is none. - int composition_start; + int composition_start = -1; // The end position of the current composition, or -1 if there is none. - int composition_end; + int composition_end = -1; // Whether or not inline composition can be performed for the current input. - bool can_compose_inline; + bool can_compose_inline = true; // Whether or not the IME should be shown as a result of this update. Even if // true, the IME will only be shown if the input is appropriate (e.g. not // TEXT_INPUT_TYPE_NONE). - bool show_ime_if_needed; + bool show_ime_if_needed = false; + + // Whether or not the IME should always be hidden as a result of this update. + bool always_hide_ime = false; // Whether or not this is a reply to a request from IME. - bool reply_to_request; + bool reply_to_request = false; }; } // namespace content
diff --git a/content/common/widget_messages.h b/content/common/widget_messages.h index cc6559d..5ac5879 100644 --- a/content/common/widget_messages.h +++ b/content/common/widget_messages.h
@@ -128,6 +128,7 @@ IPC_STRUCT_TRAITS_MEMBER(composition_end) IPC_STRUCT_TRAITS_MEMBER(can_compose_inline) IPC_STRUCT_TRAITS_MEMBER(show_ime_if_needed) + IPC_STRUCT_TRAITS_MEMBER(always_hide_ime) IPC_STRUCT_TRAITS_MEMBER(reply_to_request) IPC_STRUCT_TRAITS_END()
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapterImpl.java b/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapterImpl.java index 0b4d984e..157202d9 100644 --- a/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapterImpl.java +++ b/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapterImpl.java
@@ -402,6 +402,7 @@ * @param textInputMode Text input mode. * @param textInputAction Text input mode action. * @param showIfNeeded Whether the keyboard should be shown if it is currently hidden. + * @param alwaysHide Whether the keyboard should be unconditionally hidden. * @param text The String contents of the field being edited. * @param selectionStart The character offset of the selection start, or the caret position if * there is no selection. @@ -415,15 +416,16 @@ */ @CalledByNative private void updateState(int textInputType, int textInputFlags, int textInputMode, - int textInputAction, boolean showIfNeeded, String text, int selectionStart, - int selectionEnd, int compositionStart, int compositionEnd, boolean replyToRequest) { + int textInputAction, boolean showIfNeeded, boolean alwaysHide, String text, + int selectionStart, int selectionEnd, int compositionStart, int compositionEnd, + boolean replyToRequest) { TraceEvent.begin("ImeAdapter.updateState"); try { if (DEBUG_LOGS) { Log.i(TAG, - "updateState: type [%d->%d], flags [%d], mode[%d], action[%d] show [%b], ", + "updateState: type [%d->%d], flags [%d], mode[%d], action[%d], show [%b], hide [%b]", mTextInputType, textInputType, textInputFlags, textInputMode, - textInputAction, showIfNeeded); + textInputAction, showIfNeeded, alwaysHide); } boolean needsRestart = false; boolean hide = false; @@ -475,7 +477,7 @@ mLastCompositionStart = compositionStart; mLastCompositionEnd = compositionEnd; - if (hide) { + if (hide || alwaysHide) { hideKeyboard(); } else { if (needsRestart) restartInput();
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc index 3f3a36c..21f956a 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc
@@ -281,12 +281,6 @@ return base::FilePath(); } -bool ContentBrowserClient::AllowAppCacheOnIO(const GURL& manifest_url, - const GURL& first_party, - ResourceContext* context) { - return true; -} - bool ContentBrowserClient::AllowAppCache(const GURL& manifest_url, const GURL& first_party, BrowserContext* context) { @@ -314,10 +308,6 @@ return true; } -bool ContentBrowserClient::AllowSignedExchangeOnIO(ResourceContext* context) { - return true; -} - bool ContentBrowserClient::AllowSignedExchange(BrowserContext* context) { return true; } @@ -891,11 +881,6 @@ return nullptr; } -bool ContentBrowserClient::IsSafeRedirectTargetOnIO(const GURL& url, - ResourceContext* context) { - return true; -} - bool ContentBrowserClient::IsSafeRedirectTarget(const GURL& url, BrowserContext* context) { return true;
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h index eeb0a01b..64fc6cd 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h
@@ -252,9 +252,7 @@ // If the client provides a service request, the content layer will ask the // corresponding embedder renderer-side component to bind it to an // implementation at the appropriate moment during initialization. - virtual void RenderProcessWillLaunch( - RenderProcessHost* host, - service_manager::mojom::ServiceRequest* service_request) {} + virtual void RenderProcessWillLaunch(RenderProcessHost* host) {} // Notifies that a BrowserChildProcessHost has been created. virtual void BrowserChildProcessHostCreated(BrowserChildProcessHost* host) {} @@ -526,11 +524,7 @@ const base::CommandLine& command_line); // Allow the embedder to control if an AppCache can be used for the given url. - // This is called on the IO thread. - virtual bool AllowAppCacheOnIO(const GURL& manifest_url, - const GURL& first_party, - ResourceContext* context); - // Same as above but called on UI thread. + // This is called on the UI thread. virtual bool AllowAppCache(const GURL& manifest_url, const GURL& first_party, BrowserContext* context); @@ -567,11 +561,7 @@ int render_frame_id); // Allows the embedder to control whether Signed HTTP Exchanges (SXG) can be - // loaded. This is called on the IO thread. - // Relying on ResourceContext to access preferences on IO thread until we move - // the call sites out of the IO thread. See crbug.com/908955 for more context. - virtual bool AllowSignedExchangeOnIO(ResourceContext* context); - // Same as above but called on UI thread. + // loaded. This is called on the UI thread. virtual bool AllowSignedExchange(BrowserContext* context); virtual bool IsDataSaverEnabled(BrowserContext* context); @@ -970,6 +960,12 @@ RenderProcessHost* render_process_host, mojo::GenericPendingReceiver receiver) {} + // Called on the IO thread to handle an unhandled interface receiver binding + // request from a render process. See |RenderThread::BindHostReceiver()|. + virtual void BindHostReceiverForRendererOnIOThread( + int render_process_id, + mojo::GenericPendingReceiver* receiver) {} + // Called just before the Service Manager is initialized. virtual void WillStartServiceManager() {} @@ -1131,7 +1127,6 @@ // and |frame_tree_node_id| take a callback returning a nullptr, nullptr, and // RenderFrameHost::kNoFrameTreeNodeId respectively. // - // This is called both when the network service is enabled and disabled. // This is called on the IO thread. virtual std::vector<std::unique_ptr<blink::URLLoaderThrottle>> CreateURLLoaderThrottlesOnIO( @@ -1492,10 +1487,7 @@ PictureInPictureWindowController* controller); // Returns true if it is safe to redirect to |url|, otherwise returns false. - // This is called on the IO thread. - virtual bool IsSafeRedirectTargetOnIO(const GURL& url, - ResourceContext* context); - // Same as above but called on UI thread. + // This is called on the UI thread. virtual bool IsSafeRedirectTarget(const GURL& url, BrowserContext* context); // Registers the watcher to observe updates in RendererPreferences.
diff --git a/content/public/child/child_thread.h b/content/public/child/child_thread.h index 4337829..e1dc569b 100644 --- a/content/public/child/child_thread.h +++ b/content/public/child/child_thread.h
@@ -81,8 +81,10 @@ // // For renderers: // 1. IO thread, IOThreadHostImpl::BindHostReceiver. - // 2. Main thread, RenderProcessHostImpl::BindHostReceiver. - // 3. Main thread, ContentBrowserClient::BindHostReceiverForRenderer. + // 2. IO thread, + // ContentBrowserClient::BindHostReceiverForRendererOnIOThread. + // 3. Main thread, RenderProcessHostImpl::BindHostReceiver. + // 4. Main thread, ContentBrowserClient::BindHostReceiverForRenderer. // // TODO(crbug.com/977637): Document behavior for other process types when // their support is added.
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index be36e306..74bb0f6 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc
@@ -268,10 +268,6 @@ const base::Feature kMouseSubframeNoImplicitCapture{ "MouseSubframeNoImplicitCapture", base::FEATURE_DISABLED_BY_DEFAULT}; -// If enabled, the URLLoaderRequestController lives on the UI thread. -const base::Feature kNavigationLoaderOnUI{"NavigationLoaderOnUI", - base::FEATURE_ENABLED_BY_DEFAULT}; - // Transmit the response body datapipe to the renderer process in // CommitNavigation() so that it can start reading earlier. const base::Feature kNavigationImmediateResponseBody{
diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h index aad0552..3cd0a18 100644 --- a/content/public/common/content_features.h +++ b/content/public/common/content_features.h
@@ -65,7 +65,6 @@ CONTENT_EXPORT extern const base::Feature kMojoVideoCapture; CONTENT_EXPORT extern const base::Feature kMojoVideoCaptureSecondary; CONTENT_EXPORT extern const base::Feature kMouseSubframeNoImplicitCapture; -CONTENT_EXPORT extern const base::Feature kNavigationLoaderOnUI; CONTENT_EXPORT extern const base::Feature kNavigationImmediateResponseBody; CONTENT_EXPORT extern const base::Feature kNetworkQualityEstimatorWebHoldback; CONTENT_EXPORT extern const base::Feature kNetworkServiceInProcess;
diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h index 09a7c1f..76d775b 100644 --- a/content/public/renderer/content_renderer_client.h +++ b/content/public/renderer/content_renderer_client.h
@@ -25,7 +25,6 @@ #include "media/base/audio_parameters.h" #include "media/base/supported_types.h" #include "mojo/public/cpp/bindings/generic_pending_receiver.h" -#include "services/service_manager/public/mojom/service.mojom.h" #include "third_party/blink/public/platform/web_content_settings_client.h" #include "third_party/blink/public/web/web_navigation_policy.h" #include "third_party/blink/public/web/web_navigation_type.h" @@ -399,11 +398,6 @@ // macOS. See https://crbug.com/936515. virtual bool SuppressLegacyTLSVersionConsoleMessage(); - // Asks the embedder to bind |service_request| to its renderer-side service - // implementation. - virtual void CreateRendererService( - service_manager::mojom::ServiceRequest service_request) {} - // Allows the embedder to return a (possibly null) URLLoaderThrottleProvider // for a frame or worker. For frames this is called on the main thread, and // for workers it's called on the worker thread.
diff --git a/content/public/test/url_loader_interceptor.cc b/content/public/test/url_loader_interceptor.cc index b229021..24923f4 100644 --- a/content/public/test/url_loader_interceptor.cc +++ b/content/public/test/url_loader_interceptor.cc
@@ -77,11 +77,6 @@ URLLoaderFactoryGetter::SetGetNetworkFactoryCallbackForTesting( URLLoaderFactoryGetter::GetNetworkFactoryCallback()); - if (!NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - NavigationURLLoaderImpl::SetURLLoaderFactoryInterceptorForTesting( - NavigationURLLoaderImpl::URLLoaderFactoryInterceptor()); - } - if (closure) std::move(closure).Run(); } @@ -469,12 +464,10 @@ &URLLoaderInterceptor::GetURLLoaderFactoryForBrowserProcess, base::Unretained(this))); - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - NavigationURLLoaderImpl::SetURLLoaderFactoryInterceptorForTesting( - base::BindRepeating( - &URLLoaderInterceptor::InterceptNavigationRequestCallback, - base::Unretained(this))); - } + NavigationURLLoaderImpl::SetURLLoaderFactoryInterceptorForTesting( + base::BindRepeating( + &URLLoaderInterceptor::InterceptNavigationRequestCallback, + base::Unretained(this))); if (BrowserThread::IsThreadInitialized(BrowserThread::IO)) { if (use_runloop_) { @@ -519,10 +512,8 @@ SetGetURLLoaderFactoryForBrowserProcessCallbackForTesting( StoragePartitionImpl::CreateNetworkFactoryCallback()); - if (NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - NavigationURLLoaderImpl::SetURLLoaderFactoryInterceptorForTesting( - NavigationURLLoaderImpl::URLLoaderFactoryInterceptor()); - } + NavigationURLLoaderImpl::SetURLLoaderFactoryInterceptorForTesting( + NavigationURLLoaderImpl::URLLoaderFactoryInterceptor()); if (use_runloop_) { base::RunLoop run_loop; @@ -683,13 +674,6 @@ &URLLoaderInterceptor::IOState::GetNetworkFactoryCallback, base::Unretained(this))); - if (!NavigationURLLoaderImpl::IsNavigationLoaderOnUIEnabled()) { - NavigationURLLoaderImpl::SetURLLoaderFactoryInterceptorForTesting( - base::BindRepeating( - &URLLoaderInterceptor::IOState::InterceptNavigationRequestCallback, - base::Unretained(this))); - } - if (closure) std::move(closure).Run(); }
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index ee1544d..3dbfff8a 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc
@@ -2012,12 +2012,6 @@ return gpu_->GetGpuChannel().get(); } -void RenderThreadImpl::CreateEmbedderRendererService( - service_manager::mojom::ServiceRequest service_request) { - GetContentClient()->renderer()->CreateRendererService( - std::move(service_request)); -} - void RenderThreadImpl::CreateView(mojom::CreateViewParamsPtr params) { CompositorDependencies* compositor_deps = this; is_scroll_animator_enabled_ = params->web_preferences.enable_scroll_animator;
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h index 82e05e9a..d7779a0 100644 --- a/content/renderer/render_thread_impl.h +++ b/content/renderer/render_thread_impl.h
@@ -506,8 +506,6 @@ void OnGetAccessibilityTree(); // mojom::Renderer: - void CreateEmbedderRendererService( - service_manager::mojom::ServiceRequest service_request) override; void CreateView(mojom::CreateViewParamsPtr params) override; void CreateFrame(mojom::CreateFrameParamsPtr params) override; void CreateFrameProxy(
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc index 118a7dc..e7e0a69 100644 --- a/content/renderer/render_view_browsertest.cc +++ b/content/renderer/render_view_browsertest.cc
@@ -77,6 +77,7 @@ #include "third_party/blink/public/platform/web_runtime_features.h" #include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/public/platform/web_url_response.h" +#include "third_party/blink/public/web/web_autofill_client.h" #include "third_party/blink/public/web/web_device_emulation_params.h" #include "third_party/blink/public/web/web_document_loader.h" #include "third_party/blink/public/web/web_frame_content_dumper.h" @@ -1291,6 +1292,59 @@ } } +TEST_F(RenderViewImplTest, ShouldSuppressKeyboardIsPropagated) { + class TestAutofillClient : public blink::WebAutofillClient { + public: + TestAutofillClient() = default; + ~TestAutofillClient() override = default; + + bool ShouldSuppressKeyboard(const blink::WebFormControlElement&) override { + return should_suppress_keyboard_; + } + + void SetShouldSuppressKeyboard(bool should_suppress_keyboard) { + should_suppress_keyboard_ = should_suppress_keyboard; + } + + private: + bool should_suppress_keyboard_ = false; + }; + + // Set-up the fake autofill client. + TestAutofillClient client; + GetMainFrame()->SetAutofillClient(&client); + + // Load an HTML page consisting of one input fields. + LoadHTML( + "<html>" + "<head>" + "</head>" + "<body>" + "<input id=\"test\" type=\"text\"></input>" + "</body>" + "</html>"); + + // Focus the text field, trigger a state update and check that the right IPC + // is sent. + ExecuteJavaScriptForTests("document.getElementById('test').focus();"); + base::RunLoop().RunUntilIdle(); + view()->GetWidget()->UpdateTextInputState(); + auto params = ProcessAndReadIPC<WidgetHostMsg_TextInputStateChanged>(); + EXPECT_FALSE(std::get<0>(params).always_hide_ime); + render_thread_->sink().ClearMessages(); + + // Tell the client to suppress the keyboard. Check whether always_hide_ime is + // set correctly. + client.SetShouldSuppressKeyboard(true); + view()->GetWidget()->UpdateTextInputState(); + params = ProcessAndReadIPC<WidgetHostMsg_TextInputStateChanged>(); + EXPECT_TRUE(std::get<0>(params).always_hide_ime); + + // Explicitly clean-up the autofill client, as otherwise a use-after-free + // happens. + GetMainFrame()->SetAutofillClient(nullptr); +} + // Test that our IME backend can compose CJK words. // Our IME front-end sends many platform-independent messages to the IME backend // while it composes CJK words. This test sends the minimal messages captured
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index 799cc64..09ef4066 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc
@@ -6,7 +6,6 @@ #include <cmath> #include <limits> -#include <memory> #include <utility> #include "base/auto_reset.h" @@ -129,10 +128,6 @@ #include "third_party/skia/include/core/SkPixelRef.h" #endif // defined(OS_POSIX) -#if defined(OS_MACOSX) -#include "content/renderer/text_input_client_observer.h" -#endif - using blink::WebImeTextSpan; using blink::WebCursorInfo; using blink::WebDeviceEmulationParams; @@ -446,33 +441,13 @@ mojom::WidgetRequest widget_request) : routing_id_(widget_routing_id), compositor_deps_(compositor_deps), - webwidget_internal_(nullptr), - auto_resize_mode_(false), is_hidden_(hidden), compositor_never_visible_(never_visible), - is_fullscreen_granted_(false), display_mode_(display_mode), - ime_event_guard_(nullptr), is_frozen_(is_frozen), - text_input_type_(ui::TEXT_INPUT_TYPE_NONE), - text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), - text_input_flags_(0), next_previous_flags_(kInvalidNextPreviousFlagsValue), - can_compose_inline_(true), - composition_range_(gfx::Range::InvalidRange()), - pending_window_rect_count_(0), screen_info_(screen_info), - monitor_composition_info_(false), - popup_origin_scale_for_emulation_(0.f), frame_swap_message_queue_(new FrameSwapMessageQueue(routing_id_)), - has_host_context_menu_location_(false), - has_focus_(false), - for_child_local_root_frame_(false), -#if defined(OS_MACOSX) - text_input_client_observer_(new TextInputClientObserver(this)), -#endif - first_update_visual_state_after_hidden_(false), - was_shown_time_(base::TimeTicks::Now()), widget_binding_(this, std::move(widget_request)) { DCHECK_NE(routing_id_, MSG_ROUTING_NONE); DCHECK(RenderThread::IsMainThread()); @@ -1493,12 +1468,19 @@ bool new_can_compose_inline = CanComposeInline(); + // Check whether the keyboard should always be hidden for the currently + // focused element. + auto* focused_frame = GetFocusedWebLocalFrameInWidget(); + bool always_hide_ime = + focused_frame && focused_frame->ShouldSuppressKeyboardForFocusedElement(); + // Only sends text input params if they are changed or if the ime should be // shown. if (show_virtual_keyboard || reply_to_request || text_input_type_ != new_type || text_input_mode_ != new_mode || text_input_info_ != new_info || - can_compose_inline_ != new_can_compose_inline) { + can_compose_inline_ != new_can_compose_inline || + always_hide_ime_ != always_hide_ime) { TextInputState params; params.type = new_type; params.mode = new_mode; @@ -1532,6 +1514,7 @@ // TODO(changwan): change instances of show_ime_if_needed to // show_virtual_keyboard. params.show_ime_if_needed = show_virtual_keyboard; + params.always_hide_ime = always_hide_ime; params.reply_to_request = reply_to_request; Send(new WidgetHostMsg_TextInputStateChanged(routing_id(), params)); @@ -1539,6 +1522,7 @@ text_input_type_ = new_type; text_input_mode_ = new_mode; can_compose_inline_ = new_can_compose_inline; + always_hide_ime_ = always_hide_ime; text_input_flags_ = new_info.flags; #if defined(OS_ANDROID)
diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h index 72ab6536..cb79cdf 100644 --- a/content/renderer/render_widget.h +++ b/content/renderer/render_widget.h
@@ -72,6 +72,10 @@ #include "ui/gfx/range/range.h" #include "ui/surface/transport_dib.h" +#if defined(OS_MACOSX) +#include "content/renderer/text_input_client_observer.h" +#endif + namespace IPC { class SyncMessageFilter; } @@ -118,7 +122,6 @@ class RenderViewImpl; class RenderWidgetDelegate; class RenderWidgetScreenMetricsEmulator; -class TextInputClientObserver; class WidgetInputHandlerManager; struct ContextMenuParams; struct VisualProperties; @@ -931,7 +934,7 @@ // Use GetWebWidget() instead of using webwidget_internal_ directly. // We are responsible for destroying this object via its Close method. // May be NULL when the window is closing. - blink::WebWidget* webwidget_internal_; + blink::WebWidget* webwidget_internal_ = nullptr; // The delegate for this object which is just a RenderViewImpl. std::unique_ptr<RenderWidgetDelegate> delegate_; @@ -959,7 +962,7 @@ // Whether the WebWidget is in auto resize mode, which is used for example // by extension popups. - bool auto_resize_mode_; + bool auto_resize_mode_ = false; // The minimum size to use for auto-resize. gfx::Size min_size_for_auto_resize_; @@ -974,14 +977,14 @@ const bool compositor_never_visible_; // Indicates whether tab-initiated fullscreen was granted. - bool is_fullscreen_granted_; + bool is_fullscreen_granted_ = false; // Indicates the display mode. blink::WebDisplayMode display_mode_; // It is possible that one ImeEventGuard is nested inside another // ImeEventGuard. We keep track of the outermost one, and update it as needed. - ImeEventGuard* ime_event_guard_; + ImeEventGuard* ime_event_guard_ = nullptr; bool closed_ = false; // True if we have requested this widget be closed. No more messages will @@ -1024,20 +1027,23 @@ blink::WebTextInputInfo text_input_info_; // Stores the current text input type of |webwidget_|. - ui::TextInputType text_input_type_; + ui::TextInputType text_input_type_ = ui::TEXT_INPUT_TYPE_NONE; // Stores the current text input mode of |webwidget_|. - ui::TextInputMode text_input_mode_; + ui::TextInputMode text_input_mode_ = ui::TEXT_INPUT_MODE_DEFAULT; // Stores the current text input flags of |webwidget_|. - int text_input_flags_; + int text_input_flags_ = 0; // Indicates whether currently focused input field has next/previous focusable // form input field. int next_previous_flags_; // Stores the current type of composition text rendering of |webwidget_|. - bool can_compose_inline_; + bool can_compose_inline_ = true; + + // Stores whether the IME should always be hidden for |webwidget_|. + bool always_hide_ime_ = false; // Stores the current selection bounds. gfx::Rect selection_focus_rect_; @@ -1047,11 +1053,11 @@ std::vector<gfx::Rect> composition_character_bounds_; // Stores the current composition range. - gfx::Range composition_range_; + gfx::Range composition_range_ = gfx::Range::InvalidRange(); // While we are waiting for the browser to update window sizes, we track the // pending size temporarily. - int pending_window_rect_count_; + int pending_window_rect_count_ = 0; gfx::Rect pending_window_rect_; // The screen rects of the view and the window that contains it. @@ -1069,7 +1075,7 @@ ScreenInfo screen_info_; // True if the IME requests updated composition info. - bool monitor_composition_info_; + bool monitor_composition_info_ = false; std::unique_ptr<RenderWidgetScreenMetricsEmulator> screen_metrics_emulator_; @@ -1077,7 +1083,7 @@ // These values are used to properly adjust popup position. gfx::Point popup_view_origin_for_emulation_; gfx::Point popup_screen_origin_for_emulation_; - float popup_origin_scale_for_emulation_; + float popup_origin_scale_for_emulation_ = 0.f; scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; @@ -1092,7 +1098,7 @@ base::ObserverList<BrowserPlugin>::Unchecked browser_plugins_; - bool has_host_context_menu_location_; + bool has_host_context_menu_location_ = false; gfx::Point host_context_menu_location_; std::unique_ptr<blink::scheduler::WebRenderWidgetSchedulingState> @@ -1119,12 +1125,12 @@ viz::LocalSurfaceIdAllocation local_surface_id_allocation_from_parent_; // Indicates whether this widget has focus. - bool has_focus_; + bool has_focus_ = false; // Whether this widget is for a child local root frame. This excludes widgets // that are not for a frame (eg popups) and excludes the widget for the main // frame (which is attached to the RenderViewImpl). - bool for_child_local_root_frame_; + bool for_child_local_root_frame_ = false; // A callback into the creator/opener of this widget, to be executed when // WebWidgetClient::Show() occurs. @@ -1133,7 +1139,8 @@ #if defined(OS_MACOSX) // Responds to IPCs from TextInputClientMac regarding getting string at given // position or range as well as finding character index at a given position. - std::unique_ptr<TextInputClientObserver> text_input_client_observer_; + std::unique_ptr<TextInputClientObserver> text_input_client_observer_ = + std::make_unique<TextInputClientObserver>(this); #endif // Stores edit commands associated to the next key event. @@ -1145,8 +1152,8 @@ // session, this info is sent to the browser along with other drag/drop info. DragEventSourceInfo possible_drag_event_info_; - bool first_update_visual_state_after_hidden_; - base::TimeTicks was_shown_time_; + bool first_update_visual_state_after_hidden_ = false; + base::TimeTicks was_shown_time_ = base::TimeTicks::Now(); // Object to record tab switch time into this RenderWidget TabSwitchTimeRecorder tab_switch_time_recorder_;
diff --git a/content/renderer/renderer_main.cc b/content/renderer/renderer_main.cc index 568b3215..4d76cdf 100644 --- a/content/renderer/renderer_main.cc +++ b/content/renderer/renderer_main.cc
@@ -10,6 +10,8 @@ #include "base/debug/debugger.h" #include "base/debug/leak_annotations.h" #include "base/i18n/rtl.h" +#include "base/message_loop/message_pump.h" +#include "base/message_loop/message_pump_type.h" #include "base/metrics/histogram_macros.h" #include "base/pending_task.h" #include "base/run_loop.h" @@ -81,12 +83,12 @@ // As long as scrollbars on Mac are painted with Cocoa, the message pump // needs to be backed by a Foundation-level loop to process NSTimers. See // http://crbug.com/306348#c24 for details. - return base::MessagePump::Create(base::MessagePump::Type::NS_RUNLOOP); + return base::MessagePump::Create(base::MessagePumpType::NS_RUNLOOP); #elif defined(OS_FUCHSIA) // Allow FIDL APIs on renderer main thread. - return base::MessagePump::Create(base::MessagePump::Type::IO); + return base::MessagePump::Create(base::MessagePumpType::IO); #else - return base::MessagePump::Create(base::MessagePump::Type::DEFAULT); + return base::MessagePump::Create(base::MessagePumpType::DEFAULT); #endif }
diff --git a/content/shell/browser/web_test/web_test_content_browser_client.cc b/content/shell/browser/web_test/web_test_content_browser_client.cc index c604956..4c639ff 100644 --- a/content/shell/browser/web_test/web_test_content_browser_client.cc +++ b/content/shell/browser/web_test/web_test_content_browser_client.cc
@@ -124,9 +124,8 @@ } void WebTestContentBrowserClient::RenderProcessWillLaunch( - RenderProcessHost* host, - service_manager::mojom::ServiceRequest* service_request) { - ShellContentBrowserClient::RenderProcessWillLaunch(host, service_request); + RenderProcessHost* host) { + ShellContentBrowserClient::RenderProcessWillLaunch(host); StoragePartition* partition = BrowserContext::GetDefaultStoragePartition(browser_context());
diff --git a/content/shell/browser/web_test/web_test_content_browser_client.h b/content/shell/browser/web_test/web_test_content_browser_client.h index 4f00217..8fe2e1d 100644 --- a/content/shell/browser/web_test/web_test_content_browser_client.h +++ b/content/shell/browser/web_test/web_test_content_browser_client.h
@@ -35,9 +35,7 @@ std::unique_ptr<FakeBluetoothChooser> GetNextFakeBluetoothChooser(); // ContentBrowserClient overrides. - void RenderProcessWillLaunch( - RenderProcessHost* host, - service_manager::mojom::ServiceRequest* service_request) override; + void RenderProcessWillLaunch(RenderProcessHost* host) override; void ExposeInterfacesToRenderer( service_manager::BinderRegistry* registry, blink::AssociatedInterfaceRegistry* associated_registry,
diff --git a/content/test/test_blink_web_unit_test_support.cc b/content/test/test_blink_web_unit_test_support.cc index d905f8d..0b2109fd 100644 --- a/content/test/test_blink_web_unit_test_support.cc +++ b/content/test/test_blink_web_unit_test_support.cc
@@ -10,6 +10,8 @@ #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" #include "base/macros.h" +#include "base/message_loop/message_pump.h" +#include "base/message_loop/message_pump_type.h" #include "base/path_service.h" #include "base/single_thread_task_runner.h" #include "base/strings/utf_string_conversions.h" @@ -165,7 +167,7 @@ DCHECK_EQ(scheduler_type, SchedulerType::kRealScheduler); main_thread_scheduler_ = blink::scheduler::WebThreadScheduler::CreateMainThreadScheduler( - base::MessagePump::Create(base::MessagePump::Type::DEFAULT)); + base::MessagePump::Create(base::MessagePumpType::DEFAULT)); base::ThreadPoolInstance::CreateAndStartWithDefaultParams( "BlinkTestSupport"); }
diff --git a/content/utility/utility_main.cc b/content/utility/utility_main.cc index 78b5331..b06e4fcd 100644 --- a/content/utility/utility_main.cc +++ b/content/utility/utility_main.cc
@@ -5,6 +5,7 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/debug/leak_annotations.h" +#include "base/message_loop/message_pump_type.h" #include "base/optional.h" #include "base/power_monitor/power_monitor.h" #include "base/run_loop.h" @@ -45,10 +46,10 @@ // Mainline routine for running as the utility process. int UtilityMain(const MainFunctionParams& parameters) { - const base::MessagePump::Type message_pump_type = + const base::MessagePumpType message_pump_type = parameters.command_line.HasSwitch(switches::kMessageLoopTypeUi) - ? base::MessagePump::Type::UI - : base::MessagePump::Type::DEFAULT; + ? base::MessagePumpType::UI + : base::MessagePumpType::DEFAULT; #if defined(OS_MACOSX) // On Mac, the TYPE_UI pump for the main thread is an NSApplication loop. In
diff --git a/device/gamepad/gamepad_provider.cc b/device/gamepad/gamepad_provider.cc index 0389dda..2e08254 100644 --- a/device/gamepad/gamepad_provider.cc +++ b/device/gamepad/gamepad_provider.cc
@@ -170,7 +170,7 @@ #if defined(OS_LINUX) // On Linux, the data fetcher needs to watch file descriptors, so the message // loop needs to be a libevent loop. - const base::MessagePumpType kMessageLoopType = base::MessagePump::Type::IO; + const base::MessagePumpType kMessageLoopType = base::MessagePumpType::IO; #elif defined(OS_ANDROID) // On Android, keeping a message loop of default type. const base::MessagePumpType kMessageLoopType = base::MessagePumpType::DEFAULT; @@ -178,7 +178,7 @@ // On Mac, the data fetcher uses IOKit which depends on CFRunLoop, so the // message loop needs to be a UI-type loop. On Windows it must be a UI loop // to properly pump the MessageWindow that captures device state. - const base::MessagePumpType kMessageLoopType = base::MessagePump::Type::UI; + const base::MessagePumpType kMessageLoopType = base::MessagePumpType::UI; #endif polling_thread_->StartWithOptions(base::Thread::Options(kMessageLoopType, 0));
diff --git a/extensions/browser/extension_registry.h b/extensions/browser/extension_registry.h index 2d2514b..ac89481 100644 --- a/extensions/browser/extension_registry.h +++ b/extensions/browser/extension_registry.h
@@ -45,6 +45,11 @@ TERMINATED = 1 << 2, BLACKLISTED = 1 << 3, BLOCKED = 1 << 4, + // Used for compatibility with ExtensionService::GetExtensionById. + // DO NOT USE THIS FOR NEW CODE! + // TODO(489687): Analyze uses of this enum and replace them with either a + // more-specific one, or EVERYTHING as appropriate. + COMPATIBILITY = ENABLED | DISABLED | BLACKLISTED | BLOCKED, EVERYTHING = (1 << 5) - 1, };
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc index 268c5b5d..1b8d6f08 100644 --- a/extensions/renderer/dispatcher.cc +++ b/extensions/renderer/dispatcher.cc
@@ -44,7 +44,6 @@ #include "extensions/common/manifest.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_handlers/background_info.h" -#include "extensions/common/manifest_handlers/content_capabilities_handler.h" #include "extensions/common/manifest_handlers/options_page_info.h" #include "extensions/common/message_bundle.h" #include "extensions/common/permissions/permission_set.h" @@ -307,7 +306,6 @@ v8_schema_registry_.get()); bindings_system_->DidCreateScriptContext(context); - UpdateBindingsForContext(context); // Inject custom JS into the platform app context. if (IsWithinPlatformApp()) { @@ -438,7 +436,6 @@ WorkerThreadDispatcher::GetV8SchemaRegistry()); worker_bindings_system->DidCreateScriptContext(context); - worker_bindings_system->UpdateBindingsForContext(context); // TODO(lazyboy): Get rid of RequireGuestViewModules() as this doesn't seem // necessary for Extension SW. @@ -967,7 +964,7 @@ // Update the available bindings for all contexts. These may have changed if // an externally_connectable extension was loaded that can connect to an // open webpage. - UpdateBindings(std::string()); + UpdateAllBindings(); } void Dispatcher::OnMessageInvoke(const std::string& extension_id, @@ -1110,7 +1107,7 @@ // Update the available bindings for the remaining contexts. These may have // changed if an externally_connectable extension is unloaded and a webpage // is no longer accessible. - UpdateBindings(""); + UpdateAllBindings(); // Invalidates the messages map for the extension in case the extension is // reloaded with a new messages map. @@ -1140,7 +1137,7 @@ UpdateOriginPermissions(*extension); } } - UpdateBindings(std::string()); + UpdateAllBindings(); } void Dispatcher::OnUpdatePermissions( @@ -1166,8 +1163,7 @@ std::move(withheld)); UpdateOriginPermissions(*extension); - bindings_system_->OnExtensionPermissionsUpdated(params.extension_id); - UpdateBindings(extension->id()); + UpdateBindingsForExtension(*extension); } void Dispatcher::OnUpdateTabSpecificPermissions(const GURL& visible_url, @@ -1265,20 +1261,28 @@ blink::WebCustomElement::AddEmbedderCustomElementName("webviewbrowserplugin"); } -void Dispatcher::UpdateBindings(const std::string& extension_id) { - script_context_set_iterator()->ForEach( - extension_id, base::BindRepeating(&Dispatcher::UpdateBindingsForContext, - // Called synchronously. - base::Unretained(this))); +void Dispatcher::UpdateAllBindings() { + bindings_system_->UpdateBindings(ExtensionId() /* all contexts */, + false /* permissions_changed */, + script_context_set_iterator()); + // TODO(crbug.com/986416): Can "externally_connectable" affect Service Worker + // ScriptContext-s in some way? We'd need to process that here if that is the + // case. } -void Dispatcher::UpdateBindingsForContext(ScriptContext* context) { - bindings_system_->UpdateBindingsForContext(context); - Feature::Context context_type = context->context_type(); - if (context_type == Feature::WEB_PAGE_CONTEXT || - context_type == Feature::BLESSED_WEB_PAGE_CONTEXT) { - UpdateContentCapabilities(context); - } +void Dispatcher::UpdateBindingsForExtension(const Extension& extension) { + bindings_system_->UpdateBindings(extension.id(), + true /* permissions_changed */, + script_context_set_iterator()); + + // Update Service Worker bindings too, if applicable. + if (!BackgroundInfo::IsServiceWorkerBased(&extension)) + return; + + const bool updated = + WorkerThreadDispatcher::Get()->UpdateBindingsForWorkers(extension.id()); + // TODO(lazyboy): When can this fail? + DCHECK(updated) << "Some or all workers failed to update bindings."; } // NOTE: please use the naming convention "foo_natives" for these. @@ -1306,27 +1310,6 @@ context); } -void Dispatcher::UpdateContentCapabilities(ScriptContext* context) { - APIPermissionSet permissions; - for (const auto& extension : - *RendererExtensionRegistry::Get()->GetMainThreadExtensionSet()) { - blink::WebLocalFrame* web_frame = context->web_frame(); - GURL url = context->url(); - // We allow about:blank pages to take on the privileges of their parents if - // they aren't sandboxed. - if (web_frame && !web_frame->GetSecurityOrigin().IsUnique()) - url = ScriptContext::GetEffectiveDocumentURL(web_frame, url, true); - const ContentCapabilitiesInfo& info = - ContentCapabilitiesInfo::Get(extension.get()); - if (info.url_patterns.MatchesURL(url)) { - APIPermissionSet new_permissions; - APIPermissionSet::Union(permissions, info.permissions, &new_permissions); - permissions = std::move(new_permissions); - } - } - context->set_content_capabilities(std::move(permissions)); -} - void Dispatcher::PopulateSourceMap() { const std::vector<JsResourceInfo> resources = GetJsResources(); for (const auto& resource : resources)
diff --git a/extensions/renderer/dispatcher.h b/extensions/renderer/dispatcher.h index 2360833..31ee4a12 100644 --- a/extensions/renderer/dispatcher.h +++ b/extensions/renderer/dispatcher.h
@@ -248,21 +248,18 @@ // Enable custom element whitelist in Apps. void EnableCustomElementWhiteList(); - // Adds or removes bindings for every context belonging to |extension_id|, or - // or all contexts if |extension_id| is empty. - void UpdateBindings(const std::string& extension_id); + // Adds or removes bindings for all contexts. + void UpdateAllBindings(); - void UpdateBindingsForContext(ScriptContext* context); + // Adds or removes bindings for every context belonging to |extension|, due to + // permissions change in the extension. + void UpdateBindingsForExtension(const Extension& extension); void RegisterNativeHandlers(ModuleSystem* module_system, ScriptContext* context, NativeExtensionBindingsSystem* bindings_system, V8SchemaRegistry* v8_schema_registry); - // Updates a web page context with any content capabilities granted by active - // extensions. - void UpdateContentCapabilities(ScriptContext* context); - // Inserts static source code into |source_map_|. void PopulateSourceMap();
diff --git a/extensions/renderer/native_extension_bindings_system.cc b/extensions/renderer/native_extension_bindings_system.cc index 208be25..425ed61 100644 --- a/extensions/renderer/native_extension_bindings_system.cc +++ b/extensions/renderer/native_extension_bindings_system.cc
@@ -17,6 +17,7 @@ #include "extensions/common/extension_messages.h" #include "extensions/common/features/feature_provider.h" #include "extensions/common/manifest_constants.h" +#include "extensions/common/manifest_handlers/content_capabilities_handler.h" #include "extensions/common/manifest_handlers/externally_connectable.h" #include "extensions/renderer/api_activity_logger.h" #include "extensions/renderer/bindings/api_binding_bridge.h" @@ -37,8 +38,10 @@ #include "extensions/renderer/renderer_extension_registry.h" #include "extensions/renderer/runtime_hooks_delegate.h" #include "extensions/renderer/script_context.h" +#include "extensions/renderer/script_context_set_iterable.h" #include "extensions/renderer/storage_area.h" #include "extensions/renderer/web_request_hooks.h" +#include "extensions/renderer/worker_thread_util.h" #include "gin/converter.h" #include "gin/handle.h" #include "gin/per_context_data.h" @@ -503,6 +506,8 @@ context->module_system()->SetJSBindingUtilGetter( base::Bind(&NativeExtensionBindingsSystem::GetJSBindingUtil, weak_factory_.GetWeakPtr())); + + UpdateBindingsForContext(context); } void NativeExtensionBindingsSystem::WillReleaseScriptContext( @@ -578,6 +583,7 @@ LogUpdateBindingsForContextTime(context->context_type(), context->IsForServiceWorker(), timer.Elapsed()); + UpdateContentCapabilities(context); return; } @@ -655,9 +661,18 @@ return ipc_message_sender_.get(); } -void NativeExtensionBindingsSystem::OnExtensionPermissionsUpdated( - const ExtensionId& id) { - feature_cache_.InvalidateExtension(id); +void NativeExtensionBindingsSystem::UpdateBindings( + const ExtensionId& extension_id, + bool permissions_changed, + ScriptContextSetIterable* script_context_set) { + if (permissions_changed) + InvalidateFeatureCache(extension_id); + script_context_set->ForEach( + extension_id, + base::BindRepeating( + &NativeExtensionBindingsSystem::UpdateBindingsForContext, + // Called synchronously. + base::Unretained(this))); } void NativeExtensionBindingsSystem::OnExtensionRemoved(const ExtensionId& id) { @@ -934,4 +949,40 @@ *binding_util_out = handle.ToV8(); } +void NativeExtensionBindingsSystem::UpdateContentCapabilities( + ScriptContext* context) { + Feature::Context context_type = context->context_type(); + if (context_type != Feature::WEB_PAGE_CONTEXT && + context_type != Feature::BLESSED_WEB_PAGE_CONTEXT) { + return; + } + + // Must be called on main thread. + DCHECK(!worker_thread_util::IsWorkerThread()); + + APIPermissionSet permissions; + for (const auto& extension : + *RendererExtensionRegistry::Get()->GetMainThreadExtensionSet()) { + blink::WebLocalFrame* web_frame = context->web_frame(); + GURL url = context->url(); + // We allow about:blank pages to take on the privileges of their parents if + // they aren't sandboxed. + if (web_frame && !web_frame->GetSecurityOrigin().IsUnique()) + url = ScriptContext::GetEffectiveDocumentURL(web_frame, url, true); + const ContentCapabilitiesInfo& info = + ContentCapabilitiesInfo::Get(extension.get()); + if (info.url_patterns.MatchesURL(url)) { + APIPermissionSet new_permissions; + APIPermissionSet::Union(permissions, info.permissions, &new_permissions); + permissions = std::move(new_permissions); + } + } + context->set_content_capabilities(std::move(permissions)); +} + +void NativeExtensionBindingsSystem::InvalidateFeatureCache( + const ExtensionId& extension_id) { + feature_cache_.InvalidateExtension(extension_id); +} + } // namespace extensions
diff --git a/extensions/renderer/native_extension_bindings_system.h b/extensions/renderer/native_extension_bindings_system.h index ab7927b0..f65141c 100644 --- a/extensions/renderer/native_extension_bindings_system.h +++ b/extensions/renderer/native_extension_bindings_system.h
@@ -20,6 +20,7 @@ class IPCMessageSender; class RequestSender; class ScriptContext; +class ScriptContextSetIterable; // The class responsible for creating extension bindings in different contexts, // permissions/availability checks, dispatching requests and handling responses, @@ -37,6 +38,7 @@ ~NativeExtensionBindingsSystem(); // Called when a new ScriptContext is created. + // Initializes the bindings for a newly created |context|. void DidCreateScriptContext(ScriptContext* context); // Called when a ScriptContext is about to be released. @@ -44,6 +46,7 @@ // Updates the bindings for a given |context|. This happens at initialization, // but also when e.g. an extension gets updated permissions. + // TODO(lazyboy): Make this private, and expose a test getter. void UpdateBindingsForContext(ScriptContext* context); // Dispatches an event with the given |name|, |event_args|, and @@ -71,8 +74,12 @@ // Returns the associated IPC message sender. IPCMessageSender* GetIPCMessageSender(); - // Called when an extension's permissions are updated. - void OnExtensionPermissionsUpdated(const ExtensionId& id); + // Adds or removes bindings for every context belonging to |extension_id|, or + // or all contexts if |extension_id| is empty. Also invalidates + // |feature_cache_| entry if |permissions_changed| = true. + void UpdateBindings(const ExtensionId& extension_id, + bool permissions_changed, + ScriptContextSetIterable* script_context_set); // Called when an extension is removed. void OnExtensionRemoved(const ExtensionId& id); @@ -127,6 +134,14 @@ void GetJSBindingUtil(v8::Local<v8::Context> context, v8::Local<v8::Value>* binding_util_out); + // Updates a web page context within |context| with any content capabilities + // granted by active extensions. + void UpdateContentCapabilities(ScriptContext* context); + + // Invalidates the cached feature availability for |extension|; called when + // bindings availability has changed (such as after a permissions change). + void InvalidateFeatureCache(const ExtensionId& extension_id); + std::unique_ptr<IPCMessageSender> ipc_message_sender_; // The APIBindingsSystem associated with this class.
diff --git a/extensions/renderer/native_extension_bindings_system_unittest.cc b/extensions/renderer/native_extension_bindings_system_unittest.cc index b541b8e..d854b31d3 100644 --- a/extensions/renderer/native_extension_bindings_system_unittest.cc +++ b/extensions/renderer/native_extension_bindings_system_unittest.cc
@@ -22,6 +22,7 @@ #include "extensions/renderer/message_target.h" #include "extensions/renderer/native_extension_bindings_system.h" #include "extensions/renderer/script_context.h" +#include "extensions/renderer/script_context_set.h" namespace extensions { @@ -827,8 +828,8 @@ extension->permissions_data()->SetPermissions( std::make_unique<PermissionSet>(), std::make_unique<PermissionSet>()); - bindings_system()->OnExtensionPermissionsUpdated(extension->id()); - bindings_system()->UpdateBindingsForContext(script_context); + bindings_system()->UpdateBindings( + extension->id(), true /* permissions_changed */, script_context_set()); { // TODO(devlin): Neither the native nor JS bindings systems clear the // property on the chrome object when an API is no longer available. This @@ -869,8 +870,8 @@ ManifestPermissionSet(), URLPatternSet(), URLPatternSet()), std::make_unique<PermissionSet>()); - bindings_system()->OnExtensionPermissionsUpdated(extension->id()); - bindings_system()->UpdateBindingsForContext(script_context); + bindings_system()->UpdateBindings( + extension->id(), true /* permissions_changed */, script_context_set()); } {
diff --git a/extensions/renderer/worker_thread_dispatcher.cc b/extensions/renderer/worker_thread_dispatcher.cc index 6c237a5e..3b1f9ac 100644 --- a/extensions/renderer/worker_thread_dispatcher.cc +++ b/extensions/renderer/worker_thread_dispatcher.cc
@@ -24,6 +24,7 @@ #include "extensions/renderer/native_renderer_messaging_service.h" #include "extensions/renderer/service_worker_data.h" #include "extensions/renderer/worker_script_context_set.h" +#include "extensions/renderer/worker_thread_util.h" namespace extensions { @@ -91,6 +92,16 @@ worker_thread_id, message); } +// static +void WorkerThreadDispatcher::UpdateBindingsOnWorkerThread( + const ExtensionId& extension_id) { + DCHECK(worker_thread_util::IsWorkerThread()); + DCHECK(!extension_id.empty()); + GetBindingsSystem()->UpdateBindings(extension_id, + true /* permissions_changed */, + Dispatcher::GetWorkerScriptContextSet()); +} + bool WorkerThreadDispatcher::OnControlMessageReceived( const IPC::Message& message) { if (HandlesMessageOnWorkerThread(message)) { @@ -115,6 +126,22 @@ return false; } +bool WorkerThreadDispatcher::UpdateBindingsForWorkers( + const ExtensionId& extension_id) { + bool success = true; + base::AutoLock lock(task_runner_map_lock_); + for (const auto& task_runner_info : task_runner_map_) { + const int worker_thread_id = task_runner_info.first; + base::TaskRunner* runner = task_runner_map_[worker_thread_id]; + bool posted = runner->PostTask( + FROM_HERE, + base::BindOnce(&WorkerThreadDispatcher::UpdateBindingsOnWorkerThread, + extension_id)); + success &= posted; + } + return success; +} + void WorkerThreadDispatcher::OnMessageReceivedOnWorkerThread( int worker_thread_id, const IPC::Message& message) {
diff --git a/extensions/renderer/worker_thread_dispatcher.h b/extensions/renderer/worker_thread_dispatcher.h index dba2ea5..b9b9970 100644 --- a/extensions/renderer/worker_thread_dispatcher.h +++ b/extensions/renderer/worker_thread_dispatcher.h
@@ -13,6 +13,7 @@ #include "base/threading/platform_thread.h" #include "content/public/renderer/render_thread_observer.h" #include "content/public/renderer/worker_thread.h" +#include "extensions/common/extension_id.h" #include "ipc/ipc_sync_message_filter.h" namespace base { @@ -79,9 +80,16 @@ // content::RenderThreadObserver: bool OnControlMessageReceived(const IPC::Message& message) override; + // Updates bindings of all Service Workers for |extension_id|, after extension + // permission update. + // Returns whether or not the update request was successfully issued to + // each Service Workers. + bool UpdateBindingsForWorkers(const ExtensionId& extension_id); + private: static bool HandlesMessageOnWorkerThread(const IPC::Message& message); static void ForwardIPC(int worker_thread_id, const IPC::Message& message); + static void UpdateBindingsOnWorkerThread(const ExtensionId& extension_id); void OnMessageReceivedOnWorkerThread(int worker_thread_id, const IPC::Message& message);
diff --git a/extensions/shell/browser/shell_content_browser_client.cc b/extensions/shell/browser/shell_content_browser_client.cc index 79846b1..cb29c84 100644 --- a/extensions/shell/browser/shell_content_browser_client.cc +++ b/extensions/shell/browser/shell_content_browser_client.cc
@@ -106,8 +106,7 @@ } void ShellContentBrowserClient::RenderProcessWillLaunch( - content::RenderProcessHost* host, - service_manager::mojom::ServiceRequest* service_request) { + content::RenderProcessHost* host) { int render_process_id = host->GetID(); BrowserContext* browser_context = browser_main_parts_->browser_context(); host->AddFilter(
diff --git a/extensions/shell/browser/shell_content_browser_client.h b/extensions/shell/browser/shell_content_browser_client.h index 5671c10..7da21b03 100644 --- a/extensions/shell/browser/shell_content_browser_client.h +++ b/extensions/shell/browser/shell_content_browser_client.h
@@ -42,9 +42,7 @@ // content::ContentBrowserClient overrides. std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts( const content::MainFunctionParams& parameters) override; - void RenderProcessWillLaunch( - content::RenderProcessHost* host, - service_manager::mojom::ServiceRequest* service_request) override; + void RenderProcessWillLaunch(content::RenderProcessHost* host) override; bool ShouldUseProcessPerSite(content::BrowserContext* browser_context, const GURL& effective_url) override; void GetQuotaSettings(
diff --git a/fuchsia/engine/context_provider_main.cc b/fuchsia/engine/context_provider_main.cc index 9d2c532..7d7a524 100644 --- a/fuchsia/engine/context_provider_main.cc +++ b/fuchsia/engine/context_provider_main.cc
@@ -7,14 +7,14 @@ #include "base/fuchsia/scoped_service_binding.h" #include "base/fuchsia/service_directory.h" #include "base/logging.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "fuchsia/base/lifecycle_impl.h" #include "fuchsia/engine/context_provider_impl.h" int ContextProviderMain() { - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); base::fuchsia::ServiceDirectory* const directory = base::fuchsia::ServiceDirectory::GetDefault();
diff --git a/fuchsia/http/http_service_main.cc b/fuchsia/http/http_service_main.cc index 81fbfc7..4d82ada4 100644 --- a/fuchsia/http/http_service_main.cc +++ b/fuchsia/http/http_service_main.cc
@@ -7,6 +7,7 @@ #include "base/command_line.h" #include "base/fuchsia/scoped_service_binding.h" #include "base/fuchsia/service_directory.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "base/task/thread_pool/thread_pool.h" @@ -16,7 +17,7 @@ // Instantiate various global structures. base::ThreadPoolInstance::CreateAndStartWithDefaultParams("HTTP Service"); base::CommandLine::Init(argc, argv); - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); base::AtExitManager exit_manager; // Bind the parent-supplied ServiceDirectory-request to a directory and
diff --git a/fuchsia/runners/cast/main.cc b/fuchsia/runners/cast/main.cc index a4b791e..07217f6 100644 --- a/fuchsia/runners/cast/main.cc +++ b/fuchsia/runners/cast/main.cc
@@ -4,12 +4,13 @@ #include "base/fuchsia/service_directory.h" #include "base/fuchsia/service_directory_client.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "fuchsia/runners/cast/cast_runner.h" int main(int argc, char** argv) { - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); base::RunLoop run_loop; CastRunner runner(base::fuchsia::ServiceDirectory::GetDefault(),
diff --git a/fuchsia/runners/web/main.cc b/fuchsia/runners/web/main.cc index dd9ad4a..7feec4a 100644 --- a/fuchsia/runners/web/main.cc +++ b/fuchsia/runners/web/main.cc
@@ -3,12 +3,13 @@ // found in the LICENSE file. #include "base/fuchsia/service_directory.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "fuchsia/runners/common/web_content_runner.h" int main(int argc, char** argv) { - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); base::RunLoop run_loop; WebContentRunner runner(base::fuchsia::ServiceDirectory::GetDefault(),
diff --git a/google_apis/gcm/tools/mcs_probe.cc b/google_apis/gcm/tools/mcs_probe.cc index 8585317..e42a53d 100644 --- a/google_apis/gcm/tools/mcs_probe.cc +++ b/google_apis/gcm/tools/mcs_probe.cc
@@ -22,6 +22,7 @@ #include "base/logging.h" #include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/strings/string_number_conversions.h" #include "base/task/single_thread_task_executor.h" @@ -446,7 +447,7 @@ mojo::core::Init(); - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); base::ThreadPoolInstance::CreateAndStartWithDefaultParams("MCSProbe"); const base::CommandLine& command_line =
diff --git a/gpu/angle_perftests_main.cc b/gpu/angle_perftests_main.cc index 4e9230b..341410b0 100644 --- a/gpu/angle_perftests_main.cc +++ b/gpu/angle_perftests_main.cc
@@ -4,6 +4,7 @@ #include "base/bind.h" #include "base/command_line.h" +#include "base/message_loop/message_pump_type.h" #include "base/task/single_thread_task_executor.h" #include "base/test/launcher/unit_test_launcher.h" #include "base/test/test_suite.h" @@ -11,7 +12,7 @@ namespace { int RunHelper(base::TestSuite* test_suite) { - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); return test_suite->Run(); }
diff --git a/gpu/angle_unittest_main.cc b/gpu/angle_unittest_main.cc index af9ac21..f418771 100644 --- a/gpu/angle_unittest_main.cc +++ b/gpu/angle_unittest_main.cc
@@ -4,6 +4,7 @@ #include "base/bind.h" #include "base/command_line.h" +#include "base/message_loop/message_pump_type.h" #include "base/task/single_thread_task_executor.h" #include "base/test/launcher/unit_test_launcher.h" #include "base/test/test_suite.h" @@ -13,7 +14,7 @@ namespace { int RunHelper(base::TestSuite* test_suite) { - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); return test_suite->Run(); }
diff --git a/gpu/command_buffer/tests/command_buffer_gles2_tests_main.cc b/gpu/command_buffer/tests/command_buffer_gles2_tests_main.cc index 931ab3c..3a55938 100644 --- a/gpu/command_buffer/tests/command_buffer_gles2_tests_main.cc +++ b/gpu/command_buffer/tests/command_buffer_gles2_tests_main.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/bind.h" +#include "base/message_loop/message_pump_type.h" #include "base/task/single_thread_task_executor.h" #if defined(OS_MACOSX) #include "base/mac/scoped_nsautorelease_pool.h" @@ -19,9 +20,9 @@ int RunHelper(base::TestSuite* testSuite) { #if defined(USE_OZONE) - base::SingleThreadTaskExecutor executor(base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor executor(base::MessagePumpType::UI); #else - base::SingleThreadTaskExecutor executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor executor(base::MessagePumpType::IO); #endif return testSuite->Run(); }
diff --git a/gpu/command_buffer/tests/lpm/gl_lpm_fuzzer.cc b/gpu/command_buffer/tests/lpm/gl_lpm_fuzzer.cc index 4164571..beb3942 100644 --- a/gpu/command_buffer/tests/lpm/gl_lpm_fuzzer.cc +++ b/gpu/command_buffer/tests/lpm/gl_lpm_fuzzer.cc
@@ -17,6 +17,7 @@ #include "base/at_exit.h" #include "base/command_line.h" #include "base/i18n/icu_util.h" +#include "base/message_loop/message_pump_type.h" #include "base/strings/string_split.h" #include "base/task/single_thread_task_executor.h" #include "gpu/command_buffer/client/gles2_lib.h" @@ -46,8 +47,7 @@ command_line->AppendSwitchASCII(switches::kUseANGLE, gl::kANGLEImplementationNullName); base::FeatureList::InitializeInstance(std::string(), std::string()); - base::SingleThreadTaskExecutor io_task_executor( - base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); gpu::GLTestHelper::InitializeGLDefault(); ::gles2::Initialize(); }
diff --git a/gpu/dawn_unittests_main.cc b/gpu/dawn_unittests_main.cc index 46f1df66..0df218c 100644 --- a/gpu/dawn_unittests_main.cc +++ b/gpu/dawn_unittests_main.cc
@@ -4,6 +4,7 @@ #include "base/bind.h" #include "base/command_line.h" +#include "base/message_loop/message_pump_type.h" #include "base/task/single_thread_task_executor.h" #include "base/test/launcher/unit_test_launcher.h" #include "base/test/test_suite.h" @@ -12,7 +13,7 @@ namespace { int RunHelper(base::TestSuite* test_suite) { - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); return test_suite->Run(); }
diff --git a/gpu/gles2_conform_support/native/main.cc b/gpu/gles2_conform_support/native/main.cc index 7ec89bd..aa80af7 100644 --- a/gpu/gles2_conform_support/native/main.cc +++ b/gpu/gles2_conform_support/native/main.cc
@@ -14,6 +14,7 @@ #if defined(OS_WIN) #include "base/strings/utf_string_conversions.h" #endif +#include "base/message_loop/message_pump_type.h" #include "base/task/single_thread_task_executor.h" #include "ui/gl/gl_surface.h" @@ -28,8 +29,7 @@ int main(int argc, char *argv[]) { base::AtExitManager at_exit; base::CommandLine::Init(argc, argv); - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); base::CommandLine::StringVector args = base::CommandLine::ForCurrentProcess()->GetArgs();
diff --git a/gpu/khronos_glcts_support/native/main.cc b/gpu/khronos_glcts_support/native/main.cc index ba55e70..94d4dbf3 100644 --- a/gpu/khronos_glcts_support/native/main.cc +++ b/gpu/khronos_glcts_support/native/main.cc
@@ -6,6 +6,7 @@ #include "base/at_exit.h" #include "base/command_line.h" +#include "base/message_loop/message_pump_type.h" #include "base/task/single_thread_task_executor.h" #include "third_party/khronos_glcts/framework/common/tcuApp.hpp" @@ -44,8 +45,7 @@ int main(int argc, char *argv[]) { base::AtExitManager at_exit; base::CommandLine::Init(argc, argv); - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); GTFMain(argc, argv);
diff --git a/gpu/perftests/run_all_tests.cc b/gpu/perftests/run_all_tests.cc index c96f59e..05bebc87 100644 --- a/gpu/perftests/run_all_tests.cc +++ b/gpu/perftests/run_all_tests.cc
@@ -5,7 +5,7 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/feature_list.h" -#include "base/message_loop/message_pump.h" +#include "base/message_loop/message_pump_type.h" #include "base/task/single_thread_task_executor.h" #include "base/test/launcher/unit_test_launcher.h" #include "base/test/test_suite.h" @@ -19,12 +19,12 @@ static int RunHelper(base::TestSuite* test_suite) { base::FeatureList::InitializeInstance(std::string(), std::string()); #if defined(USE_OZONE) - base::SingleThreadTaskExecutor executor(base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor executor(base::MessagePumpType::UI); ui::OzonePlatform::InitParams params; params.single_process = true; ui::OzonePlatform::InitializeForGPU(params); #else - base::SingleThreadTaskExecutor executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor executor(base::MessagePumpType::IO); #endif CHECK(gl::init::InitializeGLOneOff()); return test_suite->Run();
diff --git a/gpu/vulkan/demo/main.cc b/gpu/vulkan/demo/main.cc index 7a3040e..01ab1d8 100644 --- a/gpu/vulkan/demo/main.cc +++ b/gpu/vulkan/demo/main.cc
@@ -7,6 +7,7 @@ #include "base/at_exit.h" #include "base/command_line.h" #include "base/debug/stack_trace.h" +#include "base/message_loop/message_pump_type.h" #include "base/task/single_thread_task_executor.h" #include "base/task/thread_pool/thread_pool.h" #include "base/trace_event/trace_event.h" @@ -35,8 +36,7 @@ // Build UI thread task executor. This is used by platform // implementations for event polling & running background tasks. - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); base::ThreadPoolInstance::CreateAndStartWithDefaultParams("VulkanDemo"); gpu::VulkanDemo vulkan_demo;
diff --git a/infra/config/luci-notify.cfg b/infra/config/luci-notify.cfg index b6ab893..7aa0c57 100644 --- a/infra/config/luci-notify.cfg +++ b/infra/config/luci-notify.cfg
@@ -203,9 +203,7 @@ notifications { on_change: true email { - recipients: "cronet-sheriff-oncall1@google.com" - recipients: "cronet-sheriff-oncall2@google.com" - recipients: "cronet-sheriff+bot@google.com" + recipients: "cronet-bots-observer@google.com" } } builders {
diff --git a/ios/chrome/browser/browser_state/chrome_browser_state_impl_io_data.mm b/ios/chrome/browser/browser_state/chrome_browser_state_impl_io_data.mm index a407426..98fcfb66 100644 --- a/ios/chrome/browser/browser_state/chrome_browser_state_impl_io_data.mm +++ b/ios/chrome/browser/browser_state/chrome_browser_state_impl_io_data.mm
@@ -24,7 +24,7 @@ #include "ios/chrome/browser/chrome_constants.h" #include "ios/chrome/browser/ios_chrome_io_thread.h" #include "ios/chrome/browser/net/cookie_util.h" -#include "ios/chrome/browser/net/http_server_properties_manager_factory.h" +#include "ios/chrome/browser/net/http_server_properties_factory.h" #include "ios/chrome/browser/net/ios_chrome_network_delegate.h" #include "ios/chrome/browser/net/ios_chrome_url_request_context_getter.h" #include "ios/chrome/browser/pref_names.h" @@ -37,7 +37,7 @@ #include "net/cookies/cookie_store.h" #include "net/http/http_cache.h" #include "net/http/http_network_session.h" -#include "net/http/http_server_properties_manager.h" +#include "net/http/http_server_properties.h" #include "net/url_request/url_request_intercepting_job_factory.h" #include "net/url_request/url_request_job_factory_impl.h" @@ -198,8 +198,9 @@ ApplyProfileParamsToContext(main_context); - set_http_server_properties(HttpServerPropertiesManagerFactory::CreateManager( - network_json_store_, io_thread->net_log())); + set_http_server_properties( + HttpServerPropertiesFactory::CreateHttpServerProperties( + network_json_store_, io_thread->net_log())); main_context->set_transport_security_state(transport_security_state());
diff --git a/ios/chrome/browser/browser_state/off_the_record_chrome_browser_state_io_data.mm b/ios/chrome/browser/browser_state/off_the_record_chrome_browser_state_io_data.mm index e8a20c1..31d270b 100644 --- a/ios/chrome/browser/browser_state/off_the_record_chrome_browser_state_io_data.mm +++ b/ios/chrome/browser/browser_state/off_the_record_chrome_browser_state_io_data.mm
@@ -31,7 +31,7 @@ #include "net/ftp/ftp_network_layer.h" #include "net/http/http_cache.h" #include "net/http/http_network_session.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/url_request/url_request_job_factory_impl.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -168,9 +168,8 @@ main_context->set_cert_transparency_verifier( io_thread_globals->cert_transparency_verifier.get()); - // For incognito, we use the default non-persistent HttpServerPropertiesImpl. - set_http_server_properties(std::unique_ptr<net::HttpServerProperties>( - new net::HttpServerPropertiesImpl())); + // For incognito, we use the default non-persistent HttpServerProperties. + set_http_server_properties(std::make_unique<net::HttpServerProperties>()); main_context->set_http_server_properties(http_server_properties()); main_cookie_store_ = cookie_util::CreateCookieStore(
diff --git a/ios/chrome/browser/net/BUILD.gn b/ios/chrome/browser/net/BUILD.gn index bd2711a9..dce33bf5 100644 --- a/ios/chrome/browser/net/BUILD.gn +++ b/ios/chrome/browser/net/BUILD.gn
@@ -11,8 +11,8 @@ "connection_type_observer_bridge.mm", "cookie_util.h", "cookie_util.mm", - "http_server_properties_manager_factory.cc", - "http_server_properties_manager_factory.h", + "http_server_properties_factory.cc", + "http_server_properties_factory.h", "ios_chrome_http_user_agent_settings.h", "ios_chrome_http_user_agent_settings.mm", "ios_chrome_network_delegate.cc",
diff --git a/ios/chrome/browser/net/http_server_properties_manager_factory.cc b/ios/chrome/browser/net/http_server_properties_factory.cc similarity index 86% rename from ios/chrome/browser/net/http_server_properties_manager_factory.cc rename to ios/chrome/browser/net/http_server_properties_factory.cc index c1a532f..4b6d365 100644 --- a/ios/chrome/browser/net/http_server_properties_manager_factory.cc +++ b/ios/chrome/browser/net/http_server_properties_factory.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ios/chrome/browser/net/http_server_properties_manager_factory.h" +#include "ios/chrome/browser/net/http_server_properties_factory.h" #include <memory> @@ -12,13 +12,12 @@ #include "components/prefs/json_pref_store.h" #include "ios/chrome/browser/pref_names.h" #include "ios/web/public/thread/web_thread.h" -#include "net/http/http_server_properties_manager.h" +#include "net/http/http_server_properties.h" namespace { -class PrefServiceAdapter - : public net::HttpServerPropertiesManager::PrefDelegate, - public PrefStore::Observer { +class PrefServiceAdapter : public net::HttpServerProperties::PrefDelegate, + public PrefStore::Observer { public: explicit PrefServiceAdapter(scoped_refptr<JsonPrefStore> pref_store) : pref_store_(std::move(pref_store)), @@ -83,11 +82,11 @@ } // namespace // static -std::unique_ptr<net::HttpServerPropertiesManager> -HttpServerPropertiesManagerFactory::CreateManager( +std::unique_ptr<net::HttpServerProperties> +HttpServerPropertiesFactory::CreateHttpServerProperties( scoped_refptr<JsonPrefStore> pref_store, net::NetLog* net_log) { DCHECK_CURRENTLY_ON(web::WebThread::IO); - return std::make_unique<net::HttpServerPropertiesManager>( + return std::make_unique<net::HttpServerProperties>( std::make_unique<PrefServiceAdapter>(std::move(pref_store)), net_log); }
diff --git a/ios/chrome/browser/net/http_server_properties_factory.h b/ios/chrome/browser/net/http_server_properties_factory.h new file mode 100644 index 0000000..d2c11dd --- /dev/null +++ b/ios/chrome/browser/net/http_server_properties_factory.h
@@ -0,0 +1,32 @@ +// Copyright 2015 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 IOS_CHROME_BROWSER_NET_HTTP_SERVER_PROPERTIES_FACTORY_H_ +#define IOS_CHROME_BROWSER_NET_HTTP_SERVER_PROPERTIES_FACTORY_H_ + +#include <memory> + +#include "base/macros.h" +#include "base/memory/ref_counted.h" + +class JsonPrefStore; + +namespace net { +class HttpServerProperties; +class NetLog; +} // namespace net + +// Class for registration and creation of HttpServerProperties. +class HttpServerPropertiesFactory { + public: + // Create an instance of HttpServerProperties. + static std::unique_ptr<net::HttpServerProperties> CreateHttpServerProperties( + scoped_refptr<JsonPrefStore> pref_store, + net::NetLog* net_log); + + private: + DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesFactory); +}; + +#endif // IOS_CHROME_BROWSER_NET_HTTP_SERVER_PROPERTIES_FACTORY_H_
diff --git a/ios/chrome/browser/net/http_server_properties_manager_factory.h b/ios/chrome/browser/net/http_server_properties_manager_factory.h deleted file mode 100644 index 6902ea1..0000000 --- a/ios/chrome/browser/net/http_server_properties_manager_factory.h +++ /dev/null
@@ -1,32 +0,0 @@ -// Copyright 2015 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 IOS_CHROME_BROWSER_NET_HTTP_SERVER_PROPERTIES_MANAGER_FACTORY_H_ -#define IOS_CHROME_BROWSER_NET_HTTP_SERVER_PROPERTIES_MANAGER_FACTORY_H_ - -#include <memory> - -#include "base/macros.h" -#include "base/memory/ref_counted.h" - -class JsonPrefStore; - -namespace net { -class HttpServerPropertiesManager; -class NetLog; -} - -// Class for registration and creation of HttpServerPropertiesManager -class HttpServerPropertiesManagerFactory { - public: - // Create an instance of HttpServerPropertiesManager. - static std::unique_ptr<net::HttpServerPropertiesManager> CreateManager( - scoped_refptr<JsonPrefStore> pref_store, - net::NetLog* net_log); - - private: - DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesManagerFactory); -}; - -#endif // IOS_CHROME_BROWSER_NET_HTTP_SERVER_PROPERTIES_MANAGER_FACTORY_H_
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm index 8198715..5ef5c348 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_coordinator.mm
@@ -172,7 +172,6 @@ self.suggestionsViewController.audience = self; self.suggestionsViewController.overscrollDelegate = self; self.suggestionsViewController.metricsRecorder = self.metricsRecorder; - self.suggestionsViewController.containsToolbar = YES; self.suggestionsViewController.dispatcher = self.dispatcher; self.NTPMediator.consumer = self.headerController;
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_header_view_controller.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_header_view_controller.mm index e53ae4f..c2377af 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_header_view_controller.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_header_view_controller.mm
@@ -57,17 +57,6 @@ // Exposes view and methods to drive the doodle. @property(nonatomic, weak) id<LogoVendor> logoVendor; -// |YES| if the google landing toolbar can show the forward arrow, cached and -// pushed into the header view. -@property(nonatomic, assign) BOOL canGoForward; - -// |YES| if the google landing toolbar can show the back arrow, cached and -// pushed into the header view. -@property(nonatomic, assign) BOOL canGoBack; - -// The number of tabs to show in the google landing fake toolbar. -@property(nonatomic, assign) int tabCount; - @property(nonatomic, strong) ContentSuggestionsHeaderView* headerView; @property(nonatomic, strong) UIButton* fakeOmnibox; @property(nonatomic, strong) UIButton* accessibilityButton; @@ -83,19 +72,11 @@ @implementation ContentSuggestionsHeaderViewController -@synthesize dispatcher = _dispatcher; -@synthesize delegate = _delegate; -@synthesize commandHandler = _commandHandler; @synthesize collectionSynchronizer = _collectionSynchronizer; -@synthesize readingListModel = _readingListModel; -@synthesize toolbarDelegate = _toolbarDelegate; @synthesize logoVendor = _logoVendor; @synthesize promoCanShow = _promoCanShow; -@synthesize canGoForward = _canGoForward; -@synthesize canGoBack = _canGoBack; @synthesize showing = _showing; @synthesize omniboxFocused = _omniboxFocused; -@synthesize tabCount = _tabCount; @synthesize headerView = _headerView; @synthesize fakeOmnibox = _fakeOmnibox;
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h index d863214..85903be 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.h
@@ -49,11 +49,6 @@ @property(nonatomic, weak) id<ContentSuggestionsMetricsRecording> metricsRecorder; -// TODO(crbug.com/761817): Remove this code once the transition to the new -// architecture is completed. -// Whether this collection contains a toolbar. -@property(nonatomic, assign) BOOL containsToolbar; - - (void)setDataSource:(id<ContentSuggestionsDataSource>)dataSource; - (void)setDispatcher:(id<SnackbarCommands>)dispatcher;
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm index 2bc1829..92e029d1 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_view_controller.mm
@@ -66,7 +66,6 @@ @synthesize overscrollDelegate = _overscrollDelegate; @synthesize scrolledToTop = _scrolledToTop; @synthesize metricsRecorder = _metricsRecorder; -@synthesize containsToolbar = _containsToolbar; @dynamic collectionViewModel; #pragma mark - Lifecycle
diff --git a/ios/chrome/browser/ui/content_suggestions/ntp_home_consumer.h b/ios/chrome/browser/ui/content_suggestions/ntp_home_consumer.h index 712afde7..28fa74e 100644 --- a/ios/chrome/browser/ui/content_suggestions/ntp_home_consumer.h +++ b/ios/chrome/browser/ui/content_suggestions/ntp_home_consumer.h
@@ -18,15 +18,6 @@ // Exposes view and methods to drive the doodle. - (void)setLogoVendor:(id<LogoVendor>)logoVendor; -// The number of tabs to show in the NTP fake toolbar. -- (void)setTabCount:(int)tabCount; - -// |YES| if the NTP toolbar can show the forward arrow. -- (void)setCanGoForward:(BOOL)canGoForward; - -// |YES| if the NTP toolbar can show the back arrow. -- (void)setCanGoBack:(BOOL)canGoBack; - // The location bar has lost focus. - (void)locationBarResignsFirstResponder;
diff --git a/ios/chrome/browser/ui/content_suggestions/ntp_home_mediator.mm b/ios/chrome/browser/ui/content_suggestions/ntp_home_mediator.mm index 9ef5f41..69846ac 100644 --- a/ios/chrome/browser/ui/content_suggestions/ntp_home_mediator.mm +++ b/ios/chrome/browser/ui/content_suggestions/ntp_home_mediator.mm
@@ -142,16 +142,11 @@ DCHECK(!_webStateObserver); DCHECK(self.suggestionsService); - [self.consumer setTabCount:self.webStateList->count()]; self.webState = self.webStateList->GetActiveWebState(); _webStateObserver = std::make_unique<web::WebStateObserverBridge>(self); if (self.webState) { self.webState->AddObserver(_webStateObserver.get()); - web::NavigationManager* navigationManager = - self.webState->GetNavigationManager(); - [self.consumer setCanGoForward:navigationManager->CanGoForward()]; - [self.consumer setCanGoBack:navigationManager->CanGoBack()]; } [self.consumer setLogoVendor:self.logoVendor]; @@ -492,19 +487,6 @@ #pragma mark - WebStateListObserving -- (void)webStateList:(WebStateList*)webStateList - didInsertWebState:(web::WebState*)webState - atIndex:(int)index - activating:(BOOL)activating { - [self.consumer setTabCount:self.webStateList->count()]; -} - -- (void)webStateList:(WebStateList*)webStateList - didDetachWebState:(web::WebState*)webState - atIndex:(int)atIndex { - [self.consumer setTabCount:self.webStateList->count()]; -} - // If the actual webState associated with this mediator were passed in, this // would not be necessary. However, since the active webstate can change when // the new tab page is created (and animated in), listen for changes here and @@ -516,10 +498,6 @@ reason:(int)reason { if (newWebState) { self.webState = newWebState; - web::NavigationManager* navigationManager = - newWebState->GetNavigationManager(); - [self.consumer setCanGoForward:navigationManager->CanGoForward()]; - [self.consumer setCanGoBack:navigationManager->CanGoBack()]; } }
diff --git a/ios/chrome/browser/ui/content_suggestions/ntp_home_mediator_unittest.mm b/ios/chrome/browser/ui/content_suggestions/ntp_home_mediator_unittest.mm index 1354d83..3db9e50 100644 --- a/ios/chrome/browser/ui/content_suggestions/ntp_home_mediator_unittest.mm +++ b/ios/chrome/browser/ui/content_suggestions/ntp_home_mediator_unittest.mm
@@ -147,13 +147,7 @@ // Tests that the consumer has the right value set up. TEST_F(NTPHomeMediatorTest, TestConsumerSetup) { // Setup. - navigation_manager_->set_can_go_forward(true); - navigation_manager_->set_can_go_back(false); - - OCMExpect([consumer_ setTabCount:kNumberOfWebStates]); OCMExpect([consumer_ setLogoVendor:logo_vendor_]); - OCMExpect([consumer_ setCanGoForward:YES]); - OCMExpect([consumer_ setCanGoBack:NO]); OCMExpect([consumer_ setLogoIsShowing:YES]); // Action. @@ -195,63 +189,6 @@ EXPECT_OCMOCK_VERIFY(consumer_); } -// Tests that the consumer is notified when the number of tab increases. -TEST_F(NTPHomeMediatorTest, TestTabCountInsert) { - // Setup. - [mediator_ setUp]; - - OCMExpect([consumer_ setTabCount:kNumberOfWebStates + 1]); - - // Action. - auto web_state = std::make_unique<web::TestWebState>(); - web_state_list_->InsertWebState(1, std::move(web_state), - WebStateList::INSERT_FORCE_INDEX, - WebStateOpener()); - - // Test. - EXPECT_OCMOCK_VERIFY(consumer_); -} - -// Tests that the consumer is notified when the number of tab decreases. -TEST_F(NTPHomeMediatorTest, TestTabCountDetach) { - // Setup. - [mediator_ setUp]; - - OCMExpect([consumer_ setTabCount:kNumberOfWebStates - 1]); - - // Action. - web_state_list_->DetachWebStateAt(1); - - // Test. - EXPECT_OCMOCK_VERIFY(consumer_); -} - -// Tests that the consumer is notified when the active web state changes. -TEST_F(NTPHomeMediatorTest, TestChangeActiveWebState) { - // Setup. - [mediator_ setUp]; - std::unique_ptr<ToolbarTestNavigationManager> navigation_manager = - std::make_unique<ToolbarTestNavigationManager>(); - ToolbarTestNavigationManager* nav = navigation_manager.get(); - std::unique_ptr<web::TestWebState> web_state = - std::make_unique<web::TestWebState>(); - web_state->SetNavigationManager(std::move(navigation_manager)); - nav->set_can_go_back(true); - nav->set_can_go_forward(false); - web_state_list_->InsertWebState(1, std::move(web_state), - WebStateList::INSERT_FORCE_INDEX, - WebStateOpener()); - - OCMExpect([consumer_ setCanGoForward:NO]); - OCMExpect([consumer_ setCanGoBack:YES]); - - // Action. - web_state_list_->ActivateWebStateAt(1); - - // Test. - EXPECT_OCMOCK_VERIFY(consumer_); -} - // Tests that the command is sent to the dispatcher when opening the Reading // List. TEST_F(NTPHomeMediatorTest, TestOpenReadingList) {
diff --git a/ios/chrome/browser/ui/reading_list/number_badge_view.mm b/ios/chrome/browser/ui/reading_list/number_badge_view.mm index 575abc3..884c1bc 100644 --- a/ios/chrome/browser/ui/reading_list/number_badge_view.mm +++ b/ios/chrome/browser/ui/reading_list/number_badge_view.mm
@@ -102,7 +102,7 @@ [self addSubview:self.textBadge]; self.didAddSubviews = YES; [self activateConstraints]; - self.backgroundColor = [UIColor clearColor]; + self.backgroundColor = UIColor.clearColor; // Start hidden. self.alpha = 0.0; self.hidden = YES;
diff --git a/ios/chrome/browser/ui/reading_list/reading_list_toolbar_button_manager.mm b/ios/chrome/browser/ui/reading_list/reading_list_toolbar_button_manager.mm index d18cca1..c92b47c 100644 --- a/ios/chrome/browser/ui/reading_list/reading_list_toolbar_button_manager.mm +++ b/ios/chrome/browser/ui/reading_list/reading_list_toolbar_button_manager.mm
@@ -8,6 +8,7 @@ #import "ios/chrome/browser/ui/alert_coordinator/action_sheet_coordinator.h" #import "ios/chrome/browser/ui/reading_list/reading_list_toolbar_button_commands.h" #import "ios/chrome/browser/ui/reading_list/reading_list_toolbar_button_identifiers.h" +#import "ios/chrome/common/colors/semantic_color_names.h" #include "ios/chrome/grit/ios_strings.h" #include "ui/base/l10n/l10n_util_mac.h" @@ -80,7 +81,7 @@ target:nil action:@selector(deleteSelectedReadingListItems)]; _deleteButton.accessibilityIdentifier = kReadingListToolbarDeleteButtonID; - _deleteButton.tintColor = [UIColor redColor]; + _deleteButton.tintColor = [UIColor colorNamed:kRedColor]; _deleteAllReadButton = [[UIBarButtonItem alloc] initWithTitle:l10n_util::GetNSString( @@ -90,7 +91,7 @@ action:@selector(deleteAllReadReadingListItems)]; _deleteAllReadButton.accessibilityIdentifier = kReadingListToolbarDeleteAllReadButtonID; - _deleteAllReadButton.tintColor = [UIColor redColor]; + _deleteAllReadButton.tintColor = [UIColor colorNamed:kRedColor]; _cancelButton = [[UIBarButtonItem alloc] initWithTitle:l10n_util::GetNSString(IDS_IOS_READING_LIST_CANCEL_BUTTON)
diff --git a/ios/chrome/browser/ui/reading_list/text_badge_view.mm b/ios/chrome/browser/ui/reading_list/text_badge_view.mm index eb08de44..c06a6902 100644 --- a/ios/chrome/browser/ui/reading_list/text_badge_view.mm +++ b/ios/chrome/browser/ui/reading_list/text_badge_view.mm
@@ -6,6 +6,7 @@ #include "base/logging.h" #include "ios/chrome/browser/ui/util/ui_util.h" +#import "ios/chrome/common/colors/semantic_color_names.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -60,10 +61,8 @@ [self addSubview:self.label]; self.didAddSubviews = YES; [self activateConstraints]; - [self setBackgroundColor:[UIColor colorWithRed:0.101 - green:0.45 - blue:0.909 - alpha:0.1]]; + [self setBackgroundColor:[[UIColor colorNamed:kBlueColor] + colorWithAlphaComponent:0.1]]; [self setAccessibilityLabel:self.label.text]; } [super willMoveToSuperview:newSuperview]; @@ -94,8 +93,7 @@ UILabel* label = [[UILabel alloc] initWithFrame:CGRectZero]; [label setFont:[UIFont systemFontOfSize:kFontSize weight:UIFontWeightSemibold]]; - [label - setTextColor:[UIColor colorWithRed:0.101 green:0.45 blue:0.909 alpha:1]]; + [label setTextColor:[UIColor colorNamed:kBlueColor]]; [label setTranslatesAutoresizingMaskIntoConstraints:NO]; [label setText:text]; [label setTextAlignment:NSTextAlignmentCenter];
diff --git a/ios/chrome/browser/ui/signin_interaction/signin_interaction_controller_egtest.mm b/ios/chrome/browser/ui/signin_interaction/signin_interaction_controller_egtest.mm index 57c6b4af..26e58edb 100644 --- a/ios/chrome/browser/ui/signin_interaction/signin_interaction_controller_egtest.mm +++ b/ios/chrome/browser/ui/signin_interaction/signin_interaction_controller_egtest.mm
@@ -242,6 +242,8 @@ [OpenNewTabCommand commandWithURLFromChrome:GURL("about:blank")]; [chrome_test_util::DispatcherForActiveBrowserViewController() openURLInNewTab:command]; + // Wait until the page is opened. + [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; // Re-open the sign-in screen. If it wasn't correctly dismissed previously, // this will fail. @@ -309,6 +311,8 @@ [OpenNewTabCommand commandWithURLFromChrome:GURL("about:blank")]; [chrome_test_util::DispatcherForActiveBrowserViewController() openURLInNewTab:command]; + // Wait until the page is opened. + [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; // Re-open the sign-in screen. If it wasn't correctly dismissed previously, // this will fail. @@ -348,6 +352,8 @@ [OpenNewTabCommand commandWithURLFromChrome:GURL("about:blank")]; [chrome_test_util::DispatcherForActiveBrowserViewController() openURLInNewTab:command]; + // Wait until the page is opened. + [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; // Re-open the sign-in screen. If it wasn't correctly dismissed previously, // this will fail.
diff --git a/ios/chrome/browser/ui/signin_interaction/signin_interaction_controller_unity_egtest.mm b/ios/chrome/browser/ui/signin_interaction/signin_interaction_controller_unity_egtest.mm index cba1671..89a5318a 100644 --- a/ios/chrome/browser/ui/signin_interaction/signin_interaction_controller_unity_egtest.mm +++ b/ios/chrome/browser/ui/signin_interaction/signin_interaction_controller_unity_egtest.mm
@@ -240,6 +240,8 @@ [OpenNewTabCommand commandWithURLFromChrome:GURL("about:blank")]; [chrome_test_util::DispatcherForActiveBrowserViewController() openURLInNewTab:command]; + // Wait until the page is opened. + [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; // Re-open the sign-in screen. If it wasn't correctly dismissed previously, // this will fail.
diff --git a/ios/components/io_thread/ios_io_thread.mm b/ios/components/io_thread/ios_io_thread.mm index c5d1bd89..9994deec 100644 --- a/ios/components/io_thread/ios_io_thread.mm +++ b/ios/components/io_thread/ios_io_thread.mm
@@ -51,7 +51,7 @@ #include "net/http/http_auth_handler_factory.h" #include "net/http/http_auth_preferences.h" #include "net/http/http_network_layer.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/log/net_log.h" #include "net/log/net_log_event_type.h" #include "net/proxy_resolution/pac_file_fetcher_impl.h" @@ -255,7 +255,8 @@ globals_->ssl_config_service.reset(new net::SSLConfigServiceDefaults()); CreateDefaultAuthHandlerFactory(); - globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl()); + globals_->http_server_properties = + std::make_unique<net::HttpServerProperties>(); // In-memory cookie store. // TODO(crbug.com/801910): Hook up logging by passing in a non-null netlog. globals_->system_cookie_store.reset(
diff --git a/ios/public/provider/chrome/browser/signin/chrome_identity_service.h b/ios/public/provider/chrome/browser/signin/chrome_identity_service.h index a2c4ed7..ff3b8c3f 100644 --- a/ios/public/provider/chrome/browser/signin/chrome_identity_service.h +++ b/ios/public/provider/chrome/browser/signin/chrome_identity_service.h
@@ -196,6 +196,15 @@ virtual void GetHostedDomainForIdentity(ChromeIdentity* identity, GetHostedDomainCallback callback); + // DO NOT USE YET. + // Returns the identity hosted domain, for the cache only. This method + // returns: + // + nil, if the hosted domain value was yet not fetched from the server. + // + an empty string, if this is a consumer account (e.g. foo@gmail.com). + // + non-empty string, if the hosted domain was fetched and this account + // has a hosted domain. + virtual NSString* GetCachedHostedDomainForIdentity(ChromeIdentity* identity); + // Retuns the MDM device status associated with |user_info|. virtual MDMDeviceStatus GetMDMDeviceStatus(NSDictionary* user_info);
diff --git a/ios/public/provider/chrome/browser/signin/chrome_identity_service.mm b/ios/public/provider/chrome/browser/signin/chrome_identity_service.mm index a86826f..930340cb 100644 --- a/ios/public/provider/chrome/browser/signin/chrome_identity_service.mm +++ b/ios/public/provider/chrome/browser/signin/chrome_identity_service.mm
@@ -105,6 +105,11 @@ ChromeIdentity* identity, GetHostedDomainCallback callback) {} +NSString* ChromeIdentityService::GetCachedHostedDomainForIdentity( + ChromeIdentity* identity) { + return nil; +} + MDMDeviceStatus ChromeIdentityService::GetMDMDeviceStatus( NSDictionary* user_info) { return 0;
diff --git a/ios/web/init/ios_global_state.mm b/ios/web/init/ios_global_state.mm index bb209eb..2316871 100644 --- a/ios/web/init/ios_global_state.mm +++ b/ios/web/init/ios_global_state.mm
@@ -8,6 +8,7 @@ #include "base/command_line.h" #include "base/memory/ptr_util.h" #include "base/message_loop/message_loop_current.h" +#include "base/message_loop/message_pump_type.h" #include "base/task/single_thread_task_executor.h" #include "base/task/thread_pool/initialization_util.h" #include "net/base/network_change_notifier.h" @@ -45,7 +46,7 @@ // current thread. if (!base::MessageLoopCurrent::Get()) { g_task_executor = - new base::SingleThreadTaskExecutor(base::MessagePump::Type::UI); + new base::SingleThreadTaskExecutor(base::MessagePumpType::UI); } }); }
diff --git a/ios/web/shell/shell_url_request_context_getter.mm b/ios/web/shell/shell_url_request_context_getter.mm index 347b502..fe6d3f7 100644 --- a/ios/web/shell/shell_url_request_context_getter.mm +++ b/ios/web/shell/shell_url_request_context_getter.mm
@@ -25,7 +25,7 @@ #include "net/http/http_auth_handler_factory.h" #include "net/http/http_cache.h" #include "net/http/http_network_session.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/http/transport_security_persister.h" #include "net/http/transport_security_state.h" #include "net/log/net_log.h" @@ -111,8 +111,7 @@ base::CreateSequencedTaskRunnerWithTraits( {base::MayBlock(), base::TaskPriority::BEST_EFFORT})); storage_->set_http_server_properties( - std::unique_ptr<net::HttpServerProperties>( - new net::HttpServerPropertiesImpl())); + std::make_unique<net::HttpServerProperties>()); std::unique_ptr<net::HostResolver> host_resolver( net::HostResolver::CreateStandaloneResolver(
diff --git a/ios/web/web_state/ui/crw_touch_tracking_recognizer.h b/ios/web/web_state/ui/crw_touch_tracking_recognizer.h index 7da38118..09b8732 100644 --- a/ios/web/web_state/ui/crw_touch_tracking_recognizer.h +++ b/ios/web/web_state/ui/crw_touch_tracking_recognizer.h
@@ -24,7 +24,8 @@ @property(nonatomic, weak) id<CRWTouchTrackingDelegate> touchTrackingDelegate; // Designated initializer for CRWTouchTrackingRecognizer. -- (id)initWithDelegate:(id<CRWTouchTrackingDelegate>)delegate; +- (id)initWithTouchTrackingDelegate: + (id<CRWTouchTrackingDelegate>)touchTrackingDelegate; @end
diff --git a/ios/web/web_state/ui/crw_touch_tracking_recognizer.mm b/ios/web/web_state/ui/crw_touch_tracking_recognizer.mm index e9d12be..97075bc 100644 --- a/ios/web/web_state/ui/crw_touch_tracking_recognizer.mm +++ b/ios/web/web_state/ui/crw_touch_tracking_recognizer.mm
@@ -8,18 +8,15 @@ #error "This file requires ARC support." #endif -@interface CRWTouchTrackingRecognizer () <UIGestureRecognizerDelegate> { - id<CRWTouchTrackingDelegate> __weak _delegate; -} +@interface CRWTouchTrackingRecognizer () <UIGestureRecognizerDelegate> @end @implementation CRWTouchTrackingRecognizer -@synthesize touchTrackingDelegate = _delegate; - -- (id)initWithDelegate:(id<CRWTouchTrackingDelegate>)delegate { +- (id)initWithTouchTrackingDelegate: + (id<CRWTouchTrackingDelegate>)touchTrackingDelegate { if ((self = [super init])) { - _delegate = delegate; + _touchTrackingDelegate = touchTrackingDelegate; self.delegate = self; } return self; @@ -34,7 +31,7 @@ - (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event { [super touchesBegan:touches withEvent:event]; - [_delegate touched:YES]; + [self.touchTrackingDelegate touched:YES]; } - (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event { @@ -44,12 +41,12 @@ - (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event { [super touchesEnded:touches withEvent:event]; self.state = UIGestureRecognizerStateFailed; - [_delegate touched:NO]; + [self.touchTrackingDelegate touched:NO]; } - (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event { [super touchesCancelled:touches withEvent:event]; - [_delegate touched:NO]; + [self.touchTrackingDelegate touched:NO]; } #pragma mark -
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm index ed650c4..3c578df6 100644 --- a/ios/web/web_state/ui/crw_web_controller.mm +++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -539,7 +539,7 @@ - (CRWTouchTrackingRecognizer*)touchTrackingRecognizer { if (!_touchTrackingRecognizer) { _touchTrackingRecognizer = - [[CRWTouchTrackingRecognizer alloc] initWithDelegate:self]; + [[CRWTouchTrackingRecognizer alloc] initWithTouchTrackingDelegate:self]; } return _touchTrackingRecognizer; }
diff --git a/ios/web_view/internal/web_view_url_request_context_getter.mm b/ios/web_view/internal/web_view_url_request_context_getter.mm index b6bfbb2..df2949c0e 100644 --- a/ios/web_view/internal/web_view_url_request_context_getter.mm +++ b/ios/web_view/internal/web_view_url_request_context_getter.mm
@@ -24,7 +24,7 @@ #include "net/http/http_auth_handler_factory.h" #include "net/http/http_cache.h" #include "net/http/http_network_session.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/http/transport_security_persister.h" #include "net/http/transport_security_state.h" #include "net/log/net_log.h" @@ -119,8 +119,7 @@ {base::MayBlock(), base::TaskPriority::BEST_EFFORT})); storage_->set_http_server_properties( - std::unique_ptr<net::HttpServerProperties>( - new net::HttpServerPropertiesImpl())); + std::make_unique<net::HttpServerProperties>()); std::unique_ptr<net::HostResolver> host_resolver( net::HostResolver::CreateStandaloneResolver(
diff --git a/media/cast/test/sender.cc b/media/cast/test/sender.cc index 2e730378..bcae7509 100644 --- a/media/cast/test/sender.cc +++ b/media/cast/test/sender.cc
@@ -17,6 +17,7 @@ #include "base/files/file_path.h" #include "base/json/json_writer.h" #include "base/logging.h" +#include "base/message_loop/message_pump_type.h" #include "base/path_service.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" @@ -210,7 +211,7 @@ audio_thread.Start(); video_thread.Start(); - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); // Default parameters. base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
diff --git a/media/renderers/paint_canvas_video_renderer.cc b/media/renderers/paint_canvas_video_renderer.cc index 0494bca..0a572e4 100644 --- a/media/renderers/paint_canvas_video_renderer.cc +++ b/media/renderers/paint_canvas_video_renderer.cc
@@ -634,20 +634,14 @@ -SkFloatToScalar(image.height() * 0.5f)); } - // This is a workaround for crbug.com/524717. A texture backed image is not - // safe to access on another thread or GL context. So if we're drawing into a - // recording canvas we read the texture back into CPU memory and record that - // sw image into the SkPicture. The long term solution is for Skia to provide - // a SkPicture filter that makes a picture safe for multiple CPU raster - // threads. (skbug.com/4321). - if (canvas->imageInfo().colorType() == kUnknown_SkColorType && - image.IsTextureBacked()) { - sk_sp<SkImage> non_texture_image = - image.GetSkImage()->makeNonTextureImage(); - image = cc::PaintImageBuilder::WithProperties(image) - .set_image(std::move(non_texture_image), image.content_id()) - .TakePaintImage(); - } + // As we are using SharedImages to handle the image we are not using the skia + // internals to handle the image or the drawing in the canvas. The cache is + // modified to track the mailbox for the source texture, rather than a + // SkImage, to be able to import it into multiple contexts. Also the cached + // shared image is reused if possible (same context provider, same size) to + // reflect equivalent skia optimizations (SkImage pooling). See + // https://chromium-review.googlesource.com/c/chromium/src/+/1616978 + // todo(juanmihd) remove the above comment once we are sure this is not needed canvas->drawImage(image, 0, 0, &video_flags); if (need_transform)
diff --git a/mojo/core/channel_fuzzer.cc b/mojo/core/channel_fuzzer.cc index 7c1a9c5..efecdff 100644 --- a/mojo/core/channel_fuzzer.cc +++ b/mojo/core/channel_fuzzer.cc
@@ -5,6 +5,7 @@ #include <stdint.h> #include "base/bind_helpers.h" +#include "base/message_loop/message_pump_type.h" #include "base/no_destructor.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" @@ -38,7 +39,7 @@ // Message deserialization may register handles in the global handle table. We // need to initialize Core for that to be OK. struct Environment { - Environment() : main_thread_task_executor(base::MessagePump::Type::IO) { + Environment() : main_thread_task_executor(base::MessagePumpType::IO) { InitializeCore(); }
diff --git a/mojo/core/channel_mac.cc b/mojo/core/channel_mac.cc index 582b056d..b866163 100644 --- a/mojo/core/channel_mac.cc +++ b/mojo/core/channel_mac.cc
@@ -345,20 +345,22 @@ auto* header = buffer.MutableObject<mach_msg_header_t>(); *header = mach_msg_header_t{}; + std::vector<PlatformHandleInTransit> handles = message->TakeHandles(); + // Compute the total size of the message. If the message data are larger // than the allocated receive buffer, the data will be transferred out-of- // line. The receive buffer is the same size as the send buffer, but there // also needs to be room to receive the trailer. const size_t mach_header_size = sizeof(mach_msg_header_t) + sizeof(mach_msg_body_t) + - (message->num_handles() * sizeof(mach_msg_port_descriptor_t)); + (handles.size() * sizeof(mach_msg_port_descriptor_t)); const size_t expected_message_size = round_msg(mach_header_size + sizeof(uint64_t) + message->data_num_bytes() + sizeof(mach_msg_audit_trailer_t)); const bool transfer_message_ool = expected_message_size >= send_buffer_.size(); - const bool is_complex = message->has_handles() || transfer_message_ool; + const bool is_complex = !handles.empty() || transfer_message_ool; header->msgh_bits = MACH_MSGH_BITS_REMOTE(MACH_MSG_TYPE_COPY_SEND) | (is_complex ? MACH_MSGH_BITS_COMPLEX : 0); @@ -367,12 +369,11 @@ transfer_message_ool ? kChannelMacOOLMsgId : kChannelMacInlineMsgId; auto* body = buffer.MutableObject<mach_msg_body_t>(); - body->msgh_descriptor_count = message->num_handles(); + body->msgh_descriptor_count = handles.size(); - std::vector<PlatformHandleInTransit> handles = message->TakeHandles(); auto descriptors = buffer.MutableSpan<mach_msg_port_descriptor_t>(handles.size()); - for (size_t i = 0; i < message->num_handles(); ++i) { + for (size_t i = 0; i < handles.size(); ++i) { auto* descriptor = &descriptors[i]; descriptor->pad1 = 0; descriptor->pad2 = 0;
diff --git a/mojo/core/channel_mac_fuzzer.cc b/mojo/core/channel_mac_fuzzer.cc index 87674bae..8b2382a 100644 --- a/mojo/core/channel_mac_fuzzer.cc +++ b/mojo/core/channel_mac_fuzzer.cc
@@ -6,6 +6,7 @@ #include "base/logging.h" #include "base/mac/mach_logging.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "mojo/core/channel.h" @@ -30,7 +31,7 @@ } private: - base::SingleThreadTaskExecutor io_task_executor_{base::MessagePump::Type::IO}; + base::SingleThreadTaskExecutor io_task_executor_{base::MessagePumpType::IO}; }; class FakeChannelDelegate : public mojo::core::Channel::Delegate {
diff --git a/mojo/core/node_channel_fuzzer.cc b/mojo/core/node_channel_fuzzer.cc index 4cce844..4895770 100644 --- a/mojo/core/node_channel_fuzzer.cc +++ b/mojo/core/node_channel_fuzzer.cc
@@ -5,6 +5,7 @@ #include <stdint.h> #include "base/bind_helpers.h" +#include "base/message_loop/message_pump_type.h" #include "base/no_destructor.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" @@ -91,7 +92,7 @@ // Message deserialization may register handles in the global handle table. We // need to initialize Core for that to be OK. struct Environment { - Environment() : main_thread_task_executor(base::MessagePump::Type::IO) { + Environment() : main_thread_task_executor(base::MessagePumpType::IO) { InitializeCore(); }
diff --git a/mojo/public/cpp/system/README.md b/mojo/public/cpp/system/README.md index 30d3453..4db0d2c 100644 --- a/mojo/public/cpp/system/README.md +++ b/mojo/public/cpp/system/README.md
@@ -452,7 +452,7 @@ mojo::core::Init(); base::Thread ipc_thread("ipc!"); ipc_thread.StartWithOptions( - base::Thread::Options(base::MessagePump::Type::IO, 0)); + base::Thread::Options(base::MessagePumpType::IO, 0)); mojo::core::ScopedIPCSupport ipc_support( ipc_thread.task_runner(), mojo::core::ScopedIPCSupport::ShutdownPolicy::CLEAN);
diff --git a/mojo/public/tools/fuzzers/mojo_parse_message_fuzzer.cc b/mojo/public/tools/fuzzers/mojo_parse_message_fuzzer.cc index 9cd9232..d411cc2ce 100644 --- a/mojo/public/tools/fuzzers/mojo_parse_message_fuzzer.cc +++ b/mojo/public/tools/fuzzers/mojo_parse_message_fuzzer.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "base/bind.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "base/task/thread_pool/thread_pool.h" @@ -36,7 +37,7 @@ * ThreadPool, because Mojo messages must be sent and processed from * TaskRunners. */ struct Environment { - Environment() : main_thread_task_executor(base::MessagePump::Type::UI) { + Environment() : main_thread_task_executor(base::MessagePumpType::UI) { base::ThreadPoolInstance::CreateAndStartWithDefaultParams( "MojoParseMessageFuzzerProcess"); mojo::core::Init();
diff --git a/mojo/public/tools/fuzzers/mojo_parse_message_proto_fuzzer.cc b/mojo/public/tools/fuzzers/mojo_parse_message_proto_fuzzer.cc index 0ec55a8c..d20c82e 100644 --- a/mojo/public/tools/fuzzers/mojo_parse_message_proto_fuzzer.cc +++ b/mojo/public/tools/fuzzers/mojo_parse_message_proto_fuzzer.cc
@@ -6,6 +6,7 @@ // multiple messages per run. #include "base/bind.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "base/task/thread_pool/thread_pool.h" @@ -47,7 +48,7 @@ // ThreadPool, because Mojo messages must be sent and processed from // TaskRunners. struct Environment { - Environment() : main_task_executor(base::MessagePump::Type::UI) { + Environment() : main_task_executor(base::MessagePumpType::UI) { base::ThreadPoolInstance::CreateAndStartWithDefaultParams( "MojoParseMessageFuzzerProcess"); mojo::core::Init();
diff --git a/net/BUILD.gn b/net/BUILD.gn index 76fef2d3..dffc34b9 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn
@@ -744,6 +744,8 @@ "filter/source_stream.cc", "filter/source_stream.h", "filter/source_stream_type_list.h", + "http/alternative_service.cc", + "http/alternative_service.h", "http/bidirectional_stream.cc", "http/bidirectional_stream.h", "http/bidirectional_stream_impl.cc", @@ -817,8 +819,6 @@ "http/http_response_body_drainer.h", "http/http_server_properties.cc", "http/http_server_properties.h", - "http/http_server_properties_impl.cc", - "http/http_server_properties_impl.h", "http/http_server_properties_manager.cc", "http/http_server_properties_manager.h", "http/http_status_code.cc", @@ -2775,6 +2775,8 @@ "ssl/client_cert_identity_test_util.h", "ssl/ssl_private_key_test_util.cc", "ssl/ssl_private_key_test_util.h", + "ssl/test_ssl_config_service.cc", + "ssl/test_ssl_config_service.h", "ssl/test_ssl_private_key.cc", "ssl/test_ssl_private_key.h", "test/cert_test_util.cc", @@ -5215,8 +5217,8 @@ "http/http_response_headers_unittest.cc", "http/http_response_info_unittest.cc", "http/http_security_headers_unittest.cc", - "http/http_server_properties_impl_unittest.cc", "http/http_server_properties_manager_unittest.cc", + "http/http_server_properties_unittest.cc", "http/http_status_code_unittest.cc", "http/http_stream_factory_job_controller_unittest.cc", "http/http_stream_factory_unittest.cc",
diff --git a/net/cert/cert_verify_proc_builtin.cc b/net/cert/cert_verify_proc_builtin.cc index 3c9519d..131df8f9 100644 --- a/net/cert/cert_verify_proc_builtin.cc +++ b/net/cert/cert_verify_proc_builtin.cc
@@ -421,26 +421,25 @@ SimplePathBuilderDelegate::DigestPolicy digest_policy; }; -void TryBuildPath(const scoped_refptr<ParsedCertificate>& target, - CertIssuerSourceStatic* intermediates, - SystemTrustStore* ssl_trust_store, - base::Time verification_time, - base::TimeTicks deadline, - VerificationType verification_type, - SimplePathBuilderDelegate::DigestPolicy digest_policy, - int flags, - const std::string& ocsp_response, - const CRLSet* crl_set, - CertNetFetcher* net_fetcher, - const EVRootCAMetadata* ev_metadata, - CertPathBuilder::Result* result, - bool* checked_revocation) { +CertPathBuilder::Result TryBuildPath( + const scoped_refptr<ParsedCertificate>& target, + CertIssuerSourceStatic* intermediates, + SystemTrustStore* ssl_trust_store, + base::Time verification_time, + base::TimeTicks deadline, + VerificationType verification_type, + SimplePathBuilderDelegate::DigestPolicy digest_policy, + int flags, + const std::string& ocsp_response, + const CRLSet* crl_set, + CertNetFetcher* net_fetcher, + const EVRootCAMetadata* ev_metadata, + bool* checked_revocation) { der::GeneralizedTime der_verification_time; if (!der::EncodeTimeAsGeneralizedTime(verification_time, &der_verification_time)) { // This shouldn't be possible. - *result = CertPathBuilder::Result(); - return; + return CertPathBuilder::Result(); } // Path building will require candidate paths to conform to at least one of @@ -462,8 +461,7 @@ target, ssl_trust_store->GetTrustStore(), &path_builder_delegate, der_verification_time, KeyPurpose::SERVER_AUTH, InitialExplicitPolicy::kFalse, user_initial_policy_set, - InitialPolicyMappingInhibit::kFalse, InitialAnyPolicyInhibit::kFalse, - result); + InitialPolicyMappingInhibit::kFalse, InitialAnyPolicyInhibit::kFalse); // Allow the path builder to discover the explicitly provided intermediates in // |input_cert|. @@ -481,7 +479,7 @@ path_builder.SetIterationLimit(kPathBuilderIterationLimit); path_builder.SetDeadline(deadline); - path_builder.Run(); + return path_builder.Run(); } int AssignVerifyResult(X509Certificate* input_cert, @@ -652,11 +650,11 @@ verification_type = cur_attempt.verification_type; // Run the attempt through the path builder. - TryBuildPath(target, &intermediates, ssl_trust_store.get(), - verification_time, deadline, cur_attempt.verification_type, - cur_attempt.digest_policy, flags, ocsp_response, crl_set, - net_fetcher_.get(), ev_metadata, &result, - &checked_revocation_for_some_path); + result = TryBuildPath( + target, &intermediates, ssl_trust_store.get(), verification_time, + deadline, cur_attempt.verification_type, cur_attempt.digest_policy, + flags, ocsp_response, crl_set, net_fetcher_.get(), ev_metadata, + &checked_revocation_for_some_path); if (result.HasValidPath() || result.exceeded_deadline) break;
diff --git a/net/cert/internal/path_builder.cc b/net/cert/internal/path_builder.cc index fbb6f99..f4ce6d0 100644 --- a/net/cert/internal/path_builder.cc +++ b/net/cert/internal/path_builder.cc
@@ -545,8 +545,7 @@ InitialExplicitPolicy initial_explicit_policy, const std::set<der::Input>& user_initial_policy_set, InitialPolicyMappingInhibit initial_policy_mapping_inhibit, - InitialAnyPolicyInhibit initial_any_policy_inhibit, - Result* result) + InitialAnyPolicyInhibit initial_any_policy_inhibit) : cert_path_iter_(new CertPathIter(std::move(cert), trust_store)), delegate_(delegate), time_(time), @@ -554,10 +553,8 @@ initial_explicit_policy_(initial_explicit_policy), user_initial_policy_set_(user_initial_policy_set), initial_policy_mapping_inhibit_(initial_policy_mapping_inhibit), - initial_any_policy_inhibit_(initial_any_policy_inhibit), - out_result_(result) { + initial_any_policy_inhibit_(initial_any_policy_inhibit) { DCHECK(delegate); - *result = Result(); // The TrustStore also implements the CertIssuerSource interface. AddCertIssuerSource(trust_store); } @@ -577,7 +574,8 @@ deadline_ = deadline; } -void CertPathBuilder::Run() { +CertPathBuilder::Result CertPathBuilder::Run() { + Result result; uint32_t iteration_count = 0; while (true) { @@ -589,13 +587,13 @@ &iteration_count, max_iteration_count_)) { // No more paths to check. if (max_iteration_count_ > 0 && iteration_count > max_iteration_count_) { - out_result_->exceeded_iteration_limit = true; + result.exceeded_iteration_limit = true; } if (!deadline_.is_null() && base::TimeTicks::Now() > deadline_) { - out_result_->exceeded_deadline = true; + result.exceeded_deadline = true; } RecordIterationCountHistogram(iteration_count); - return; + return result; } // Verify the entire certificate chain. @@ -613,25 +611,26 @@ bool path_is_good = result_path->IsValid(); - AddResultPath(std::move(result_path)); + AddResultPath(std::move(result_path), &result); if (path_is_good) { RecordIterationCountHistogram(iteration_count); // Found a valid path, return immediately. // TODO(mattm): add debug/test mode that tries all possible paths. - return; + return result; } // Path did not verify. Try more paths. } } void CertPathBuilder::AddResultPath( - std::unique_ptr<CertPathBuilderResultPath> result_path) { + std::unique_ptr<CertPathBuilderResultPath> result_path, + Result* out_result) { // TODO(mattm): set best_result_index based on number or severity of errors. if (result_path->IsValid()) - out_result_->best_result_index = out_result_->paths.size(); + out_result->best_result_index = out_result->paths.size(); // TODO(mattm): add flag to only return a single path or all attempted paths? - out_result_->paths.push_back(std::move(result_path)); + out_result->paths.push_back(std::move(result_path)); } } // namespace net
diff --git a/net/cert/internal/path_builder.h b/net/cert/internal/path_builder.h index a48058e5..2b85280 100644 --- a/net/cert/internal/path_builder.h +++ b/net/cert/internal/path_builder.h
@@ -141,16 +141,14 @@ }; // Creates a CertPathBuilder that attempts to find a path from |cert| to a - // trust anchor in |trust_store| and is valid at |time|. Details of attempted - // path(s) are stored in |*result|. + // trust anchor in |trust_store| and is valid at |time|. // - // The caller must keep |trust_store|, |delegate| and |*result| valid for the - // lifetime of the CertPathBuilder. + // The caller must keep |trust_store| and |delegate| valid for the lifetime + // of the CertPathBuilder. // // See VerifyCertificateChain() for a more detailed explanation of the // same-named parameters not defined below. // - // * |result|: Storage for the result of path building. // * |delegate|: Must be non-null. The delegate is called at various points in // path building to verify specific parts of certificates or the // final chain. See CertPathBuilderDelegate and @@ -163,8 +161,7 @@ InitialExplicitPolicy initial_explicit_policy, const std::set<der::Input>& user_initial_policy_set, InitialPolicyMappingInhibit initial_policy_mapping_inhibit, - InitialAnyPolicyInhibit initial_any_policy_inhibit, - Result* result); + InitialAnyPolicyInhibit initial_any_policy_inhibit); ~CertPathBuilder(); // Adds a CertIssuerSource to provide intermediates for use in path building. @@ -188,13 +185,12 @@ // Executes verification of the target certificate. // - // Upon return results are written to the |result| object passed into the - // constructor. Run must not be called more than once on each CertPathBuilder - // instance. - void Run(); + // Run must not be called more than once on each CertPathBuilder instance. + Result Run(); private: - void AddResultPath(std::unique_ptr<CertPathBuilderResultPath> result_path); + void AddResultPath(std::unique_ptr<CertPathBuilderResultPath> result_path, + Result* out_result); std::unique_ptr<CertPathIter> cert_path_iter_; CertPathBuilderDelegate* delegate_; @@ -207,7 +203,7 @@ uint32_t max_iteration_count_ = 0; base::TimeTicks deadline_; - Result* out_result_; + Result out_result_; DISALLOW_COPY_AND_ASSIGN(CertPathBuilder); };
diff --git a/net/cert/internal/path_builder_pkits_unittest.cc b/net/cert/internal/path_builder_pkits_unittest.cc index cfd32f5..16ac561 100644 --- a/net/cert/internal/path_builder_pkits_unittest.cc +++ b/net/cert/internal/path_builder_pkits_unittest.cc
@@ -157,15 +157,14 @@ 1024, SimplePathBuilderDelegate::DigestPolicy::kWeakAllowSha1); } - CertPathBuilder::Result result; CertPathBuilder path_builder( std::move(target_cert), &trust_store, path_builder_delegate.get(), info.time, KeyPurpose::ANY_EKU, info.initial_explicit_policy, info.initial_policy_set, info.initial_policy_mapping_inhibit, - info.initial_inhibit_any_policy, &result); + info.initial_inhibit_any_policy); path_builder.AddCertIssuerSource(&cert_issuer_source); - path_builder.Run(); + CertPathBuilder::Result result = path_builder.Run(); if (info.should_validate != result.HasValidPath()) { for (size_t i = 0; i < result.paths.size(); ++i) {
diff --git a/net/cert/internal/path_builder_unittest.cc b/net/cert/internal/path_builder_unittest.cc index 44b4d16..770a244 100644 --- a/net/cert/internal/path_builder_unittest.cc +++ b/net/cert/internal/path_builder_unittest.cc
@@ -162,13 +162,12 @@ trust_store.AddTrustAnchor(a_by_b_); trust_store.AddTrustAnchor(b_by_f_); - CertPathBuilder::Result result; CertPathBuilder path_builder( a_by_b_, &trust_store, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); - path_builder.Run(); + auto result = path_builder.Run(); ASSERT_TRUE(result.HasValidPath()); const auto& path = *result.GetBestValidPath(); @@ -184,13 +183,12 @@ TrustStoreInMemory trust_store; trust_store.AddTrustAnchor(a_by_b_); - CertPathBuilder::Result result; CertPathBuilder path_builder( a_by_b_, &trust_store, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); - path_builder.Run(); + auto result = path_builder.Run(); EXPECT_FALSE(result.HasValidPath()); } @@ -215,14 +213,13 @@ // C(D) is not valid at this time, so path building will fail. der::GeneralizedTime expired_time = {2016, 1, 1, 0, 0, 0}; - CertPathBuilder::Result result; CertPathBuilder path_builder( b_by_c_, &trust_store, &delegate_, expired_time, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); path_builder.AddCertIssuerSource(&sync_certs); - path_builder.Run(); + auto result = path_builder.Run(); EXPECT_FALSE(result.HasValidPath()); ASSERT_EQ(1U, result.paths.size()); @@ -242,13 +239,12 @@ // This is not necessary for the test, just an extra... trust_store.AddTrustAnchor(f_by_e_); - CertPathBuilder::Result result; CertPathBuilder path_builder( e_by_e_, &trust_store, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); - path_builder.Run(); + auto result = path_builder.Run(); ASSERT_TRUE(result.HasValidPath()); @@ -266,13 +262,12 @@ TrustStoreInMemory trust_store; trust_store.AddTrustAnchor(b_by_f_); - CertPathBuilder::Result result; CertPathBuilder path_builder( a_by_b_, &trust_store, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); - path_builder.Run(); + auto result = path_builder.Run(); ASSERT_TRUE(result.HasValidPath()); const auto& path = *result.GetBestValidPath(); @@ -295,15 +290,14 @@ async_certs.AddCert(b_by_c_); async_certs.AddCert(c_by_e_); - CertPathBuilder::Result result; CertPathBuilder path_builder( a_by_b_, &trust_store, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); path_builder.AddCertIssuerSource(&async_certs); path_builder.AddCertIssuerSource(&sync_certs); - path_builder.Run(); + auto result = path_builder.Run(); EXPECT_TRUE(result.HasValidPath()); EXPECT_EQ(0, async_certs.num_async_gets()); @@ -325,16 +319,15 @@ AsyncCertIssuerSourceStatic async_certs2; async_certs2.AddCert(f_by_e_); - CertPathBuilder::Result result; CertPathBuilder path_builder( a_by_b_, &trust_store, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); path_builder.AddCertIssuerSource(&async_certs1); path_builder.AddCertIssuerSource(&async_certs2); path_builder.AddCertIssuerSource(&sync_certs); - path_builder.Run(); + auto result = path_builder.Run(); EXPECT_TRUE(result.HasValidPath()); EXPECT_EQ(1, async_certs1.num_async_gets()); @@ -354,14 +347,13 @@ sync_certs.AddCert(b_by_c_); sync_certs.AddCert(c_by_d_); - CertPathBuilder::Result result; CertPathBuilder path_builder( a_by_b_, &trust_store, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); path_builder.AddCertIssuerSource(&sync_certs); - path_builder.Run(); + auto result = path_builder.Run(); ASSERT_TRUE(result.HasValidPath()); @@ -389,15 +381,14 @@ async_certs.AddCert(b_by_c_); async_certs.AddCert(c_by_d_); - CertPathBuilder::Result result; CertPathBuilder path_builder( a_by_b_, &trust_store, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); path_builder.AddCertIssuerSource(&sync_certs); path_builder.AddCertIssuerSource(&async_certs); - path_builder.Run(); + auto result = path_builder.Run(); ASSERT_TRUE(result.HasValidPath()); @@ -430,14 +421,13 @@ sync_certs.AddCert(cert); } - CertPathBuilder::Result result; CertPathBuilder path_builder( a_by_b_, &trust_store, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); path_builder.AddCertIssuerSource(&sync_certs); - path_builder.Run(); + auto result = path_builder.Run(); ASSERT_TRUE(result.HasValidPath()); @@ -464,11 +454,10 @@ for (const bool insufficient_limit : {true, false}) { SCOPED_TRACE(insufficient_limit); - CertPathBuilder::Result result; CertPathBuilder path_builder( a_by_b_, &trust_store, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); path_builder.AddCertIssuerSource(&sync_certs); if (insufficient_limit) { @@ -483,7 +472,7 @@ } base::HistogramTester histogram_tester; - path_builder.Run(); + auto result = path_builder.Run(); EXPECT_EQ(!insufficient_limit, result.HasValidPath()); EXPECT_EQ(insufficient_limit, result.exceeded_iteration_limit); @@ -512,11 +501,10 @@ for (const bool insufficient_limit : {true, false}) { SCOPED_TRACE(insufficient_limit); - CertPathBuilder::Result result; CertPathBuilder path_builder( a_by_b_, &trust_store, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); path_builder.AddCertIssuerSource(&sync_certs); if (insufficient_limit) { @@ -532,7 +520,7 @@ base::TimeDelta::FromDays(1)); } - path_builder.Run(); + auto result = path_builder.Run(); EXPECT_EQ(!insufficient_limit, result.HasValidPath()); EXPECT_EQ(insufficient_limit, result.exceeded_deadline); @@ -619,14 +607,13 @@ sync_certs.AddCert(newintermediate_); sync_certs.AddCert(newrootrollover_); - CertPathBuilder::Result result; CertPathBuilder path_builder( target_, &trust_store, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); path_builder.AddCertIssuerSource(&sync_certs); - path_builder.Run(); + auto result = path_builder.Run(); EXPECT_TRUE(result.HasValidPath()); @@ -669,14 +656,13 @@ sync_certs.AddCert(newintermediate_); sync_certs.AddCert(newrootrollover_); - CertPathBuilder::Result result; CertPathBuilder path_builder( target_, &trust_store, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); path_builder.AddCertIssuerSource(&sync_certs); - path_builder.Run(); + auto result = path_builder.Run(); EXPECT_TRUE(result.HasValidPath()); @@ -706,13 +692,12 @@ TrustStoreInMemory trust_store; trust_store.AddTrustAnchor(newroot_); - CertPathBuilder::Result result; CertPathBuilder path_builder( target_, &trust_store, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); - path_builder.Run(); + auto result = path_builder.Run(); EXPECT_FALSE(result.HasValidPath()); @@ -739,14 +724,13 @@ CertIssuerSourceStatic sync_certs; sync_certs.AddCert(oldintermediate_); - CertPathBuilder::Result result; CertPathBuilder path_builder( target_, &trust_store_collection, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); path_builder.AddCertIssuerSource(&sync_certs); - path_builder.Run(); + auto result = path_builder.Run(); EXPECT_TRUE(result.HasValidPath()); ASSERT_EQ(2U, result.paths.size()); @@ -791,15 +775,14 @@ AsyncCertIssuerSourceStatic async_certs; async_certs.AddCert(newrootrollover_); - CertPathBuilder::Result result; CertPathBuilder path_builder( target_, &trust_store, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); path_builder.AddCertIssuerSource(&sync_certs); path_builder.AddCertIssuerSource(&async_certs); - path_builder.Run(); + auto result = path_builder.Run(); EXPECT_TRUE(result.HasValidPath()); ASSERT_EQ(3U, result.paths.size()); @@ -849,14 +832,13 @@ TrustStoreInMemory trust_store; trust_store.AddTrustAnchor(newintermediate_); - CertPathBuilder::Result result; // Newintermediate is also the target cert. CertPathBuilder path_builder( newintermediate_, &trust_store, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); - path_builder.Run(); + auto result = path_builder.Run(); EXPECT_FALSE(result.HasValidPath()); } @@ -875,15 +857,14 @@ CertIssuerSourceStatic sync_certs; sync_certs.AddCert(newrootrollover_); - CertPathBuilder::Result result; // Newroot is the target cert. CertPathBuilder path_builder( newroot_, &trust_store, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); path_builder.AddCertIssuerSource(&sync_certs); - path_builder.Run(); + auto result = path_builder.Run(); // This could actually be OK, but CertPathBuilder does not build the // newroot <- newrootrollover <- oldroot path. @@ -898,14 +879,13 @@ TrustStoreInMemory trust_store; trust_store.AddTrustAnchor(newrootrollover_); - CertPathBuilder::Result result; // Newroot is the target cert. CertPathBuilder path_builder( newroot_, &trust_store, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); - path_builder.Run(); + auto result = path_builder.Run(); ASSERT_TRUE(result.HasValidPath()); @@ -949,16 +929,15 @@ AsyncCertIssuerSourceStatic async_certs; async_certs.AddCert(newintermediate_); - CertPathBuilder::Result result; CertPathBuilder path_builder( target_, &trust_store, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); path_builder.AddCertIssuerSource(&sync_certs1); path_builder.AddCertIssuerSource(&sync_certs2); path_builder.AddCertIssuerSource(&async_certs); - path_builder.Run(); + auto result = path_builder.Run(); EXPECT_TRUE(result.HasValidPath()); ASSERT_EQ(2U, result.paths.size()); @@ -1005,14 +984,13 @@ sync_certs.AddCert(oldintermediate_); sync_certs.AddCert(newroot_dupe); - CertPathBuilder::Result result; CertPathBuilder path_builder( target_, &trust_store, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); path_builder.AddCertIssuerSource(&sync_certs); - path_builder.Run(); + auto result = path_builder.Run(); EXPECT_FALSE(result.HasValidPath()); ASSERT_EQ(1U, result.paths.size()); @@ -1081,11 +1059,10 @@ TrustStoreInMemory trust_store; trust_store.AddTrustAnchor(newroot_); - CertPathBuilder::Result result; CertPathBuilder path_builder( target_, &trust_store, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); path_builder.AddCertIssuerSource(&cert_issuer_source); // Create the mock CertIssuerSource::Request... @@ -1124,7 +1101,7 @@ EXPECT_CALL(cert_issuer_source, SyncGetIssuersOf(newintermediate_.get(), _)); // Ensure pathbuilder finished and filled result. - path_builder.Run(); + auto result = path_builder.Run(); // Note that VerifyAndClearExpectations(target_issuers_req) is not called // here. PathBuilder could have destroyed it already, so just let the @@ -1162,11 +1139,10 @@ TrustStoreInMemory trust_store; trust_store.AddTrustAnchor(newroot_); - CertPathBuilder::Result result; CertPathBuilder path_builder( target_, &trust_store, &delegate_, time_, KeyPurpose::ANY_EKU, initial_explicit_policy_, user_initial_policy_set_, - initial_policy_mapping_inhibit_, initial_any_policy_inhibit_, &result); + initial_policy_mapping_inhibit_, initial_any_policy_inhibit_); path_builder.AddCertIssuerSource(&cert_issuer_source); // Create the mock CertIssuerSource::Request... @@ -1215,7 +1191,7 @@ EXPECT_CALL(cert_issuer_source, SyncGetIssuersOf(newintermediate_.get(), _)); // Ensure pathbuilder finished and filled result. - path_builder.Run(); + auto result = path_builder.Run(); ::testing::Mock::VerifyAndClearExpectations(&cert_issuer_source); @@ -1259,11 +1235,9 @@ // Runs the path builder for the target certificate while |distrusted_cert| is // blocked, and |delegate| if non-null. - void RunPathBuilder(const scoped_refptr<ParsedCertificate>& distrusted_cert, - CertPathBuilderDelegate* optional_delegate, - CertPathBuilder::Result* result) { - ASSERT_EQ(3u, test_.chain.size()); - + CertPathBuilder::Result RunPathBuilder( + const scoped_refptr<ParsedCertificate>& distrusted_cert, + CertPathBuilderDelegate* optional_delegate) { // Set up the trust store such that |distrusted_cert| is blocked, and // the root is trusted (except if it was |distrusted_cert|). TrustStoreInMemory trust_store; @@ -1292,9 +1266,9 @@ CertPathBuilder path_builder( test_.chain.front(), &trust_store, delegate, test_.time, KeyPurpose::ANY_EKU, initial_explicit_policy, user_initial_policy_set, - initial_policy_mapping_inhibit, initial_any_policy_inhibit, result); + initial_policy_mapping_inhibit, initial_any_policy_inhibit); path_builder.AddCertIssuerSource(&intermediates); - path_builder.Run(); + return path_builder.Run(); } protected: @@ -1310,20 +1284,18 @@ protected: // Runs the path builder for the target certificate while |distrusted_cert| is // blocked. - void RunPathBuilderWithDistrustedCert( - const scoped_refptr<ParsedCertificate>& distrusted_cert, - CertPathBuilder::Result* result) { - RunPathBuilder(distrusted_cert, nullptr, result); + CertPathBuilder::Result RunPathBuilderWithDistrustedCert( + const scoped_refptr<ParsedCertificate>& distrusted_cert) { + return RunPathBuilder(distrusted_cert, nullptr); } }; // Tests that path building fails when the target, intermediate, or root are // distrusted (but the path is otherwise valid). TEST_F(PathBuilderDistrustTest, TargetIntermediateRoot) { - CertPathBuilder::Result result; // First do a control test -- path building without any blocked // certificates should work. - RunPathBuilderWithDistrustedCert(nullptr, &result); + CertPathBuilder::Result result = RunPathBuilderWithDistrustedCert(nullptr); { EXPECT_TRUE(result.HasValidPath()); // The built path should be identical the the one read from disk. @@ -1334,7 +1306,7 @@ } // Try path building when only the target is blocked - should fail. - RunPathBuilderWithDistrustedCert(test_.chain[0], &result); + result = RunPathBuilderWithDistrustedCert(test_.chain[0]); { EXPECT_FALSE(result.HasValidPath()); ASSERT_LT(result.best_result_index, result.paths.size()); @@ -1349,7 +1321,7 @@ } // Try path building when only the intermediate is blocked - should fail. - RunPathBuilderWithDistrustedCert(test_.chain[1], &result); + result = RunPathBuilderWithDistrustedCert(test_.chain[1]); { EXPECT_FALSE(result.HasValidPath()); ASSERT_LT(result.best_result_index, result.paths.size()); @@ -1365,7 +1337,7 @@ } // Try path building when only the root is blocked - should fail. - RunPathBuilderWithDistrustedCert(test_.chain[2], &result); + result = RunPathBuilderWithDistrustedCert(test_.chain[2]); { EXPECT_FALSE(result.HasValidPath()); ASSERT_LT(result.best_result_index, result.paths.size()); @@ -1405,13 +1377,11 @@ }; TEST_F(PathBuilderCheckPathAfterVerificationTest, NoOpToValidPath) { - CertPathBuilder::Result result; - StrictMock<MockPathBuilderDelegate> delegate; // Just verify that the hook is called. EXPECT_CALL(delegate, CheckPathAfterVerification(_)); - RunPathBuilder(nullptr, &delegate, &result); + CertPathBuilder::Result result = RunPathBuilder(nullptr, &delegate); EXPECT_TRUE(result.HasValidPath()); } @@ -1425,10 +1395,8 @@ }; TEST_F(PathBuilderCheckPathAfterVerificationTest, AddsWarningToValidPath) { - CertPathBuilder::Result result; - AddWarningPathBuilderDelegate delegate; - RunPathBuilder(nullptr, &delegate, &result); + CertPathBuilder::Result result = RunPathBuilder(nullptr, &delegate); ASSERT_TRUE(result.HasValidPath()); // A warning should have been added to certificate at index 1 in the path. @@ -1448,10 +1416,8 @@ }; TEST_F(PathBuilderCheckPathAfterVerificationTest, AddsErrorToValidPath) { - CertPathBuilder::Result result; - AddErrorPathBuilderDelegate delegate; - RunPathBuilder(nullptr, &delegate, &result); + CertPathBuilder::Result result = RunPathBuilder(nullptr, &delegate); // Verification failed. ASSERT_FALSE(result.HasValidPath()); @@ -1468,14 +1434,12 @@ } TEST_F(PathBuilderCheckPathAfterVerificationTest, NoopToAlreadyInvalidPath) { - CertPathBuilder::Result result; - StrictMock<MockPathBuilderDelegate> delegate; // Just verify that the hook is called (on an invalid path). EXPECT_CALL(delegate, CheckPathAfterVerification(_)); // Run the pathbuilder with certificate at index 1 actively distrusted. - RunPathBuilder(test_.chain[1], &delegate, &result); + CertPathBuilder::Result result = RunPathBuilder(test_.chain[1], &delegate); EXPECT_FALSE(result.HasValidPath()); } @@ -1491,10 +1455,8 @@ }; TEST_F(PathBuilderCheckPathAfterVerificationTest, SetsDelegateData) { - CertPathBuilder::Result result; - SetsDelegateDataPathBuilderDelegate delegate; - RunPathBuilder(nullptr, &delegate, &result); + CertPathBuilder::Result result = RunPathBuilder(nullptr, &delegate); ASSERT_TRUE(result.HasValidPath()); DelegateData* data = reinterpret_cast<DelegateData*>(
diff --git a/net/cert/internal/path_builder_verify_certificate_chain_unittest.cc b/net/cert/internal/path_builder_verify_certificate_chain_unittest.cc index 0e93720..5d68baf 100644 --- a/net/cert/internal/path_builder_verify_certificate_chain_unittest.cc +++ b/net/cert/internal/path_builder_verify_certificate_chain_unittest.cc
@@ -42,16 +42,15 @@ for (size_t i = 1; i < test.chain.size(); ++i) intermediate_cert_issuer_source.AddCert(test.chain[i]); - CertPathBuilder::Result result; // First cert in the |chain| is the target. CertPathBuilder path_builder( test.chain.front(), &trust_store, &path_builder_delegate, test.time, test.key_purpose, test.initial_explicit_policy, test.user_initial_policy_set, test.initial_policy_mapping_inhibit, - test.initial_any_policy_inhibit, &result); + test.initial_any_policy_inhibit); path_builder.AddCertIssuerSource(&intermediate_cert_issuer_source); - path_builder.Run(); + CertPathBuilder::Result result = path_builder.Run(); EXPECT_EQ(!test.HasHighSeverityErrors(), result.HasValidPath()); } };
diff --git a/net/cert_net/cert_net_fetcher_impl_unittest.cc b/net/cert_net/cert_net_fetcher_impl_unittest.cc index bf05678e..81ed4aed 100644 --- a/net/cert_net/cert_net_fetcher_impl_unittest.cc +++ b/net/cert_net/cert_net_fetcher_impl_unittest.cc
@@ -18,7 +18,7 @@ #include "net/cert/mock_cert_verifier.h" #include "net/cert/multi_log_ct_verifier.h" #include "net/dns/mock_host_resolver.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "net/test/gtest_util.h" #include "net/test/test_with_scoped_task_environment.h" @@ -60,7 +60,7 @@ storage_.set_ssl_config_service( std::make_unique<SSLConfigServiceDefaults>()); storage_.set_http_server_properties( - std::make_unique<HttpServerPropertiesImpl>()); + std::make_unique<HttpServerProperties>()); HttpNetworkSession::Context session_context; session_context.host_resolver = host_resolver();
diff --git a/net/http/alternative_service.cc b/net/http/alternative_service.cc new file mode 100644 index 0000000..3d3c933 --- /dev/null +++ b/net/http/alternative_service.cc
@@ -0,0 +1,146 @@ +// 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 "net/http/alternative_service.h" + +#include "base/logging.h" +#include "base/metrics/histogram_macros.h" +#include "base/strings/stringprintf.h" + +namespace net { + +namespace { + +enum AlternativeProxyUsage { + // Alternative Proxy was used without racing a normal connection. + ALTERNATIVE_PROXY_USAGE_NO_RACE = 0, + // Alternative Proxy was used by winning a race with a normal connection. + ALTERNATIVE_PROXY_USAGE_WON_RACE = 1, + // Alternative Proxy was not used by losing a race with a normal connection. + ALTERNATIVE_PROXY_USAGE_LOST_RACE = 2, + // Maximum value for the enum. + ALTERNATIVE_PROXY_USAGE_MAX, +}; + +AlternativeProxyUsage ConvertProtocolUsageToProxyUsage( + AlternateProtocolUsage usage) { + switch (usage) { + case ALTERNATE_PROTOCOL_USAGE_NO_RACE: + return ALTERNATIVE_PROXY_USAGE_NO_RACE; + case ALTERNATE_PROTOCOL_USAGE_WON_RACE: + return ALTERNATIVE_PROXY_USAGE_WON_RACE; + case ALTERNATE_PROTOCOL_USAGE_LOST_RACE: + return ALTERNATIVE_PROXY_USAGE_LOST_RACE; + default: + NOTREACHED(); + return ALTERNATIVE_PROXY_USAGE_MAX; + } +} + +} // anonymous namespace + +void HistogramAlternateProtocolUsage(AlternateProtocolUsage usage, + bool proxy_server_used) { + if (proxy_server_used) { + DCHECK_LE(usage, ALTERNATE_PROTOCOL_USAGE_LOST_RACE); + UMA_HISTOGRAM_ENUMERATION("Net.QuicAlternativeProxy.Usage", + ConvertProtocolUsageToProxyUsage(usage), + ALTERNATIVE_PROXY_USAGE_MAX); + } else { + UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolUsage", usage, + ALTERNATE_PROTOCOL_USAGE_MAX); + } +} + +void HistogramBrokenAlternateProtocolLocation( + BrokenAlternateProtocolLocation location) { + UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolBrokenLocation", location, + BROKEN_ALTERNATE_PROTOCOL_LOCATION_MAX); +} + +bool IsAlternateProtocolValid(NextProto protocol) { + switch (protocol) { + case kProtoUnknown: + return false; + case kProtoHTTP11: + return false; + case kProtoHTTP2: + return true; + case kProtoQUIC: + return true; + } + NOTREACHED(); + return false; +} + +// static +AlternativeServiceInfo +AlternativeServiceInfo::CreateHttp2AlternativeServiceInfo( + const AlternativeService& alternative_service, + base::Time expiration) { + DCHECK_EQ(alternative_service.protocol, kProtoHTTP2); + return AlternativeServiceInfo(alternative_service, expiration, + quic::ParsedQuicVersionVector()); +} + +// static +AlternativeServiceInfo AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( + const AlternativeService& alternative_service, + base::Time expiration, + const quic::ParsedQuicVersionVector& advertised_versions) { + DCHECK_EQ(alternative_service.protocol, kProtoQUIC); + return AlternativeServiceInfo(alternative_service, expiration, + advertised_versions); +} + +AlternativeServiceInfo::AlternativeServiceInfo() : alternative_service_() {} + +AlternativeServiceInfo::~AlternativeServiceInfo() = default; + +AlternativeServiceInfo::AlternativeServiceInfo( + const AlternativeService& alternative_service, + base::Time expiration, + const quic::ParsedQuicVersionVector& advertised_versions) + : alternative_service_(alternative_service), expiration_(expiration) { + if (alternative_service_.protocol == kProtoQUIC) { + advertised_versions_ = advertised_versions; + std::sort(advertised_versions_.begin(), advertised_versions_.end(), + TransportVersionLessThan); + } +} + +AlternativeServiceInfo::AlternativeServiceInfo( + const AlternativeServiceInfo& alternative_service_info) = default; + +AlternativeServiceInfo& AlternativeServiceInfo::operator=( + const AlternativeServiceInfo& alternative_service_info) = default; + +std::string AlternativeService::ToString() const { + return base::StringPrintf("%s %s:%d", NextProtoToString(protocol), + host.c_str(), port); +} + +std::string AlternativeServiceInfo::ToString() const { + base::Time::Exploded exploded; + expiration_.LocalExplode(&exploded); + return base::StringPrintf( + "%s, expires %04d-%02d-%02d %02d:%02d:%02d", + alternative_service_.ToString().c_str(), exploded.year, exploded.month, + exploded.day_of_month, exploded.hour, exploded.minute, exploded.second); +} + +// static +bool AlternativeServiceInfo::TransportVersionLessThan( + const quic::ParsedQuicVersion& lhs, + const quic::ParsedQuicVersion& rhs) { + return lhs.transport_version < rhs.transport_version; +} + +std::ostream& operator<<(std::ostream& os, + const AlternativeService& alternative_service) { + os << alternative_service.ToString(); + return os; +} + +} // namespace net
diff --git a/net/http/alternative_service.h b/net/http/alternative_service.h new file mode 100644 index 0000000..9073a1b --- /dev/null +++ b/net/http/alternative_service.h
@@ -0,0 +1,207 @@ +// 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. + +#ifndef NET_HTTP_ALTERNATIVE_SERVICE_H_ +#define NET_HTTP_ALTERNATIVE_SERVICE_H_ + +#include <stdint.h> + +#include <algorithm> +#include <ostream> +#include <string> + +#include "base/time/time.h" +#include "net/base/host_port_pair.h" +#include "net/base/net_export.h" +#include "net/socket/next_proto.h" +#include "net/third_party/quiche/src/quic/core/quic_versions.h" + +namespace net { + +enum AlternateProtocolUsage { + // Alternate Protocol was used without racing a normal connection. + ALTERNATE_PROTOCOL_USAGE_NO_RACE = 0, + // Alternate Protocol was used by winning a race with a normal connection. + ALTERNATE_PROTOCOL_USAGE_WON_RACE = 1, + // Alternate Protocol was not used by losing a race with a normal connection. + ALTERNATE_PROTOCOL_USAGE_LOST_RACE = 2, + // Alternate Protocol was not used because no Alternate-Protocol information + // was available when the request was issued, but an Alternate-Protocol header + // was present in the response. + ALTERNATE_PROTOCOL_USAGE_MAPPING_MISSING = 3, + // Alternate Protocol was not used because it was marked broken. + ALTERNATE_PROTOCOL_USAGE_BROKEN = 4, + // Maximum value for the enum. + ALTERNATE_PROTOCOL_USAGE_MAX, +}; + +// Log a histogram to reflect |usage|. +NET_EXPORT void HistogramAlternateProtocolUsage(AlternateProtocolUsage usage, + bool proxy_server_used); + +enum BrokenAlternateProtocolLocation { + BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_JOB = 0, + BROKEN_ALTERNATE_PROTOCOL_LOCATION_QUIC_STREAM_FACTORY = 1, + BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_JOB_ALT = 2, + BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_JOB_MAIN = 3, + BROKEN_ALTERNATE_PROTOCOL_LOCATION_QUIC_HTTP_STREAM = 4, + BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_NETWORK_TRANSACTION = 5, + BROKEN_ALTERNATE_PROTOCOL_LOCATION_MAX, +}; + +// Log a histogram to reflect |location|. +NET_EXPORT void HistogramBrokenAlternateProtocolLocation( + BrokenAlternateProtocolLocation location); + +NET_EXPORT bool IsAlternateProtocolValid(NextProto protocol); + +// (protocol, host, port) triple as defined in +// https://tools.ietf.org/id/draft-ietf-httpbis-alt-svc-06.html +// +// TODO(mmenke): Seems like most of this stuff should be de-inlined. +struct NET_EXPORT AlternativeService { + AlternativeService() : protocol(kProtoUnknown), host(), port(0) {} + + AlternativeService(NextProto protocol, const std::string& host, uint16_t port) + : protocol(protocol), host(host), port(port) {} + + AlternativeService(NextProto protocol, const HostPortPair& host_port_pair) + : protocol(protocol), + host(host_port_pair.host()), + port(host_port_pair.port()) {} + + AlternativeService(const AlternativeService& alternative_service) = default; + AlternativeService& operator=(const AlternativeService& alternative_service) = + default; + + HostPortPair host_port_pair() const { return HostPortPair(host, port); } + + bool operator==(const AlternativeService& other) const { + return protocol == other.protocol && host == other.host && + port == other.port; + } + + bool operator!=(const AlternativeService& other) const { + return !this->operator==(other); + } + + bool operator<(const AlternativeService& other) const { + return std::tie(protocol, host, port) < + std::tie(other.protocol, other.host, other.port); + } + + // Output format: "protocol host:port", e.g. "h2 www.google.com:1234". + std::string ToString() const; + + NextProto protocol; + std::string host; + uint16_t port; +}; + +NET_EXPORT_PRIVATE std::ostream& operator<<( + std::ostream& os, + const AlternativeService& alternative_service); + +struct AlternativeServiceHash { + size_t operator()(const net::AlternativeService& entry) const { + return entry.protocol ^ std::hash<std::string>()(entry.host) ^ entry.port; + } +}; + +class NET_EXPORT_PRIVATE AlternativeServiceInfo { + public: + static AlternativeServiceInfo CreateHttp2AlternativeServiceInfo( + const AlternativeService& alternative_service, + base::Time expiration); + + static AlternativeServiceInfo CreateQuicAlternativeServiceInfo( + const AlternativeService& alternative_service, + base::Time expiration, + const quic::ParsedQuicVersionVector& advertised_versions); + + AlternativeServiceInfo(); + ~AlternativeServiceInfo(); + + AlternativeServiceInfo( + const AlternativeServiceInfo& alternative_service_info); + + AlternativeServiceInfo& operator=( + const AlternativeServiceInfo& alternative_service_info); + + bool operator==(const AlternativeServiceInfo& other) const { + return alternative_service_ == other.alternative_service() && + expiration_ == other.expiration() && + advertised_versions_ == other.advertised_versions(); + } + + bool operator!=(const AlternativeServiceInfo& other) const { + return !this->operator==(other); + } + + std::string ToString() const; + + void set_alternative_service(const AlternativeService& alternative_service) { + alternative_service_ = alternative_service; + } + + void set_protocol(const NextProto& protocol) { + alternative_service_.protocol = protocol; + } + + void set_host(const std::string& host) { alternative_service_.host = host; } + + void set_port(uint16_t port) { alternative_service_.port = port; } + + void set_expiration(const base::Time& expiration) { + expiration_ = expiration; + } + + void set_advertised_versions( + const quic::ParsedQuicVersionVector& advertised_versions) { + if (alternative_service_.protocol != kProtoQUIC) + return; + + advertised_versions_ = advertised_versions; + std::sort(advertised_versions_.begin(), advertised_versions_.end(), + TransportVersionLessThan); + } + + const AlternativeService& alternative_service() const { + return alternative_service_; + } + + NextProto protocol() const { return alternative_service_.protocol; } + + HostPortPair host_port_pair() const { + return alternative_service_.host_port_pair(); + } + + base::Time expiration() const { return expiration_; } + + const quic::ParsedQuicVersionVector& advertised_versions() const { + return advertised_versions_; + } + + private: + AlternativeServiceInfo( + const AlternativeService& alternative_service, + base::Time expiration, + const quic::ParsedQuicVersionVector& advertised_versions); + + static bool TransportVersionLessThan(const quic::ParsedQuicVersion& lhs, + const quic::ParsedQuicVersion& rhs); + + AlternativeService alternative_service_; + base::Time expiration_; + + // Lists all the QUIC versions that are advertised by the server and supported + // by Chrome. If empty, defaults to versions used by the current instance of + // the netstack. + // This list MUST be sorted in ascending order. + quic::ParsedQuicVersionVector advertised_versions_; +}; + +} // namespace net + +#endif // NET_HTTP_ALTERNATIVE_SERVICE_H_
diff --git a/net/http/bidirectional_stream.cc b/net/http/bidirectional_stream.cc index 867f767..03a36f5 100644 --- a/net/http/bidirectional_stream.cc +++ b/net/http/bidirectional_stream.cc
@@ -113,7 +113,6 @@ } SSLConfig ssl_config; - session->ssl_config_service()->GetSSLConfig(&ssl_config); session->GetAlpnProtos(&ssl_config.alpn_protos); StartRequest(ssl_config);
diff --git a/net/http/broken_alternative_services.cc b/net/http/broken_alternative_services.cc index fcb9548..a9e5d6b 100644 --- a/net/http/broken_alternative_services.cc +++ b/net/http/broken_alternative_services.cc
@@ -8,7 +8,7 @@ #include "base/memory/singleton.h" #include "base/time/tick_clock.h" #include "base/time/time.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" namespace net { @@ -32,9 +32,13 @@ } // namespace BrokenAlternativeServices::BrokenAlternativeServices( + int max_recently_broken_alternative_service_entries, Delegate* delegate, const base::TickClock* clock) - : delegate_(delegate), clock_(clock) { + : delegate_(delegate), + clock_(clock), + recently_broken_alternative_services_( + max_recently_broken_alternative_service_entries) { DCHECK(delegate_); DCHECK(clock_); }
diff --git a/net/http/broken_alternative_services.h b/net/http/broken_alternative_services.h index 2d93fb4..776c0f2 100644 --- a/net/http/broken_alternative_services.h +++ b/net/http/broken_alternative_services.h
@@ -9,9 +9,11 @@ #include <set> #include <unordered_map> +#include "base/containers/mru_cache.h" #include "base/memory/weak_ptr.h" +#include "base/time/time.h" #include "base/timer/timer.h" -#include "net/http/http_server_properties.h" +#include "net/http/alternative_service.h" namespace base { class TickClock; @@ -19,12 +21,28 @@ namespace net { +// Stores broken alternative services and when their brokenness expires. +typedef std::list<std::pair<AlternativeService, base::TimeTicks>> + BrokenAlternativeServiceList; + +// Stores how many times an alternative service has been marked broken. +class RecentlyBrokenAlternativeServices + : public base::MRUCache<AlternativeService, int> { + public: + RecentlyBrokenAlternativeServices( + int max_recently_broken_alternative_service_entries) + : base::MRUCache<AlternativeService, int>( + max_recently_broken_alternative_service_entries) {} +}; + // This class tracks HTTP alternative services that have been marked as broken. // The brokenness of an alt-svc will expire after some time according to an // exponential back-off formula: each time an alt-svc is marked broken, the // expiration delay will be some constant multiple of its previous expiration // delay. This prevents broken alt-svcs from being retried too often by the // network stack. +// +// Intended solely for use by HttpServerProperties. class NET_EXPORT_PRIVATE BrokenAlternativeServices { public: // Delegate to be used by owner so it can be notified when the brokenness of @@ -42,7 +60,9 @@ // |clock| is used for setting expiration times and scheduling the // expiration of broken alternative services. It must not be null. // |delegate| and |clock| are both unowned and must outlive this. - BrokenAlternativeServices(Delegate* delegate, const base::TickClock* clock); + BrokenAlternativeServices(int max_recently_broken_alternative_service_entries, + Delegate* delegate, + const base::TickClock* clock); BrokenAlternativeServices(const BrokenAlternativeServices&) = delete; void operator=(const BrokenAlternativeServices&) = delete; @@ -114,9 +134,9 @@ recently_broken_alternative_services() const; private: - // TODO (wangyix): modify HttpServerPropertiesImpl unit tests so this - // friendness is no longer required. - friend class HttpServerPropertiesImplPeer; + // TODO (wangyix): modify HttpServerProperties unit tests so this friendness + // is no longer required. + friend class HttpServerPropertiesPeer; struct AlternativeServiceHash { size_t operator()(const net::AlternativeService& entry) const {
diff --git a/net/http/broken_alternative_services_unittest.cc b/net/http/broken_alternative_services_unittest.cc index bff016e..bff1d195 100644 --- a/net/http/broken_alternative_services_unittest.cc +++ b/net/http/broken_alternative_services_unittest.cc
@@ -26,7 +26,7 @@ : test_task_runner_(new base::TestMockTimeTaskRunner()), test_task_runner_context_(test_task_runner_), broken_services_clock_(test_task_runner_->GetMockTickClock()), - broken_services_(this, broken_services_clock_) {} + broken_services_(50, this, broken_services_clock_) {} // BrokenAlternativeServices::Delegate implementation void OnExpireBrokenAlternativeService( @@ -640,7 +640,7 @@ {alternative_service1, broken_services_clock_->NowTicks() + delay1}); std::unique_ptr<RecentlyBrokenAlternativeServices> recently_broken_map = - std::make_unique<RecentlyBrokenAlternativeServices>(); + std::make_unique<RecentlyBrokenAlternativeServices>(10); recently_broken_map->Put(alternative_service1, 1); recently_broken_map->Put(alternative_service2, 2); @@ -701,7 +701,7 @@ broken_services_clock_->NowTicks() + base::TimeDelta::FromMinutes(1)}); std::unique_ptr<RecentlyBrokenAlternativeServices> recently_broken_map = - std::make_unique<RecentlyBrokenAlternativeServices>(); + std::make_unique<RecentlyBrokenAlternativeServices>(10); recently_broken_map->Put(alternative_service1, 1); recently_broken_map->Put(alternative_service3, 1); @@ -822,7 +822,7 @@ broken_services_clock_->NowTicks() + base::TimeDelta::FromMinutes(1)}); std::unique_ptr<RecentlyBrokenAlternativeServices> recently_broken_map = - std::make_unique<RecentlyBrokenAlternativeServices>(); + std::make_unique<RecentlyBrokenAlternativeServices>(10); recently_broken_map->Put(alternative_service2, 2); broken_services_.SetBrokenAndRecentlyBrokenAlternativeServices(
diff --git a/net/http/http_network_layer.cc b/net/http/http_network_layer.cc index 1c835fa6d..14b8ebad2 100644 --- a/net/http/http_network_layer.cc +++ b/net/http/http_network_layer.cc
@@ -11,7 +11,7 @@ #include "base/strings/string_util.h" #include "net/http/http_network_session.h" #include "net/http/http_network_transaction.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/http/http_stream_factory_job.h" #include "net/spdy/spdy_session.h" #include "net/spdy/spdy_session_pool.h"
diff --git a/net/http/http_network_layer_unittest.cc b/net/http/http_network_layer_unittest.cc index 0f651458..6eb65a3 100644 --- a/net/http/http_network_layer_unittest.cc +++ b/net/http/http_network_layer_unittest.cc
@@ -12,7 +12,7 @@ #include "net/cert/multi_log_ct_verifier.h" #include "net/dns/mock_host_resolver.h" #include "net/http/http_network_session.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/http/http_transaction_test_util.h" #include "net/http/transport_security_state.h" #include "net/log/net_log_with_source.h" @@ -275,7 +275,7 @@ std::unique_ptr<HttpNetworkLayer> factory_; private: - HttpServerPropertiesImpl http_server_properties_; + HttpServerProperties http_server_properties_; }; TEST_F(HttpNetworkLayerTest, CreateAndDestroy) {
diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc index 93e89e46..4ce2d3fe 100644 --- a/net/http/http_network_session.cc +++ b/net/http/http_network_session.cc
@@ -139,7 +139,8 @@ proxy_resolution_service_(context.proxy_resolution_service), ssl_config_service_(context.ssl_config_service), ssl_client_session_cache_(SSLClientSessionCache::Config()), - ssl_client_context_(context.cert_verifier, + ssl_client_context_(context.ssl_config_service, + context.cert_verifier, context.transport_security_state, context.cert_transparency_verifier, context.ct_policy_enforcer, @@ -165,7 +166,7 @@ : quic::QuicChromiumClock::GetInstance(), params.quic_params), spdy_session_pool_(context.host_resolver, - context.ssl_config_service, + &ssl_client_context_, context.http_server_properties, context.transport_security_state, params.quic_params.supported_versions, @@ -186,12 +187,12 @@ normal_socket_pool_manager_ = std::make_unique<ClientSocketPoolManagerImpl>( CreateCommonConnectJobParams(false /* for_websockets */), CreateCommonConnectJobParams(true /* for_websockets */), - context_.ssl_config_service, NORMAL_SOCKET_POOL); + NORMAL_SOCKET_POOL); websocket_socket_pool_manager_ = std::make_unique<ClientSocketPoolManagerImpl>( CreateCommonConnectJobParams(false /* for_websockets */), CreateCommonConnectJobParams(true /* for_websockets */), - context_.ssl_config_service, WEBSOCKET_SOCKET_POOL); + WEBSOCKET_SOCKET_POOL); if (params_.enable_http2) next_protos_.push_back(kProtoHTTP2); @@ -376,7 +377,6 @@ void HttpNetworkSession::GetSSLConfig(const HttpRequestInfo& request, SSLConfig* server_config, SSLConfig* proxy_config) const { - ssl_config_service_->GetSSLConfig(server_config); GetAlpnProtos(&server_config->alpn_protos); server_config->ignore_certificate_errors = params_.ignore_certificate_errors; *proxy_config = *server_config;
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index 7bd3fff..eb38d764 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc
@@ -69,7 +69,7 @@ #include "net/http/http_proxy_connect_job.h" #include "net/http/http_request_headers.h" #include "net/http/http_response_info.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/http/http_stream.h" #include "net/http/http_stream_factory.h" #include "net/http/http_transaction_test_util.h" @@ -104,6 +104,7 @@ #include "net/ssl/ssl_config_service.h" #include "net/ssl/ssl_info.h" #include "net/ssl/ssl_private_key.h" +#include "net/ssl/test_ssl_config_service.h" #include "net/test/cert_test_util.h" #include "net/test/gtest_util.h" #include "net/test/test_data_directory.h" @@ -348,27 +349,6 @@ } }; -class TestSSLConfigService : public SSLConfigService { - public: - explicit TestSSLConfigService(const SSLConfig& config) : config_(config) {} - ~TestSSLConfigService() override = default; - - void GetSSLConfig(SSLConfig* config) override { *config = config_; } - - bool CanShareConnectionWithClientCerts( - const std::string& hostname) const override { - return false; - } - - void UpdateSSLConfigAndNotify(const SSLConfig& config) { - config_ = config; - NotifySSLConfigChange(); - } - - private: - SSLConfig config_; -}; - } // namespace class HttpNetworkTransactionTest : public PlatformTest, @@ -673,8 +653,7 @@ base::TimeDelta(), ProxyServer::Direct(), false /* is_for_websockets */, - common_connect_job_params, - nullptr /* ssl_config_service */) {} + common_connect_job_params) {} const ClientSocketPool::GroupId& last_group_id_received() const { return last_group_id_; @@ -7721,7 +7700,7 @@ ProxyResolutionService::CreateFixedFromPacResult( "PROXY server", TRAFFIC_ANNOTATION_FOR_TESTS); - SSLConfig config; + SSLContextConfig config; session_deps_.ssl_config_service = std::make_unique<TestSSLConfigService>(config); @@ -14344,7 +14323,7 @@ 1, // Max sockets per group base::TimeDelta::FromSeconds(10), // unused_idle_socket_timeout ProxyServer::Direct(), false, // is_for_websockets - &common_connect_job_params, session_deps_.ssl_config_service.get()); + &common_connect_job_params); auto mock_pool_manager = std::make_unique<MockClientSocketPoolManager>(); mock_pool_manager->SetSocketPool(ProxyServer::Direct(), base::WrapUnique(transport_pool)); @@ -21433,9 +21412,10 @@ // Test that SSLConfig changes from SSLConfigService are picked up even when // there are live sockets. TEST_F(HttpNetworkTransactionTest, SSLConfigChanged) { - SSLConfig ssl_config; - ssl_config.version_max = SSL_PROTOCOL_VERSION_TLS1_3; - auto ssl_config_service = std::make_unique<TestSSLConfigService>(ssl_config); + SSLContextConfig ssl_context_config; + ssl_context_config.version_max = SSL_PROTOCOL_VERSION_TLS1_3; + auto ssl_config_service = + std::make_unique<TestSSLConfigService>(ssl_context_config); TestSSLConfigService* ssl_config_service_raw = ssl_config_service.get(); session_deps_.ssl_config_service = std::move(ssl_config_service); @@ -21526,8 +21506,8 @@ EXPECT_EQ("2", response_data2); trans2.reset(); - ssl_config.version_max = SSL_PROTOCOL_VERSION_TLS1_2; - ssl_config_service_raw->UpdateSSLConfigAndNotify(ssl_config); + ssl_context_config.version_max = SSL_PROTOCOL_VERSION_TLS1_2; + ssl_config_service_raw->UpdateSSLConfigAndNotify(ssl_context_config); auto trans3 = std::make_unique<HttpNetworkTransaction>(DEFAULT_PRIORITY, session.get()); @@ -21540,9 +21520,10 @@ } TEST_F(HttpNetworkTransactionTest, SSLConfigChangedPendingConnect) { - SSLConfig ssl_config; - ssl_config.version_max = SSL_PROTOCOL_VERSION_TLS1_3; - auto ssl_config_service = std::make_unique<TestSSLConfigService>(ssl_config); + SSLContextConfig ssl_context_config; + ssl_context_config.version_max = SSL_PROTOCOL_VERSION_TLS1_3; + auto ssl_config_service = + std::make_unique<TestSSLConfigService>(ssl_context_config); TestSSLConfigService* ssl_config_service_raw = ssl_config_service.get(); session_deps_.ssl_config_service = std::move(ssl_config_service); @@ -21568,8 +21549,8 @@ int rv = trans->Start(&request, callback.callback(), NetLogWithSource()); EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); - ssl_config.version_max = SSL_PROTOCOL_VERSION_TLS1_2; - ssl_config_service_raw->UpdateSSLConfigAndNotify(ssl_config); + ssl_context_config.version_max = SSL_PROTOCOL_VERSION_TLS1_2; + ssl_config_service_raw->UpdateSSLConfigAndNotify(ssl_context_config); EXPECT_THAT(callback.GetResult(rv), IsError(ERR_NETWORK_CHANGED)); }
diff --git a/net/http/http_response_body_drainer_unittest.cc b/net/http/http_response_body_drainer_unittest.cc index b40cdca..a0f135b 100644 --- a/net/http/http_response_body_drainer_unittest.cc +++ b/net/http/http_response_body_drainer_unittest.cc
@@ -25,7 +25,7 @@ #include "net/cert/mock_cert_verifier.h" #include "net/cert/multi_log_ct_verifier.h" #include "net/http/http_network_session.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/http/http_stream.h" #include "net/http/transport_security_state.h" #include "net/proxy_resolution/proxy_resolution_service.h" @@ -233,7 +233,7 @@ HttpResponseBodyDrainerTest() : proxy_resolution_service_(ProxyResolutionService::CreateDirect()), ssl_config_service_(new SSLConfigServiceDefaults), - http_server_properties_(new HttpServerPropertiesImpl()), + http_server_properties_(new HttpServerProperties()), session_(CreateNetworkSession()), mock_stream_(new MockHttpStream(&result_waiter_)), drainer_(new HttpResponseBodyDrainer(mock_stream_)) {} @@ -254,7 +254,7 @@ std::unique_ptr<ProxyResolutionService> proxy_resolution_service_; std::unique_ptr<SSLConfigService> ssl_config_service_; - std::unique_ptr<HttpServerPropertiesImpl> http_server_properties_; + std::unique_ptr<HttpServerProperties> http_server_properties_; MockCertVerifier cert_verifier_; TransportSecurityState transport_security_state_; MultiLogCTVerifier ct_verifier_;
diff --git a/net/http/http_server_properties.cc b/net/http/http_server_properties.cc index cea0732..a06b883 100644 --- a/net/http/http_server_properties.cc +++ b/net/http/http_server_properties.cc
@@ -4,10 +4,20 @@ #include "net/http/http_server_properties.h" +#include "base/bind.h" +#include "base/location.h" #include "base/logging.h" #include "base/metrics/histogram_macros.h" +#include "base/single_thread_task_runner.h" +#include "base/stl_util.h" +#include "base/strings/string_util.h" #include "base/strings/stringprintf.h" +#include "base/threading/thread_task_runner_handle.h" +#include "base/time/default_clock.h" +#include "base/time/default_tick_clock.h" +#include "base/values.h" #include "net/http/http_network_session.h" +#include "net/http/http_server_properties_manager.h" #include "net/socket/ssl_client_socket.h" #include "net/ssl/ssl_config.h" @@ -15,137 +25,152 @@ namespace { -enum AlternativeProxyUsage { - // Alternative Proxy was used without racing a normal connection. - ALTERNATIVE_PROXY_USAGE_NO_RACE = 0, - // Alternative Proxy was used by winning a race with a normal connection. - ALTERNATIVE_PROXY_USAGE_WON_RACE = 1, - // Alternative Proxy was not used by losing a race with a normal connection. - ALTERNATIVE_PROXY_USAGE_LOST_RACE = 2, - // Maximum value for the enum. - ALTERNATIVE_PROXY_USAGE_MAX, -}; +// Time to wait before starting an update the preferences from the +// http_server_properties_impl_ cache. Scheduling another update during this +// period will be a no-op. +constexpr base::TimeDelta kUpdatePrefsDelay = base::TimeDelta::FromSeconds(60); -AlternativeProxyUsage ConvertProtocolUsageToProxyUsage( - AlternateProtocolUsage usage) { - switch (usage) { - case ALTERNATE_PROTOCOL_USAGE_NO_RACE: - return ALTERNATIVE_PROXY_USAGE_NO_RACE; - case ALTERNATE_PROTOCOL_USAGE_WON_RACE: - return ALTERNATIVE_PROXY_USAGE_WON_RACE; - case ALTERNATE_PROTOCOL_USAGE_LOST_RACE: - return ALTERNATIVE_PROXY_USAGE_LOST_RACE; - default: - NOTREACHED(); - return ALTERNATIVE_PROXY_USAGE_MAX; +} // namespace + +HttpServerProperties::PrefDelegate::~PrefDelegate() = default; + +HttpServerProperties::HttpServerProperties( + std::unique_ptr<PrefDelegate> pref_delegate, + NetLog* net_log, + const base::TickClock* tick_clock, + base::Clock* clock) + : tick_clock_(tick_clock ? tick_clock + : base::DefaultTickClock::GetInstance()), + clock_(clock ? clock : base::DefaultClock::GetInstance()), + is_initialized_(pref_delegate.get() == nullptr), + properties_manager_( + pref_delegate + ? std::make_unique<HttpServerPropertiesManager>( + std::move(pref_delegate), + base::BindOnce(&HttpServerProperties::OnPrefsLoaded, + base::Unretained(this)), + kDefaultMaxQuicServerEntries, + net_log, + tick_clock_) + : nullptr), + broken_alternative_services_(kMaxRecentlyBrokenAlternativeServiceEntries, + this, + tick_clock_), + canonical_suffixes_({".ggpht.com", ".c.youtube.com", ".googlevideo.com", + ".googleusercontent.com"}), + quic_server_info_map_(kDefaultMaxQuicServerEntries), + max_server_configs_stored_in_properties_(kDefaultMaxQuicServerEntries) {} + +HttpServerProperties::~HttpServerProperties() { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + + if (properties_manager_) { + // Stop waiting for initial settings. + is_initialized_ = true; + + // Stop the timer if it's running, since this will write to the properties + // file immediately. + prefs_update_timer_.Stop(); + + WriteProperties(base::OnceClosure()); } } -} // anonymous namespace +void HttpServerProperties::Clear(base::OnceClosure callback) { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + spdy_servers_map_.Clear(); + alternative_service_map_.Clear(); + broken_alternative_services_.Clear(); + canonical_alt_svc_map_.clear(); + last_quic_address_ = IPAddress(); + server_network_stats_map_.Clear(); + quic_server_info_map_.Clear(); + canonical_server_info_map_.clear(); -const char kAlternativeServiceHeader[] = "Alt-Svc"; + if (properties_manager_) { + // Stop waiting for initial settings. + is_initialized_ = true; -void HistogramAlternateProtocolUsage(AlternateProtocolUsage usage, - bool proxy_server_used) { - if (proxy_server_used) { - DCHECK_LE(usage, ALTERNATE_PROTOCOL_USAGE_LOST_RACE); - UMA_HISTOGRAM_ENUMERATION("Net.QuicAlternativeProxy.Usage", - ConvertProtocolUsageToProxyUsage(usage), - ALTERNATIVE_PROXY_USAGE_MAX); - } else { - UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolUsage", usage, - ALTERNATE_PROTOCOL_USAGE_MAX); + // Stop the timer if it's running, since this will write to the properties + // file immediately. + prefs_update_timer_.Stop(); + WriteProperties(std::move(callback)); + } else if (callback) { + base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, + std::move(callback)); } } -void HistogramBrokenAlternateProtocolLocation( - BrokenAlternateProtocolLocation location){ - UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolBrokenLocation", location, - BROKEN_ALTERNATE_PROTOCOL_LOCATION_MAX); -} +bool HttpServerProperties::SupportsRequestPriority( + const url::SchemeHostPort& server) { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + if (server.host().empty()) + return false; -bool IsAlternateProtocolValid(NextProto protocol) { - switch (protocol) { - case kProtoUnknown: - return false; - case kProtoHTTP11: - return false; - case kProtoHTTP2: + if (GetSupportsSpdy(server)) + return true; + const AlternativeServiceInfoVector alternative_service_info_vector = + GetAlternativeServiceInfos(server); + for (const AlternativeServiceInfo& alternative_service_info : + alternative_service_info_vector) { + if (alternative_service_info.alternative_service().protocol == kProtoQUIC) { return true; - case kProtoQUIC: - return true; + } } - NOTREACHED(); return false; } -// static -AlternativeServiceInfo -AlternativeServiceInfo::CreateHttp2AlternativeServiceInfo( - const AlternativeService& alternative_service, - base::Time expiration) { - DCHECK_EQ(alternative_service.protocol, kProtoHTTP2); - return AlternativeServiceInfo(alternative_service, expiration, - quic::ParsedQuicVersionVector()); +bool HttpServerProperties::GetSupportsSpdy(const url::SchemeHostPort& server) { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + if (server.host().empty()) + return false; + + auto spdy_server = spdy_servers_map_.Get(server.Serialize()); + return spdy_server != spdy_servers_map_.end() && spdy_server->second; } -// static -AlternativeServiceInfo AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( - const AlternativeService& alternative_service, - base::Time expiration, - const quic::ParsedQuicVersionVector& advertised_versions) { - DCHECK_EQ(alternative_service.protocol, kProtoQUIC); - return AlternativeServiceInfo(alternative_service, expiration, - advertised_versions); -} +void HttpServerProperties::SetSupportsSpdy(const url::SchemeHostPort& server, + bool support_spdy) { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + if (server.host().empty()) + return; -AlternativeServiceInfo::AlternativeServiceInfo() : alternative_service_() {} - -AlternativeServiceInfo::~AlternativeServiceInfo() = default; - -AlternativeServiceInfo::AlternativeServiceInfo( - const AlternativeService& alternative_service, - base::Time expiration, - const quic::ParsedQuicVersionVector& advertised_versions) - : alternative_service_(alternative_service), expiration_(expiration) { - if (alternative_service_.protocol == kProtoQUIC) { - advertised_versions_ = advertised_versions; - std::sort(advertised_versions_.begin(), advertised_versions_.end(), - TransportVersionLessThan); + auto spdy_server = spdy_servers_map_.Get(server.Serialize()); + if ((spdy_server != spdy_servers_map_.end()) && + (spdy_server->second == support_spdy)) { + return; } + + // If |supports_spdy| is false, and the server doesn't appear in the map, add + // the server to the map, but don't call MaybeQueueWriteProperties(). + // + // TODO(mmenke): Can lack of SPDY support always be represented by not being + // in the cache instead? GetSupportsSpdy() does not distinguish between + // missing entries and entries that affirmatively do not support SPDY. + bool changed = !(spdy_server == spdy_servers_map_.end() && !support_spdy); + + // Cache the data. + spdy_servers_map_.Put(server.Serialize(), support_spdy); + if (changed) + MaybeQueueWriteProperties(); } -AlternativeServiceInfo::AlternativeServiceInfo( - const AlternativeServiceInfo& alternative_service_info) = default; +bool HttpServerProperties::RequiresHTTP11(const HostPortPair& host_port_pair) { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + if (host_port_pair.host().empty()) + return false; -AlternativeServiceInfo& AlternativeServiceInfo::operator=( - const AlternativeServiceInfo& alternative_service_info) = default; - -std::string AlternativeService::ToString() const { - return base::StringPrintf("%s %s:%d", NextProtoToString(protocol), - host.c_str(), port); + return (http11_servers_.find(host_port_pair) != http11_servers_.end()); } -std::string AlternativeServiceInfo::ToString() const { - base::Time::Exploded exploded; - expiration_.LocalExplode(&exploded); - return base::StringPrintf( - "%s, expires %04d-%02d-%02d %02d:%02d:%02d", - alternative_service_.ToString().c_str(), exploded.year, exploded.month, - exploded.day_of_month, exploded.hour, exploded.minute, exploded.second); -} +void HttpServerProperties::SetHTTP11Required( + const HostPortPair& host_port_pair) { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + if (host_port_pair.host().empty()) + return; -// static -bool AlternativeServiceInfo::TransportVersionLessThan( - const quic::ParsedQuicVersion& lhs, - const quic::ParsedQuicVersion& rhs) { - return lhs.transport_version < rhs.transport_version; -} - -std::ostream& operator<<(std::ostream& os, - const AlternativeService& alternative_service) { - os << alternative_service.ToString(); - return os; + http11_servers_.insert(host_port_pair); + MaybeQueueWriteProperties(); } // static @@ -154,4 +179,770 @@ ssl_config->alpn_protos.push_back(kProtoHTTP11); } +void HttpServerProperties::MaybeForceHTTP11(const HostPortPair& server, + SSLConfig* ssl_config) { + if (RequiresHTTP11(server)) { + ForceHTTP11(ssl_config); + } +} + +AlternativeServiceInfoVector HttpServerProperties::GetAlternativeServiceInfos( + const url::SchemeHostPort& origin) { + // Copy valid alternative service infos into + // |valid_alternative_service_infos|. + AlternativeServiceInfoVector valid_alternative_service_infos; + const base::Time now = clock_->Now(); + auto map_it = alternative_service_map_.Get(origin); + if (map_it != alternative_service_map_.end()) { + HostPortPair host_port_pair(origin.host(), origin.port()); + for (auto it = map_it->second.begin(); it != map_it->second.end();) { + if (it->expiration() < now) { + it = map_it->second.erase(it); + continue; + } + AlternativeService alternative_service(it->alternative_service()); + if (alternative_service.host.empty()) { + alternative_service.host = origin.host(); + } + // If the alternative service is equivalent to the origin (same host, same + // port, and both TCP), skip it. + if (host_port_pair.Equals(alternative_service.host_port_pair()) && + alternative_service.protocol == kProtoHTTP2) { + ++it; + continue; + } + if (alternative_service.protocol == kProtoQUIC) { + valid_alternative_service_infos.push_back( + AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( + alternative_service, it->expiration(), + it->advertised_versions())); + } else { + valid_alternative_service_infos.push_back( + AlternativeServiceInfo::CreateHttp2AlternativeServiceInfo( + alternative_service, it->expiration())); + } + ++it; + } + if (map_it->second.empty()) { + alternative_service_map_.Erase(map_it); + } + return valid_alternative_service_infos; + } + + auto canonical = GetCanonicalAltSvcHost(origin); + if (canonical == canonical_alt_svc_map_.end()) { + return AlternativeServiceInfoVector(); + } + map_it = alternative_service_map_.Get(canonical->second); + if (map_it == alternative_service_map_.end()) { + return AlternativeServiceInfoVector(); + } + for (auto it = map_it->second.begin(); it != map_it->second.end();) { + if (it->expiration() < now) { + it = map_it->second.erase(it); + continue; + } + AlternativeService alternative_service(it->alternative_service()); + if (alternative_service.host.empty()) { + alternative_service.host = canonical->second.host(); + if (IsAlternativeServiceBroken(alternative_service)) { + ++it; + continue; + } + alternative_service.host = origin.host(); + } else if (IsAlternativeServiceBroken(alternative_service)) { + ++it; + continue; + } + if (alternative_service.protocol == kProtoQUIC) { + valid_alternative_service_infos.push_back( + AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( + alternative_service, it->expiration(), + it->advertised_versions())); + } else { + valid_alternative_service_infos.push_back( + AlternativeServiceInfo::CreateHttp2AlternativeServiceInfo( + alternative_service, it->expiration())); + } + ++it; + } + if (map_it->second.empty()) { + alternative_service_map_.Erase(map_it); + } + return valid_alternative_service_infos; +} + +bool HttpServerProperties::SetHttp2AlternativeService( + const url::SchemeHostPort& origin, + const AlternativeService& alternative_service, + base::Time expiration) { + DCHECK_EQ(alternative_service.protocol, kProtoHTTP2); + + return SetAlternativeServices( + origin, + AlternativeServiceInfoVector( + /*size=*/1, AlternativeServiceInfo::CreateHttp2AlternativeServiceInfo( + alternative_service, expiration))); +} + +bool HttpServerProperties::SetQuicAlternativeService( + const url::SchemeHostPort& origin, + const AlternativeService& alternative_service, + base::Time expiration, + const quic::ParsedQuicVersionVector& advertised_versions) { + DCHECK(alternative_service.protocol == kProtoQUIC); + + return SetAlternativeServices( + origin, AlternativeServiceInfoVector( + /*size=*/1, + AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( + alternative_service, expiration, advertised_versions))); +} + +bool HttpServerProperties::SetAlternativeServices( + const url::SchemeHostPort& origin, + const AlternativeServiceInfoVector& alternative_service_info_vector) { + auto it = alternative_service_map_.Peek(origin); + + if (alternative_service_info_vector.empty()) { + RemoveAltSvcCanonicalHost(origin); + if (it == alternative_service_map_.end()) + return false; + + alternative_service_map_.Erase(it); + MaybeQueueWriteProperties(); + return true; + } + + bool need_update_pref = true; + if (it != alternative_service_map_.end()) { + DCHECK(!it->second.empty()); + if (it->second.size() == alternative_service_info_vector.size()) { + const base::Time now = clock_->Now(); + need_update_pref = false; + auto new_it = alternative_service_info_vector.begin(); + for (const auto& old : it->second) { + // Persist to disk immediately if new entry has different scheme, host, + // or port. + if (old.alternative_service() != new_it->alternative_service()) { + need_update_pref = true; + break; + } + // Also persist to disk if new expiration it more that twice as far or + // less than half as far in the future. + base::Time old_time = old.expiration(); + base::Time new_time = new_it->expiration(); + if (new_time - now > 2 * (old_time - now) || + 2 * (new_time - now) < (old_time - now)) { + need_update_pref = true; + break; + } + // Also persist to disk if new entry has a different list of advertised + // versions. + if (old.advertised_versions() != new_it->advertised_versions()) { + need_update_pref = true; + break; + } + ++new_it; + } + } + } + + const bool previously_no_alternative_services = + (GetAlternateProtocolIterator(origin) == alternative_service_map_.end()); + + alternative_service_map_.Put(origin, alternative_service_info_vector); + + if (previously_no_alternative_services && + !GetAlternativeServiceInfos(origin).empty()) { + // TODO(rch): Consider the case where multiple requests are started + // before the first completes. In this case, only one of the jobs + // would reach this code, whereas all of them should should have. + HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_MAPPING_MISSING, + false); + } + + // If this host ends with a canonical suffix, then set it as the + // canonical host. + const char* kCanonicalScheme = "https"; + if (origin.scheme() == kCanonicalScheme) { + const std::string* canonical_suffix = GetCanonicalSuffix(origin.host()); + if (canonical_suffix != nullptr) { + url::SchemeHostPort canonical_server(kCanonicalScheme, *canonical_suffix, + origin.port()); + canonical_alt_svc_map_[canonical_server] = origin; + } + } + + if (need_update_pref) + MaybeQueueWriteProperties(); + + return need_update_pref; +} + +void HttpServerProperties::MarkAlternativeServiceBroken( + const AlternativeService& alternative_service) { + broken_alternative_services_.MarkBroken(alternative_service); + MaybeQueueWriteProperties(); +} + +void HttpServerProperties:: + MarkAlternativeServiceBrokenUntilDefaultNetworkChanges( + const AlternativeService& alternative_service) { + broken_alternative_services_.MarkBrokenUntilDefaultNetworkChanges( + alternative_service); + MaybeQueueWriteProperties(); +} + +void HttpServerProperties::MarkAlternativeServiceRecentlyBroken( + const AlternativeService& alternative_service) { + broken_alternative_services_.MarkRecentlyBroken(alternative_service); + MaybeQueueWriteProperties(); +} + +bool HttpServerProperties::IsAlternativeServiceBroken( + const AlternativeService& alternative_service) const { + return broken_alternative_services_.IsBroken(alternative_service); +} + +bool HttpServerProperties::WasAlternativeServiceRecentlyBroken( + const AlternativeService& alternative_service) { + return broken_alternative_services_.WasRecentlyBroken(alternative_service); +} + +void HttpServerProperties::ConfirmAlternativeService( + const AlternativeService& alternative_service) { + bool old_value = IsAlternativeServiceBroken(alternative_service); + broken_alternative_services_.Confirm(alternative_service); + bool new_value = IsAlternativeServiceBroken(alternative_service); + + // For persisting, we only care about the value returned by + // IsAlternativeServiceBroken. If that value changes, then call persist. + if (old_value != new_value) + MaybeQueueWriteProperties(); +} + +bool HttpServerProperties::OnDefaultNetworkChanged() { + bool changed = broken_alternative_services_.OnDefaultNetworkChanged(); + if (changed) + MaybeQueueWriteProperties(); + return changed; +} + +const AlternativeServiceMap& HttpServerProperties::alternative_service_map() + const { + return alternative_service_map_; +} + +std::unique_ptr<base::Value> +HttpServerProperties::GetAlternativeServiceInfoAsValue() const { + const base::Time now = clock_->Now(); + const base::TimeTicks now_ticks = tick_clock_->NowTicks(); + std::unique_ptr<base::ListValue> dict_list(new base::ListValue); + for (const auto& alternative_service_map_item : alternative_service_map_) { + std::unique_ptr<base::ListValue> alternative_service_list( + new base::ListValue); + const url::SchemeHostPort& server = alternative_service_map_item.first; + for (const AlternativeServiceInfo& alternative_service_info : + alternative_service_map_item.second) { + std::string alternative_service_string( + alternative_service_info.ToString()); + AlternativeService alternative_service( + alternative_service_info.alternative_service()); + if (alternative_service.host.empty()) { + alternative_service.host = server.host(); + } + base::TimeTicks brokenness_expiration_ticks; + if (broken_alternative_services_.IsBroken(alternative_service, + &brokenness_expiration_ticks)) { + // Convert |brokenness_expiration| from TimeTicks to Time + base::Time brokenness_expiration = + now + (brokenness_expiration_ticks - now_ticks); + base::Time::Exploded exploded; + brokenness_expiration.LocalExplode(&exploded); + std::string broken_info_string = + " (broken until " + + base::StringPrintf("%04d-%02d-%02d %0d:%0d:%0d", exploded.year, + exploded.month, exploded.day_of_month, + exploded.hour, exploded.minute, + exploded.second) + + ")"; + alternative_service_string.append(broken_info_string); + } + alternative_service_list->AppendString(alternative_service_string); + } + if (alternative_service_list->empty()) + continue; + std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); + dict->SetString("server", server.Serialize()); + dict->Set("alternative_service", std::unique_ptr<base::Value>( + std::move(alternative_service_list))); + dict_list->Append(std::move(dict)); + } + return std::move(dict_list); +} + +bool HttpServerProperties::GetSupportsQuic(IPAddress* last_address) const { + if (last_quic_address_.empty()) + return false; + + *last_address = last_quic_address_; + return true; +} + +void HttpServerProperties::SetSupportsQuic(bool used_quic, + const IPAddress& address) { + IPAddress new_quic_address; + if (used_quic) + new_quic_address = address; + + if (new_quic_address == last_quic_address_) + return; + + last_quic_address_ = new_quic_address; + MaybeQueueWriteProperties(); +} + +void HttpServerProperties::SetServerNetworkStats( + const url::SchemeHostPort& server, + ServerNetworkStats stats) { + const ServerNetworkStats* old_stats = GetServerNetworkStats(server); + bool changed = !old_stats || *old_stats != stats; + + // Still need to update the MRU cache, even if the values haven't changed. + server_network_stats_map_.Put(server, stats); + + if (changed) + MaybeQueueWriteProperties(); +} + +void HttpServerProperties::ClearServerNetworkStats( + const url::SchemeHostPort& server) { + auto it = server_network_stats_map_.Get(server); + if (it != server_network_stats_map_.end()) { + server_network_stats_map_.Erase(it); + MaybeQueueWriteProperties(); + } +} + +const ServerNetworkStats* HttpServerProperties::GetServerNetworkStats( + const url::SchemeHostPort& server) { + auto it = server_network_stats_map_.Get(server); + if (it == server_network_stats_map_.end()) { + return nullptr; + } + return &it->second; +} + +const ServerNetworkStatsMap& HttpServerProperties::server_network_stats_map() + const { + return server_network_stats_map_; +} + +bool HttpServerProperties::SetQuicServerInfo( + const quic::QuicServerId& server_id, + const std::string& server_info) { + auto it = quic_server_info_map_.Peek(server_id); + bool changed = + (it == quic_server_info_map_.end() || it->second != server_info); + quic_server_info_map_.Put(server_id, server_info); + UpdateCanonicalServerInfoMap(server_id); + if (changed) + MaybeQueueWriteProperties(); + return changed; +} + +const std::string* HttpServerProperties::GetQuicServerInfo( + const quic::QuicServerId& server_id) { + auto it = quic_server_info_map_.Get(server_id); + if (it != quic_server_info_map_.end()) { + // Since |canonical_server_info_map_| should always map to the most + // recent host, update it with the one that became MRU in + // |quic_server_info_map_|. + UpdateCanonicalServerInfoMap(server_id); + return &it->second; + } + + // If the exact match for |server_id| wasn't found, check + // |canonical_server_info_map_| whether there is server info for a host with + // the same canonical host suffix. + auto canonical_itr = GetCanonicalServerInfoHost(server_id); + if (canonical_itr == canonical_server_info_map_.end()) + return nullptr; + + // When search in |quic_server_info_map_|, do not change the MRU order. + it = quic_server_info_map_.Peek(canonical_itr->second); + if (it != quic_server_info_map_.end()) + return &it->second; + + return nullptr; +} + +const QuicServerInfoMap& HttpServerProperties::quic_server_info_map() const { + return quic_server_info_map_; +} + +size_t HttpServerProperties::max_server_configs_stored_in_properties() const { + return max_server_configs_stored_in_properties_; +} + +void HttpServerProperties::SetMaxServerConfigsStoredInProperties( + size_t max_server_configs_stored_in_properties) { + // Do nothing if the new size is the same as the old one. + if (max_server_configs_stored_in_properties_ == + max_server_configs_stored_in_properties) { + return; + } + + max_server_configs_stored_in_properties_ = + max_server_configs_stored_in_properties; + + // MRUCache doesn't allow the capacity of the cache to be changed. Thus create + // a new map with the new size and add current elements and swap the new map. + quic_server_info_map_.ShrinkToSize(max_server_configs_stored_in_properties_); + QuicServerInfoMap temp_map(max_server_configs_stored_in_properties_); + // Update the |canonical_server_info_map_| as well, so it stays in sync with + // |quic_server_info_map_|. + canonical_server_info_map_ = CanonicalServerInfoMap(); + for (auto it = quic_server_info_map_.rbegin(); + it != quic_server_info_map_.rend(); ++it) { + temp_map.Put(it->first, it->second); + UpdateCanonicalServerInfoMap(it->first); + } + + quic_server_info_map_.Swap(temp_map); + if (properties_manager_) { + properties_manager_->set_max_server_configs_stored_in_properties( + max_server_configs_stored_in_properties); + } +} + +bool HttpServerProperties::IsInitialized() const { + return is_initialized_; +} + +void HttpServerProperties::OnExpireBrokenAlternativeService( + const AlternativeService& expired_alternative_service) { + // Remove every occurrence of |expired_alternative_service| from + // |alternative_service_map_|. + for (auto map_it = alternative_service_map_.begin(); + map_it != alternative_service_map_.end();) { + for (auto it = map_it->second.begin(); it != map_it->second.end();) { + AlternativeService alternative_service(it->alternative_service()); + // Empty hostname in map means hostname of key: substitute before + // comparing to |expired_alternative_service|. + if (alternative_service.host.empty()) { + alternative_service.host = map_it->first.host(); + } + if (alternative_service == expired_alternative_service) { + it = map_it->second.erase(it); + continue; + } + ++it; + } + // If an origin has an empty list of alternative services, then remove it + // from both |canonical_alt_svc_map_| and + // |alternative_service_map_|. + if (map_it->second.empty()) { + RemoveAltSvcCanonicalHost(map_it->first); + map_it = alternative_service_map_.Erase(map_it); + continue; + } + ++map_it; + } +} + +base::TimeDelta HttpServerProperties::GetUpdatePrefsDelayForTesting() { + return kUpdatePrefsDelay; +} + +AlternativeServiceMap::const_iterator +HttpServerProperties::GetAlternateProtocolIterator( + const url::SchemeHostPort& server) { + AlternativeServiceMap::const_iterator it = + alternative_service_map_.Get(server); + if (it != alternative_service_map_.end()) + return it; + + auto canonical = GetCanonicalAltSvcHost(server); + if (canonical == canonical_alt_svc_map_.end()) { + return alternative_service_map_.end(); + } + + const url::SchemeHostPort canonical_server = canonical->second; + it = alternative_service_map_.Get(canonical_server); + if (it == alternative_service_map_.end()) { + return alternative_service_map_.end(); + } + + for (const AlternativeServiceInfo& alternative_service_info : it->second) { + AlternativeService alternative_service( + alternative_service_info.alternative_service()); + if (alternative_service.host.empty()) { + alternative_service.host = canonical_server.host(); + } + if (!IsAlternativeServiceBroken(alternative_service)) { + return it; + } + } + + RemoveAltSvcCanonicalHost(canonical_server); + return alternative_service_map_.end(); +} + +HttpServerProperties::CanonicalAltSvcMap::const_iterator +HttpServerProperties::GetCanonicalAltSvcHost( + const url::SchemeHostPort& server) const { + const char* kCanonicalScheme = "https"; + if (server.scheme() != kCanonicalScheme) + return canonical_alt_svc_map_.end(); + + const std::string* canonical_suffix = GetCanonicalSuffix(server.host()); + if (canonical_suffix == nullptr) + return canonical_alt_svc_map_.end(); + + url::SchemeHostPort canonical_server(kCanonicalScheme, *canonical_suffix, + server.port()); + return canonical_alt_svc_map_.find(canonical_server); +} + +HttpServerProperties::CanonicalServerInfoMap::const_iterator +HttpServerProperties::GetCanonicalServerInfoHost( + const quic::QuicServerId& server) const { + const std::string* canonical_suffix = GetCanonicalSuffix(server.host()); + if (canonical_suffix == nullptr) + return canonical_server_info_map_.end(); + + HostPortPair canonical_pair(*canonical_suffix, server.port()); + return canonical_server_info_map_.find(canonical_pair); +} + +void HttpServerProperties::RemoveAltSvcCanonicalHost( + const url::SchemeHostPort& server) { + auto canonical = GetCanonicalAltSvcHost(server); + if (canonical == canonical_alt_svc_map_.end()) + return; + + canonical_alt_svc_map_.erase(canonical->first); +} + +void HttpServerProperties::UpdateCanonicalServerInfoMap( + const quic::QuicServerId& server) { + const std::string* suffix = GetCanonicalSuffix(server.host()); + if (suffix) { + HostPortPair canonical_pair(*suffix, server.port()); + canonical_server_info_map_[canonical_pair] = server; + } +} + +const std::string* HttpServerProperties::GetCanonicalSuffix( + const std::string& host) const { + // If this host ends with a canonical suffix, then return the canonical + // suffix. + for (const std::string& canonical_suffix : canonical_suffixes_) { + if (base::EndsWith(host, canonical_suffix, + base::CompareCase::INSENSITIVE_ASCII)) { + return &canonical_suffix; + } + } + return nullptr; +} + +void HttpServerProperties::OnPrefsLoaded( + std::unique_ptr<SpdyServersMap> spdy_servers_map, + std::unique_ptr<AlternativeServiceMap> alternative_service_map, + std::unique_ptr<ServerNetworkStatsMap> server_network_stats_map, + const IPAddress& last_quic_address, + std::unique_ptr<QuicServerInfoMap> quic_server_info_map, + std::unique_ptr<BrokenAlternativeServiceList> + broken_alternative_service_list, + std::unique_ptr<RecentlyBrokenAlternativeServices> + recently_broken_alternative_services, + bool prefs_corrupt) { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + + DCHECK(!is_initialized_); + + // Either all of these are nullptr, or none of them are (except the broken alt + // service fields). + if (spdy_servers_map) { + OnSpdyServersLoaded(std::move(spdy_servers_map)); + OnAlternativeServiceServersLoaded(std::move(alternative_service_map)); + OnServerNetworkStatsLoaded(std::move(server_network_stats_map)); + OnSupportsQuicLoaded(last_quic_address); + OnQuicServerInfoMapLoaded(std::move(quic_server_info_map)); + if (recently_broken_alternative_services) { + DCHECK(broken_alternative_service_list); + OnBrokenAndRecentlyBrokenAlternativeServicesLoaded( + std::move(broken_alternative_service_list), + std::move(recently_broken_alternative_services)); + } + } + + is_initialized_ = true; + + // TODO(mmenke): Corrupt prefs will be modified in the same way if they're + // loaded a second time, so this doesn't seem to get us anything. Remove it. + if (prefs_corrupt) + MaybeQueueWriteProperties(); +} + +void HttpServerProperties::OnSpdyServersLoaded( + std::unique_ptr<SpdyServersMap> spdy_servers_map) { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + + // Add the entries from persisted data. + spdy_servers_map_.Swap(*spdy_servers_map); + + // Add the entries from the memory cache. + for (auto it = spdy_servers_map->rbegin(); it != spdy_servers_map->rend(); + ++it) { + // Add the entry if it is not in the cache, otherwise move it to the front + // of recency list. + if (spdy_servers_map_.Get(it->first) == spdy_servers_map_.end()) + spdy_servers_map_.Put(it->first, it->second); + } +} + +void HttpServerProperties::OnAlternativeServiceServersLoaded( + std::unique_ptr<AlternativeServiceMap> alternative_service_map) { + int32_t size_diff = + alternative_service_map->size() - alternative_service_map_.size(); + if (size_diff > 0) { + UMA_HISTOGRAM_COUNTS_1M("Net.AlternativeServiceServers.MorePrefsEntries", + size_diff); + } else { + UMA_HISTOGRAM_COUNTS_1M( + "Net.AlternativeServiceServers.MoreOrEqualCacheEntries", -size_diff); + } + + // Add the entries from persisted data. + alternative_service_map_.Swap(*alternative_service_map); + + // Add the entries from the memory cache. + for (auto input_it = alternative_service_map->rbegin(); + input_it != alternative_service_map->rend(); ++input_it) { + if (alternative_service_map_.Get(input_it->first) == + alternative_service_map_.end()) { + alternative_service_map_.Put(input_it->first, input_it->second); + } + } + + // Attempt to find canonical servers. Canonical suffix only apply to HTTPS. + const uint16_t kCanonicalPort = 443; + const char* kCanonicalScheme = "https"; + for (const std::string& canonical_suffix : canonical_suffixes_) { + url::SchemeHostPort canonical_server(kCanonicalScheme, canonical_suffix, + kCanonicalPort); + // If we already have a valid canonical server, we're done. + if (base::Contains(canonical_alt_svc_map_, canonical_server) && + (alternative_service_map_.Peek( + canonical_alt_svc_map_[canonical_server]) != + alternative_service_map_.end())) { + continue; + } + // Now attempt to find a server which matches this origin and set it as + // canonical. + for (AlternativeServiceMap::const_iterator it = + alternative_service_map_.begin(); + it != alternative_service_map_.end(); ++it) { + if (base::EndsWith(it->first.host(), canonical_suffix, + base::CompareCase::INSENSITIVE_ASCII) && + it->first.scheme() == canonical_server.scheme()) { + canonical_alt_svc_map_[canonical_server] = it->first; + break; + } + } + } +} + +void HttpServerProperties::OnServerNetworkStatsLoaded( + std::unique_ptr<ServerNetworkStatsMap> server_network_stats_map) { + // Add the entries from persisted data. + server_network_stats_map_.Swap(*server_network_stats_map); + + // Add the entries from the memory cache. + for (auto it = server_network_stats_map->rbegin(); + it != server_network_stats_map->rend(); ++it) { + if (server_network_stats_map_.Get(it->first) == + server_network_stats_map_.end()) { + server_network_stats_map_.Put(it->first, it->second); + } + } +} + +void HttpServerProperties::OnSupportsQuicLoaded(const IPAddress& last_address) { + last_quic_address_ = last_address; +} + +void HttpServerProperties::OnQuicServerInfoMapLoaded( + std::unique_ptr<QuicServerInfoMap> quic_server_info_map) { + DCHECK_EQ(quic_server_info_map->max_size(), quic_server_info_map_.max_size()); + + // Add the entries from persisted data. + quic_server_info_map_.Swap(*quic_server_info_map); + + // Add the entries from the memory cache. + for (auto it = quic_server_info_map->rbegin(); + it != quic_server_info_map->rend(); ++it) { + if (quic_server_info_map_.Get(it->first) == quic_server_info_map_.end()) { + quic_server_info_map_.Put(it->first, it->second); + } + } + + // Repopulate |canonical_server_info_map_| to stay in sync with + // |quic_server_info_map_|. + canonical_server_info_map_.clear(); + for (auto it = quic_server_info_map_.rbegin(); + it != quic_server_info_map_.rend(); ++it) { + UpdateCanonicalServerInfoMap(it->first); + } +} + +void HttpServerProperties::OnBrokenAndRecentlyBrokenAlternativeServicesLoaded( + std::unique_ptr<BrokenAlternativeServiceList> + broken_alternative_service_list, + std::unique_ptr<RecentlyBrokenAlternativeServices> + recently_broken_alternative_services) { + broken_alternative_services_.SetBrokenAndRecentlyBrokenAlternativeServices( + std::move(broken_alternative_service_list), + std::move(recently_broken_alternative_services)); +} + +void HttpServerProperties::MaybeQueueWriteProperties() { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + + if (prefs_update_timer_.IsRunning() || !properties_manager_ || + !is_initialized_) { + return; + } + + prefs_update_timer_.Start( + FROM_HERE, kUpdatePrefsDelay, + base::BindOnce(&HttpServerProperties::WriteProperties, + base::Unretained(this), base::OnceClosure())); +} + +void HttpServerProperties::WriteProperties(base::OnceClosure callback) const { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK(properties_manager_); + + // |this| shouldn't be waiting to load properties cached to disk when this + // method is invoked, since this method will overwrite any cached properties. + DCHECK(is_initialized_); + + // There shouldn't be a queued update when this is run, since this method + // removes the need for any update to be queued. + DCHECK(!prefs_update_timer_.IsRunning()); + + properties_manager_->WriteToPrefs( + spdy_servers_map_, alternative_service_map_, + base::BindRepeating(&HttpServerProperties::GetCanonicalSuffix, + base::Unretained(this)), + server_network_stats_map_, last_quic_address_, quic_server_info_map_, + broken_alternative_services_.broken_alternative_service_list(), + broken_alternative_services_.recently_broken_alternative_services(), + std::move(callback)); +} + } // namespace net
diff --git a/net/http/http_server_properties.h b/net/http/http_server_properties.h index a1117925d..43005e74 100644 --- a/net/http/http_server_properties.h +++ b/net/http/http_server_properties.h
@@ -5,10 +5,12 @@ #ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_H_ #define NET_HTTP_HTTP_SERVER_PROPERTIES_H_ +#include <stddef.h> #include <stdint.h> #include <map> -#include <ostream> +#include <memory> +#include <set> #include <string> #include <tuple> #include <vector> @@ -16,10 +18,17 @@ #include "base/callback.h" #include "base/containers/mru_cache.h" #include "base/macros.h" +#include "base/memory/weak_ptr.h" +#include "base/threading/thread_checker.h" #include "base/time/time.h" +#include "base/timer/timer.h" +#include "base/values.h" #include "net/base/host_port_pair.h" +#include "net/base/ip_address.h" #include "net/base/net_export.h" -#include "net/socket/next_proto.h" +#include "net/http/alternative_service.h" +#include "net/http/broken_alternative_services.h" +#include "net/http/http_server_properties.h" #include "net/third_party/quiche/src/quic/core/quic_bandwidth.h" #include "net/third_party/quiche/src/quic/core/quic_server_id.h" #include "net/third_party/quiche/src/quic/core/quic_versions.h" @@ -28,200 +37,23 @@ #include "url/scheme_host_port.h" namespace base { +class Clock; +class TickClock; class Value; } namespace net { +class HostPortPair; +class HttpServerPropertiesManager; class IPAddress; +class NetLog; struct SSLConfig; -enum AlternateProtocolUsage { - // Alternate Protocol was used without racing a normal connection. - ALTERNATE_PROTOCOL_USAGE_NO_RACE = 0, - // Alternate Protocol was used by winning a race with a normal connection. - ALTERNATE_PROTOCOL_USAGE_WON_RACE = 1, - // Alternate Protocol was not used by losing a race with a normal connection. - ALTERNATE_PROTOCOL_USAGE_LOST_RACE = 2, - // Alternate Protocol was not used because no Alternate-Protocol information - // was available when the request was issued, but an Alternate-Protocol header - // was present in the response. - ALTERNATE_PROTOCOL_USAGE_MAPPING_MISSING = 3, - // Alternate Protocol was not used because it was marked broken. - ALTERNATE_PROTOCOL_USAGE_BROKEN = 4, - // Maximum value for the enum. - ALTERNATE_PROTOCOL_USAGE_MAX, -}; - -// Log a histogram to reflect |usage|. -NET_EXPORT void HistogramAlternateProtocolUsage(AlternateProtocolUsage usage, - bool proxy_server_used); - -enum BrokenAlternateProtocolLocation { - BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_JOB = 0, - BROKEN_ALTERNATE_PROTOCOL_LOCATION_QUIC_STREAM_FACTORY = 1, - BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_JOB_ALT = 2, - BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_JOB_MAIN = 3, - BROKEN_ALTERNATE_PROTOCOL_LOCATION_QUIC_HTTP_STREAM = 4, - BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_NETWORK_TRANSACTION = 5, - BROKEN_ALTERNATE_PROTOCOL_LOCATION_MAX, -}; - -// Log a histogram to reflect |location|. -NET_EXPORT void HistogramBrokenAlternateProtocolLocation( - BrokenAlternateProtocolLocation location); - -NET_EXPORT bool IsAlternateProtocolValid(NextProto protocol); - -// (protocol, host, port) triple as defined in -// https://tools.ietf.org/id/draft-ietf-httpbis-alt-svc-06.html -struct NET_EXPORT AlternativeService { - AlternativeService() : protocol(kProtoUnknown), host(), port(0) {} - - AlternativeService(NextProto protocol, const std::string& host, uint16_t port) - : protocol(protocol), host(host), port(port) {} - - AlternativeService(NextProto protocol, const HostPortPair& host_port_pair) - : protocol(protocol), - host(host_port_pair.host()), - port(host_port_pair.port()) {} - - AlternativeService(const AlternativeService& alternative_service) = default; - AlternativeService& operator=(const AlternativeService& alternative_service) = - default; - - HostPortPair host_port_pair() const { return HostPortPair(host, port); } - - bool operator==(const AlternativeService& other) const { - return protocol == other.protocol && host == other.host && - port == other.port; - } - - bool operator!=(const AlternativeService& other) const { - return !this->operator==(other); - } - - bool operator<(const AlternativeService& other) const { - return std::tie(protocol, host, port) < - std::tie(other.protocol, other.host, other.port); - } - - // Output format: "protocol host:port", e.g. "h2 www.google.com:1234". - std::string ToString() const; - - NextProto protocol; - std::string host; - uint16_t port; -}; - -NET_EXPORT_PRIVATE std::ostream& operator<<( - std::ostream& os, - const AlternativeService& alternative_service); - -struct AlternativeServiceHash { - size_t operator()(const net::AlternativeService& entry) const { - return entry.protocol ^ std::hash<std::string>()(entry.host) ^ entry.port; - } -}; - -class NET_EXPORT_PRIVATE AlternativeServiceInfo { - public: - static AlternativeServiceInfo CreateHttp2AlternativeServiceInfo( - const AlternativeService& alternative_service, - base::Time expiration); - - static AlternativeServiceInfo CreateQuicAlternativeServiceInfo( - const AlternativeService& alternative_service, - base::Time expiration, - const quic::ParsedQuicVersionVector& advertised_versions); - - AlternativeServiceInfo(); - ~AlternativeServiceInfo(); - - AlternativeServiceInfo( - const AlternativeServiceInfo& alternative_service_info); - - AlternativeServiceInfo& operator=( - const AlternativeServiceInfo& alternative_service_info); - - bool operator==(const AlternativeServiceInfo& other) const { - return alternative_service_ == other.alternative_service() && - expiration_ == other.expiration() && - advertised_versions_ == other.advertised_versions(); - } - - bool operator!=(const AlternativeServiceInfo& other) const { - return !this->operator==(other); - } - - std::string ToString() const; - - void set_alternative_service(const AlternativeService& alternative_service) { - alternative_service_ = alternative_service; - } - - void set_protocol(const NextProto& protocol) { - alternative_service_.protocol = protocol; - } - - void set_host(const std::string& host) { alternative_service_.host = host; } - - void set_port(uint16_t port) { alternative_service_.port = port; } - - void set_expiration(const base::Time& expiration) { - expiration_ = expiration; - } - - void set_advertised_versions( - const quic::ParsedQuicVersionVector& advertised_versions) { - if (alternative_service_.protocol != kProtoQUIC) - return; - - advertised_versions_ = advertised_versions; - std::sort(advertised_versions_.begin(), advertised_versions_.end(), - TransportVersionLessThan); - } - - const AlternativeService& alternative_service() const { - return alternative_service_; - } - - NextProto protocol() const { return alternative_service_.protocol; } - - HostPortPair host_port_pair() const { - return alternative_service_.host_port_pair(); - } - - base::Time expiration() const { return expiration_; } - - const quic::ParsedQuicVersionVector& advertised_versions() const { - return advertised_versions_; - } - - private: - AlternativeServiceInfo( - const AlternativeService& alternative_service, - base::Time expiration, - const quic::ParsedQuicVersionVector& advertised_versions); - - static bool TransportVersionLessThan(const quic::ParsedQuicVersion& lhs, - const quic::ParsedQuicVersion& rhs); - - AlternativeService alternative_service_; - base::Time expiration_; - - // Lists all the QUIC versions that are advertised by the server and supported - // by Chrome. If empty, defaults to versions used by the current instance of - // the netstack. - // This list MUST be sorted in ascending order. - quic::ParsedQuicVersionVector advertised_versions_; -}; - struct NET_EXPORT SupportsQuic { SupportsQuic() : used_quic(false) {} SupportsQuic(bool used_quic, const std::string& address) - : used_quic(used_quic), - address(address) {} + : used_quic(used_quic), address(address) {} bool Equals(const SupportsQuic& other) const { return used_quic == other.used_quic && address == other.address; @@ -249,10 +81,6 @@ typedef std::vector<AlternativeService> AlternativeServiceVector; typedef std::vector<AlternativeServiceInfo> AlternativeServiceInfoVector; -// Stores broken alternative services and when their brokenness expires. -typedef std::list<std::pair<AlternativeService, base::TimeTicks>> - BrokenAlternativeServiceList; - // Store at most 300 MRU SupportsSpdyServerHostPortPairs in memory and disk. const int kMaxSupportsSpdyServerEntries = 300; @@ -263,6 +91,8 @@ const int kMaxServerNetworkStatsEntries = 200; // Store at most 200 MRU RecentlyBrokenAlternativeServices in memory and disk. +// This ideally would be with the other constants in HttpServerProperties, but +// has to go here instead of prevent a circular dependency. const int kMaxRecentlyBrokenAlternativeServiceEntries = 200; // Store at most 5 MRU QUIC servers by default. This is mainly used by cronet. @@ -292,92 +122,115 @@ kMaxServerNetworkStatsEntries) {} }; -// Stores how many times an alternative service has been marked broken. -class RecentlyBrokenAlternativeServices - : public base::MRUCache<AlternativeService, int> { - public: - RecentlyBrokenAlternativeServices() - : base::MRUCache<AlternativeService, int>( - kMaxRecentlyBrokenAlternativeServiceEntries) {} -}; - // Max number of quic servers to store is not hardcoded and can be set. // Because of this, QuicServerInfoMap will not be a subclass of MRUCache. typedef base::MRUCache<quic::QuicServerId, std::string> QuicServerInfoMap; -extern const char kAlternativeServiceHeader[]; - // The interface for setting/retrieving the HTTP server properties. // Currently, this class manages servers': // * HTTP/2 support; // * Alternative Service support; // * QUIC data (like ServerNetworkStats and QuicServerInfo). // -// Embedders must ensure that HttpServerProperites is completely initialized -// before the first request is issued. -class NET_EXPORT HttpServerProperties { +// Optionally retrieves and saves properties from/to disk. +class NET_EXPORT HttpServerProperties + : public BrokenAlternativeServices::Delegate { public: - HttpServerProperties() {} - virtual ~HttpServerProperties() {} + // Provides an interface to interact with persistent preferences storage + // implemented by the embedder. The prefs are assumed not to have been loaded + // before HttpServerPropertiesManager construction. + class NET_EXPORT PrefDelegate { + public: + virtual ~PrefDelegate(); + + // Returns the branch of the preferences system for the server properties. + // Returns nullptr if the pref system has no data for the server properties. + virtual const base::DictionaryValue* GetServerProperties() const = 0; + + // Sets the server properties to the given value. If |callback| is + // non-empty, flushes data to persistent storage and invokes |callback| + // asynchronously when complete. + virtual void SetServerProperties(const base::DictionaryValue& value, + base::OnceClosure callback) = 0; + + // Starts listening for prefs to be loaded. If prefs are already loaded, + // |pref_loaded_callback| will be invoked asynchronously. Callback will be + // invoked even if prefs fail to load. Will only be called once by the + // HttpServerPropertiesManager. + virtual void WaitForPrefLoad(base::OnceClosure pref_loaded_callback) = 0; + }; + + // If a |pref_delegate| is specified, it will be used to read/write the + // properties to a pref file. Writes are rate limited to improve performance. + // + // |tick_clock| is used for setting expiration times and scheduling the + // expiration of broken alternative services. If null, default clock will be + // used. + // + // |clock| is used for converting base::TimeTicks to base::Time for + // wherever base::Time is preferable. + HttpServerProperties(std::unique_ptr<PrefDelegate> pref_delegate = nullptr, + NetLog* net_log = nullptr, + const base::TickClock* tick_clock = nullptr, + base::Clock* clock = nullptr); + + ~HttpServerProperties() override; // Deletes all data. If |callback| is non-null, flushes data to disk // and invokes the callback asynchronously once changes have been written to // disk. - virtual void Clear(base::OnceClosure callback) = 0; + void Clear(base::OnceClosure callback); // Returns true if |server| supports a network protocol which honors // request prioritization. // Note that this also implies that the server supports request // multiplexing, since priorities imply a relationship between // multiple requests. - virtual bool SupportsRequestPriority(const url::SchemeHostPort& server) = 0; + bool SupportsRequestPriority(const url::SchemeHostPort& server); // Returns the value set by SetSupportsSpdy(). If not set, returns false. - virtual bool GetSupportsSpdy(const url::SchemeHostPort& server) = 0; + bool GetSupportsSpdy(const url::SchemeHostPort& server); // Add |server| into the persistent store. Should only be called from IO // thread. - virtual void SetSupportsSpdy(const url::SchemeHostPort& server, - bool support_spdy) = 0; + void SetSupportsSpdy(const url::SchemeHostPort& server, bool support_spdy); // Returns true if |server| has required HTTP/1.1 via HTTP/2 error code. - virtual bool RequiresHTTP11(const HostPortPair& server) = 0; + bool RequiresHTTP11(const HostPortPair& server); // Require HTTP/1.1 on subsequent connections. Not persisted. - virtual void SetHTTP11Required(const HostPortPair& server) = 0; + void SetHTTP11Required(const HostPortPair& server); // Modify SSLConfig to force HTTP/1.1. static void ForceHTTP11(SSLConfig* ssl_config); // Modify SSLConfig to force HTTP/1.1 if necessary. - virtual void MaybeForceHTTP11(const HostPortPair& server, - SSLConfig* ssl_config) = 0; + void MaybeForceHTTP11(const HostPortPair& server, SSLConfig* ssl_config); // Return all alternative services for |origin|, including broken ones. // Returned alternative services never have empty hostnames. - virtual AlternativeServiceInfoVector GetAlternativeServiceInfos( - const url::SchemeHostPort& origin) = 0; + AlternativeServiceInfoVector GetAlternativeServiceInfos( + const url::SchemeHostPort& origin); // Set a single HTTP/2 alternative service for |origin|. Previous // alternative services for |origin| are discarded. // |alternative_service.host| may be empty. // Return true if |alternative_service_map_| has changed significantly enough // that it should be persisted to disk. - virtual bool SetHttp2AlternativeService( - const url::SchemeHostPort& origin, - const AlternativeService& alternative_service, - base::Time expiration) = 0; + bool SetHttp2AlternativeService(const url::SchemeHostPort& origin, + const AlternativeService& alternative_service, + base::Time expiration); // Set a single QUIC alternative service for |origin|. Previous alternative // services for |origin| are discarded. // |alternative_service.host| may be empty. // Return true if |alternative_service_map_| has changed significantly enough // that it should be persisted to disk. - virtual bool SetQuicAlternativeService( + bool SetQuicAlternativeService( const url::SchemeHostPort& origin, const AlternativeService& alternative_service, base::Time expiration, - const quic::ParsedQuicVersionVector& advertised_versions) = 0; + const quic::ParsedQuicVersionVector& advertised_versions); // Set alternative services for |origin|. Previous alternative services for // |origin| are discarded. @@ -385,97 +238,267 @@ // |alternative_service_info_vector| may be empty. // Return true if |alternative_service_map_| has changed significantly enough // that it should be persisted to disk. - virtual bool SetAlternativeServices( + bool SetAlternativeServices( const url::SchemeHostPort& origin, - const AlternativeServiceInfoVector& alternative_service_info_vector) = 0; + const AlternativeServiceInfoVector& alternative_service_info_vector); // Marks |alternative_service| as broken. // |alternative_service.host| must not be empty. - virtual void MarkAlternativeServiceBroken( - const AlternativeService& alternative_service) = 0; + void MarkAlternativeServiceBroken( + const AlternativeService& alternative_service); // Marks |alternative_service| as broken until the default network changes. // |alternative_service.host| must not be empty. - virtual void MarkAlternativeServiceBrokenUntilDefaultNetworkChanges( - const AlternativeService& alternative_service) = 0; + void MarkAlternativeServiceBrokenUntilDefaultNetworkChanges( + const AlternativeService& alternative_service); // Marks |alternative_service| as recently broken. // |alternative_service.host| must not be empty. - virtual void MarkAlternativeServiceRecentlyBroken( - const AlternativeService& alternative_service) = 0; + void MarkAlternativeServiceRecentlyBroken( + const AlternativeService& alternative_service); // Returns true iff |alternative_service| is currently broken. // |alternative_service.host| must not be empty. - virtual bool IsAlternativeServiceBroken( - const AlternativeService& alternative_service) const = 0; + bool IsAlternativeServiceBroken( + const AlternativeService& alternative_service) const; // Returns true iff |alternative_service| was recently broken. // |alternative_service.host| must not be empty. - virtual bool WasAlternativeServiceRecentlyBroken( - const AlternativeService& alternative_service) = 0; + bool WasAlternativeServiceRecentlyBroken( + const AlternativeService& alternative_service); // Confirms that |alternative_service| is working. // |alternative_service.host| must not be empty. - virtual void ConfirmAlternativeService( - const AlternativeService& alternative_service) = 0; + void ConfirmAlternativeService(const AlternativeService& alternative_service); // Called when the default network changes. // Clears all the alternative services that were marked broken until the // default network changed. // Returns true if there is any broken alternative service affected by the // default network change. - virtual bool OnDefaultNetworkChanged() = 0; + bool OnDefaultNetworkChanged(); // Returns all alternative service mappings. // Returned alternative services may have empty hostnames. - virtual const AlternativeServiceMap& alternative_service_map() const = 0; + const AlternativeServiceMap& alternative_service_map() const; // Returns all alternative service mappings as human readable strings. // Empty alternative service hostnames will be printed as such. - virtual std::unique_ptr<base::Value> GetAlternativeServiceInfoAsValue() - const = 0; + std::unique_ptr<base::Value> GetAlternativeServiceInfoAsValue() const; - virtual bool GetSupportsQuic(IPAddress* last_address) const = 0; + bool GetSupportsQuic(IPAddress* last_address) const; - virtual void SetSupportsQuic(bool used_quic, - const IPAddress& last_address) = 0; + void SetSupportsQuic(bool used_quic, const IPAddress& last_address); // Sets |stats| for |server|. - virtual void SetServerNetworkStats(const url::SchemeHostPort& server, - ServerNetworkStats stats) = 0; + void SetServerNetworkStats(const url::SchemeHostPort& server, + ServerNetworkStats stats); // Clears any stats for |server|. - virtual void ClearServerNetworkStats(const url::SchemeHostPort& server) = 0; + void ClearServerNetworkStats(const url::SchemeHostPort& server); // Returns any stats for |server| or nullptr if there are none. - virtual const ServerNetworkStats* GetServerNetworkStats( - const url::SchemeHostPort& server) = 0; + const ServerNetworkStats* GetServerNetworkStats( + const url::SchemeHostPort& server); - virtual const ServerNetworkStatsMap& server_network_stats_map() const = 0; + const ServerNetworkStatsMap& server_network_stats_map() const; // Save QuicServerInfo (in std::string form) for the given |server_id|. // Returns true if the value has changed otherwise it returns false. - virtual bool SetQuicServerInfo(const quic::QuicServerId& server_id, - const std::string& server_info) = 0; + bool SetQuicServerInfo(const quic::QuicServerId& server_id, + const std::string& server_info); // Get QuicServerInfo (in std::string form) for the given |server_id|. - virtual const std::string* GetQuicServerInfo( - const quic::QuicServerId& server_id) = 0; + const std::string* GetQuicServerInfo(const quic::QuicServerId& server_id); // Returns all persistent QuicServerInfo objects. - virtual const QuicServerInfoMap& quic_server_info_map() const = 0; + const QuicServerInfoMap& quic_server_info_map() const; // Returns the number of server configs (QuicServerInfo objects) persisted. - virtual size_t max_server_configs_stored_in_properties() const = 0; + size_t max_server_configs_stored_in_properties() const; // Sets the number of server configs (QuicServerInfo objects) to be persisted. - virtual void SetMaxServerConfigsStoredInProperties( - size_t max_server_configs_stored_in_properties) = 0; + void SetMaxServerConfigsStoredInProperties( + size_t max_server_configs_stored_in_properties); // Returns whether HttpServerProperties is initialized. - virtual bool IsInitialized() const = 0; + bool IsInitialized() const; + + // BrokenAlternativeServices::Delegate method. + void OnExpireBrokenAlternativeService( + const AlternativeService& expired_alternative_service) override; + + static base::TimeDelta GetUpdatePrefsDelayForTesting(); + + // Test-only routines that call the methods used to load the specified + // field(s) from a prefs file. Unlike OnPrefsLoaded(), these may be invoked + // multiple times. + void OnSpdyServersLoadedForTesting( + std::unique_ptr<SpdyServersMap> spdy_servers_map) { + OnSpdyServersLoaded(std::move(spdy_servers_map)); + } + void OnAlternativeServiceServersLoadedForTesting( + std::unique_ptr<AlternativeServiceMap> alternate_protocol_servers) { + OnAlternativeServiceServersLoaded(std::move(alternate_protocol_servers)); + } + void OnServerNetworkStatsLoadedForTesting( + std::unique_ptr<ServerNetworkStatsMap> server_network_stats_map) { + OnServerNetworkStatsLoaded(std::move(server_network_stats_map)); + } + void OnSupportsQuicLoadedForTesting(const IPAddress& last_address) { + OnSupportsQuicLoaded(last_address); + } + void OnQuicServerInfoMapLoadedForTesting( + std::unique_ptr<QuicServerInfoMap> quic_server_info_map) { + OnQuicServerInfoMapLoaded(std::move(quic_server_info_map)); + } + void OnBrokenAndRecentlyBrokenAlternativeServicesLoadedForTesting( + std::unique_ptr<BrokenAlternativeServiceList> + broken_alternative_service_list, + std::unique_ptr<RecentlyBrokenAlternativeServices> + recently_broken_alternative_services) { + OnBrokenAndRecentlyBrokenAlternativeServicesLoaded( + std::move(broken_alternative_service_list), + std::move(recently_broken_alternative_services)); + } + + const std::string* GetCanonicalSuffixForTesting( + const std::string& host) const { + return GetCanonicalSuffix(host); + } + + const SpdyServersMap& spdy_servers_map_for_testing() const { + return spdy_servers_map_; + } + + // TODO(mmenke): Look into removing this. + HttpServerPropertiesManager* properties_manager_for_testing() { + return properties_manager_.get(); + } private: + // TODO (wangyix): modify HttpServerProperties unit tests so this + // friendness is no longer required. + friend class HttpServerPropertiesPeer; + + typedef base::flat_map<url::SchemeHostPort, url::SchemeHostPort> + CanonicalAltSvcMap; + typedef base::flat_map<HostPortPair, quic::QuicServerId> + CanonicalServerInfoMap; + typedef std::vector<std::string> CanonicalSuffixList; + typedef std::set<HostPortPair> Http11ServerHostPortSet; + + // Return the iterator for |server|, or for its canonical host, or end. + AlternativeServiceMap::const_iterator GetAlternateProtocolIterator( + const url::SchemeHostPort& server); + + // Return the canonical host for |server|, or end if none exists. + CanonicalAltSvcMap::const_iterator GetCanonicalAltSvcHost( + const url::SchemeHostPort& server) const; + + // Return the canonical host with the same canonical suffix as |server|. + // The returned canonical host can be used to search for server info in + // |quic_server_info_map_|. Return 'end' the host doesn't exist. + CanonicalServerInfoMap::const_iterator GetCanonicalServerInfoHost( + const quic::QuicServerId& server) const; + + // Remove the canonical alt-svc host for |server|. + void RemoveAltSvcCanonicalHost(const url::SchemeHostPort& server); + + // Update |canonical_server_info_map_| with the new canonical host. + // The |server| should have the corresponding server info associated with it + // in |quic_server_info_map_|. If |canonical_server_info_map_| doesn't + // have an entry associated with |server|, the method will add one. + void UpdateCanonicalServerInfoMap(const quic::QuicServerId& server); + + // Returns the canonical host suffix for |host|, or nullptr if none + // exists. + const std::string* GetCanonicalSuffix(const std::string& host) const; + + void OnPrefsLoaded( + std::unique_ptr<SpdyServersMap> spdy_servers_map, + std::unique_ptr<AlternativeServiceMap> alternative_service_map, + std::unique_ptr<ServerNetworkStatsMap> server_network_stats_map, + const IPAddress& last_quic_address, + std::unique_ptr<QuicServerInfoMap> quic_server_info_map, + std::unique_ptr<BrokenAlternativeServiceList> + broken_alternative_service_list, + std::unique_ptr<RecentlyBrokenAlternativeServices> + recently_broken_alternative_services, + bool prefs_corrupt); + + // These methods are called by OnPrefsLoaded to handle merging properties + // loaded from prefs with what has been learned while waiting for prefs to + // load. + void OnSpdyServersLoaded(std::unique_ptr<SpdyServersMap> spdy_servers_map); + void OnAlternativeServiceServersLoaded( + std::unique_ptr<AlternativeServiceMap> alternate_protocol_servers); + void OnServerNetworkStatsLoaded( + std::unique_ptr<ServerNetworkStatsMap> server_network_stats_map); + void OnSupportsQuicLoaded(const IPAddress& last_address); + void OnQuicServerInfoMapLoaded( + std::unique_ptr<QuicServerInfoMap> quic_server_info_map); + void OnBrokenAndRecentlyBrokenAlternativeServicesLoaded( + std::unique_ptr<BrokenAlternativeServiceList> + broken_alternative_service_list, + std::unique_ptr<RecentlyBrokenAlternativeServices> + recently_broken_alternative_services); + + // Queue a delayed call to WriteProperties(). If |is_initialized_| is false, + // or |properties_manager_| is nullptr, or there's already a queued call to + // WriteProperties(), does nothing. + void MaybeQueueWriteProperties(); + + // Writes cached state to |properties_manager_|, which must not be null. + // Invokes |callback| on completion, if non-null. + void WriteProperties(base::OnceClosure callback) const; + + const base::TickClock* tick_clock_; // Unowned + base::Clock* clock_; // Unowned + + // Set to true once initial properties have been retrieved from disk by + // |properties_manager_|. Always true if |properties_manager_| is nullptr. + bool is_initialized_; + + // Used to load/save properties from/to preferences. May be nullptr. + std::unique_ptr<HttpServerPropertiesManager> properties_manager_; + + SpdyServersMap spdy_servers_map_; + Http11ServerHostPortSet http11_servers_; + + AlternativeServiceMap alternative_service_map_; + + BrokenAlternativeServices broken_alternative_services_; + + IPAddress last_quic_address_; + ServerNetworkStatsMap server_network_stats_map_; + // Contains a map of servers which could share the same alternate protocol. + // Map from a Canonical scheme/host/port (host is some postfix of host names) + // to an actual origin, which has a plausible alternate protocol mapping. + CanonicalAltSvcMap canonical_alt_svc_map_; + + // Contains list of suffixes (for example ".c.youtube.com", + // ".googlevideo.com", ".googleusercontent.com") of canonical hostnames. + const CanonicalSuffixList canonical_suffixes_; + + QuicServerInfoMap quic_server_info_map_; + + // Maps canonical suffixes to host names that have the same canonical suffix + // and have a corresponding entry in |quic_server_info_map_|. The map can be + // used to quickly look for server info for hosts that share the same + // canonical suffix but don't have exact match in |quic_server_info_map_|. The + // map exists solely to improve the search performance. It only contains + // derived data that can be recalculated by traversing + // |quic_server_info_map_|. + CanonicalServerInfoMap canonical_server_info_map_; + + size_t max_server_configs_stored_in_properties_; + + // Used to post calls to WriteProperties(). + base::OneShotTimer prefs_update_timer_; + + THREAD_CHECKER(thread_checker_); + DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); };
diff --git a/net/http/http_server_properties_impl.cc b/net/http/http_server_properties_impl.cc deleted file mode 100644 index bf614b3..0000000 --- a/net/http/http_server_properties_impl.cc +++ /dev/null
@@ -1,793 +0,0 @@ -// 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 "net/http/http_server_properties_impl.h" - -#include <algorithm> -#include <memory> -#include <utility> - -#include "base/bind.h" -#include "base/location.h" -#include "base/logging.h" -#include "base/metrics/histogram_macros.h" -#include "base/single_thread_task_runner.h" -#include "base/stl_util.h" -#include "base/strings/string_util.h" -#include "base/strings/stringprintf.h" -#include "base/threading/thread_task_runner_handle.h" -#include "base/time/default_clock.h" -#include "base/values.h" - -namespace net { - -HttpServerPropertiesImpl::HttpServerPropertiesImpl( - const base::TickClock* tick_clock, - base::Clock* clock) - : tick_clock_(tick_clock ? tick_clock - : base::DefaultTickClock::GetInstance()), - clock_(clock ? clock : base::DefaultClock::GetInstance()), - broken_alternative_services_(this, tick_clock_), - canonical_suffixes_({".ggpht.com", ".c.youtube.com", ".googlevideo.com", - ".googleusercontent.com"}), - quic_server_info_map_(kDefaultMaxQuicServerEntries), - max_server_configs_stored_in_properties_(kDefaultMaxQuicServerEntries) {} - -HttpServerPropertiesImpl::HttpServerPropertiesImpl() - : HttpServerPropertiesImpl(nullptr, nullptr) {} - -HttpServerPropertiesImpl::~HttpServerPropertiesImpl() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); -} - -void HttpServerPropertiesImpl::SetSpdyServers( - std::unique_ptr<SpdyServersMap> spdy_servers_map) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - - // Add the entries from persisted data. - spdy_servers_map_.Swap(*spdy_servers_map); - - // Add the entries from the memory cache. - for (auto it = spdy_servers_map->rbegin(); it != spdy_servers_map->rend(); - ++it) { - // Add the entry if it is not in the cache, otherwise move it to the front - // of recency list. - if (spdy_servers_map_.Get(it->first) == spdy_servers_map_.end()) - spdy_servers_map_.Put(it->first, it->second); - } -} - -void HttpServerPropertiesImpl::SetAlternativeServiceServers( - std::unique_ptr<AlternativeServiceMap> alternative_service_map) { - int32_t size_diff = - alternative_service_map->size() - alternative_service_map_.size(); - if (size_diff > 0) { - UMA_HISTOGRAM_COUNTS_1M("Net.AlternativeServiceServers.MorePrefsEntries", - size_diff); - } else { - UMA_HISTOGRAM_COUNTS_1M( - "Net.AlternativeServiceServers.MoreOrEqualCacheEntries", -size_diff); - } - - // Add the entries from persisted data. - alternative_service_map_.Swap(*alternative_service_map); - - // Add the entries from the memory cache. - for (auto input_it = alternative_service_map->rbegin(); - input_it != alternative_service_map->rend(); ++input_it) { - if (alternative_service_map_.Get(input_it->first) == - alternative_service_map_.end()) { - alternative_service_map_.Put(input_it->first, input_it->second); - } - } - - // Attempt to find canonical servers. Canonical suffix only apply to HTTPS. - const uint16_t kCanonicalPort = 443; - const char* kCanonicalScheme = "https"; - for (const std::string& canonical_suffix : canonical_suffixes_) { - url::SchemeHostPort canonical_server(kCanonicalScheme, canonical_suffix, - kCanonicalPort); - // If we already have a valid canonical server, we're done. - if (base::Contains(canonical_alt_svc_map_, canonical_server) && - (alternative_service_map_.Peek( - canonical_alt_svc_map_[canonical_server]) != - alternative_service_map_.end())) { - continue; - } - // Now attempt to find a server which matches this origin and set it as - // canonical. - for (AlternativeServiceMap::const_iterator it = - alternative_service_map_.begin(); - it != alternative_service_map_.end(); ++it) { - if (base::EndsWith(it->first.host(), canonical_suffix, - base::CompareCase::INSENSITIVE_ASCII) && - it->first.scheme() == canonical_server.scheme()) { - canonical_alt_svc_map_[canonical_server] = it->first; - break; - } - } - } -} - -void HttpServerPropertiesImpl::SetSupportsQuic(const IPAddress& last_address) { - last_quic_address_ = last_address; -} - -void HttpServerPropertiesImpl::SetServerNetworkStats( - std::unique_ptr<ServerNetworkStatsMap> server_network_stats_map) { - // Add the entries from persisted data. - server_network_stats_map_.Swap(*server_network_stats_map); - - // Add the entries from the memory cache. - for (auto it = server_network_stats_map->rbegin(); - it != server_network_stats_map->rend(); ++it) { - if (server_network_stats_map_.Get(it->first) == - server_network_stats_map_.end()) { - server_network_stats_map_.Put(it->first, it->second); - } - } -} - -void HttpServerPropertiesImpl::SetQuicServerInfoMap( - std::unique_ptr<QuicServerInfoMap> quic_server_info_map) { - DCHECK_EQ(quic_server_info_map->max_size(), quic_server_info_map_.max_size()); - - // Add the entries from persisted data. - quic_server_info_map_.Swap(*quic_server_info_map); - - // Add the entries from the memory cache. - for (auto it = quic_server_info_map->rbegin(); - it != quic_server_info_map->rend(); ++it) { - if (quic_server_info_map_.Get(it->first) == quic_server_info_map_.end()) { - quic_server_info_map_.Put(it->first, it->second); - } - } - - // Repopulate |canonical_server_info_map_| to stay in sync with - // |quic_server_info_map_|. - canonical_server_info_map_.clear(); - for (auto it = quic_server_info_map_.rbegin(); - it != quic_server_info_map_.rend(); ++it) { - UpdateCanonicalServerInfoMap(it->first); - } -} - -const SpdyServersMap& HttpServerPropertiesImpl::spdy_servers_map() const { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - return spdy_servers_map_; -} - -void HttpServerPropertiesImpl::SetBrokenAndRecentlyBrokenAlternativeServices( - std::unique_ptr<BrokenAlternativeServiceList> - broken_alternative_service_list, - std::unique_ptr<RecentlyBrokenAlternativeServices> - recently_broken_alternative_services) { - broken_alternative_services_.SetBrokenAndRecentlyBrokenAlternativeServices( - std::move(broken_alternative_service_list), - std::move(recently_broken_alternative_services)); -} - -const BrokenAlternativeServiceList& -HttpServerPropertiesImpl::broken_alternative_service_list() const { - return broken_alternative_services_.broken_alternative_service_list(); -} - -const RecentlyBrokenAlternativeServices& -HttpServerPropertiesImpl::recently_broken_alternative_services() const { - return broken_alternative_services_.recently_broken_alternative_services(); -} - -void HttpServerPropertiesImpl::Clear(base::OnceClosure callback) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - spdy_servers_map_.Clear(); - alternative_service_map_.Clear(); - broken_alternative_services_.Clear(); - canonical_alt_svc_map_.clear(); - last_quic_address_ = IPAddress(); - server_network_stats_map_.Clear(); - quic_server_info_map_.Clear(); - canonical_server_info_map_.clear(); - - if (!callback.is_null()) { - base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, - std::move(callback)); - } -} - -bool HttpServerPropertiesImpl::SupportsRequestPriority( - const url::SchemeHostPort& server) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - if (server.host().empty()) - return false; - - if (GetSupportsSpdy(server)) - return true; - const AlternativeServiceInfoVector alternative_service_info_vector = - GetAlternativeServiceInfos(server); - for (const AlternativeServiceInfo& alternative_service_info : - alternative_service_info_vector) { - if (alternative_service_info.alternative_service().protocol == kProtoQUIC) { - return true; - } - } - return false; -} - -bool HttpServerPropertiesImpl::GetSupportsSpdy( - const url::SchemeHostPort& server) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - if (server.host().empty()) - return false; - - auto spdy_server = spdy_servers_map_.Get(server.Serialize()); - return spdy_server != spdy_servers_map_.end() && spdy_server->second; -} - -void HttpServerPropertiesImpl::SetSupportsSpdy( - const url::SchemeHostPort& server, - bool support_spdy) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - if (server.host().empty()) - return; - - auto spdy_server = spdy_servers_map_.Get(server.Serialize()); - if ((spdy_server != spdy_servers_map_.end()) && - (spdy_server->second == support_spdy)) { - return; - } - // Cache the data. - spdy_servers_map_.Put(server.Serialize(), support_spdy); -} - -bool HttpServerPropertiesImpl::RequiresHTTP11( - const HostPortPair& host_port_pair) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - if (host_port_pair.host().empty()) - return false; - - return (http11_servers_.find(host_port_pair) != http11_servers_.end()); -} - -void HttpServerPropertiesImpl::SetHTTP11Required( - const HostPortPair& host_port_pair) { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - if (host_port_pair.host().empty()) - return; - - http11_servers_.insert(host_port_pair); -} - -void HttpServerPropertiesImpl::MaybeForceHTTP11(const HostPortPair& server, - SSLConfig* ssl_config) { - if (RequiresHTTP11(server)) { - ForceHTTP11(ssl_config); - } -} - -const std::string* HttpServerPropertiesImpl::GetCanonicalSuffix( - const std::string& host) const { - // If this host ends with a canonical suffix, then return the canonical - // suffix. - for (const std::string& canonical_suffix : canonical_suffixes_) { - if (base::EndsWith(host, canonical_suffix, - base::CompareCase::INSENSITIVE_ASCII)) { - return &canonical_suffix; - } - } - return nullptr; -} - -AlternativeServiceInfoVector -HttpServerPropertiesImpl::GetAlternativeServiceInfos( - const url::SchemeHostPort& origin) { - // Copy valid alternative service infos into - // |valid_alternative_service_infos|. - AlternativeServiceInfoVector valid_alternative_service_infos; - const base::Time now = clock_->Now(); - auto map_it = alternative_service_map_.Get(origin); - if (map_it != alternative_service_map_.end()) { - HostPortPair host_port_pair(origin.host(), origin.port()); - for (auto it = map_it->second.begin(); it != map_it->second.end();) { - if (it->expiration() < now) { - it = map_it->second.erase(it); - continue; - } - AlternativeService alternative_service(it->alternative_service()); - if (alternative_service.host.empty()) { - alternative_service.host = origin.host(); - } - // If the alternative service is equivalent to the origin (same host, same - // port, and both TCP), skip it. - if (host_port_pair.Equals(alternative_service.host_port_pair()) && - alternative_service.protocol == kProtoHTTP2) { - ++it; - continue; - } - if (alternative_service.protocol == kProtoQUIC) { - valid_alternative_service_infos.push_back( - AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( - alternative_service, it->expiration(), - it->advertised_versions())); - } else { - valid_alternative_service_infos.push_back( - AlternativeServiceInfo::CreateHttp2AlternativeServiceInfo( - alternative_service, it->expiration())); - } - ++it; - } - if (map_it->second.empty()) { - alternative_service_map_.Erase(map_it); - } - return valid_alternative_service_infos; - } - - auto canonical = GetCanonicalAltSvcHost(origin); - if (canonical == canonical_alt_svc_map_.end()) { - return AlternativeServiceInfoVector(); - } - map_it = alternative_service_map_.Get(canonical->second); - if (map_it == alternative_service_map_.end()) { - return AlternativeServiceInfoVector(); - } - for (auto it = map_it->second.begin(); it != map_it->second.end();) { - if (it->expiration() < now) { - it = map_it->second.erase(it); - continue; - } - AlternativeService alternative_service(it->alternative_service()); - if (alternative_service.host.empty()) { - alternative_service.host = canonical->second.host(); - if (IsAlternativeServiceBroken(alternative_service)) { - ++it; - continue; - } - alternative_service.host = origin.host(); - } else if (IsAlternativeServiceBroken(alternative_service)) { - ++it; - continue; - } - if (alternative_service.protocol == kProtoQUIC) { - valid_alternative_service_infos.push_back( - AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( - alternative_service, it->expiration(), - it->advertised_versions())); - } else { - valid_alternative_service_infos.push_back( - AlternativeServiceInfo::CreateHttp2AlternativeServiceInfo( - alternative_service, it->expiration())); - } - ++it; - } - if (map_it->second.empty()) { - alternative_service_map_.Erase(map_it); - } - return valid_alternative_service_infos; -} - -bool HttpServerPropertiesImpl::SetHttp2AlternativeService( - const url::SchemeHostPort& origin, - const AlternativeService& alternative_service, - base::Time expiration) { - DCHECK_EQ(alternative_service.protocol, kProtoHTTP2); - - return SetAlternativeServices( - origin, - AlternativeServiceInfoVector( - /*size=*/1, AlternativeServiceInfo::CreateHttp2AlternativeServiceInfo( - alternative_service, expiration))); -} - -bool HttpServerPropertiesImpl::SetQuicAlternativeService( - const url::SchemeHostPort& origin, - const AlternativeService& alternative_service, - base::Time expiration, - const quic::ParsedQuicVersionVector& advertised_versions) { - DCHECK(alternative_service.protocol == kProtoQUIC); - - return SetAlternativeServices( - origin, AlternativeServiceInfoVector( - /*size=*/1, - AlternativeServiceInfo::CreateQuicAlternativeServiceInfo( - alternative_service, expiration, advertised_versions))); -} - -bool HttpServerPropertiesImpl::SetAlternativeServices( - const url::SchemeHostPort& origin, - const AlternativeServiceInfoVector& alternative_service_info_vector) { - auto it = alternative_service_map_.Peek(origin); - - if (alternative_service_info_vector.empty()) { - RemoveAltSvcCanonicalHost(origin); - if (it == alternative_service_map_.end()) - return false; - - alternative_service_map_.Erase(it); - return true; - } - - bool changed = true; - if (it != alternative_service_map_.end()) { - DCHECK(!it->second.empty()); - if (it->second.size() == alternative_service_info_vector.size()) { - const base::Time now = clock_->Now(); - changed = false; - auto new_it = alternative_service_info_vector.begin(); - for (const auto& old : it->second) { - // Persist to disk immediately if new entry has different scheme, host, - // or port. - if (old.alternative_service() != new_it->alternative_service()) { - changed = true; - break; - } - // Also persist to disk if new expiration it more that twice as far or - // less than half as far in the future. - base::Time old_time = old.expiration(); - base::Time new_time = new_it->expiration(); - if (new_time - now > 2 * (old_time - now) || - 2 * (new_time - now) < (old_time - now)) { - changed = true; - break; - } - // Also persist to disk if new entry has a different list of advertised - // versions. - if (old.advertised_versions() != new_it->advertised_versions()) { - changed = true; - break; - } - ++new_it; - } - } - } - - const bool previously_no_alternative_services = - (GetAlternateProtocolIterator(origin) == alternative_service_map_.end()); - - alternative_service_map_.Put(origin, alternative_service_info_vector); - - if (previously_no_alternative_services && - !GetAlternativeServiceInfos(origin).empty()) { - // TODO(rch): Consider the case where multiple requests are started - // before the first completes. In this case, only one of the jobs - // would reach this code, whereas all of them should should have. - HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_MAPPING_MISSING, - false); - } - - // If this host ends with a canonical suffix, then set it as the - // canonical host. - const char* kCanonicalScheme = "https"; - if (origin.scheme() == kCanonicalScheme) { - const std::string* canonical_suffix = GetCanonicalSuffix(origin.host()); - if (canonical_suffix != nullptr) { - url::SchemeHostPort canonical_server(kCanonicalScheme, *canonical_suffix, - origin.port()); - canonical_alt_svc_map_[canonical_server] = origin; - } - } - return changed; -} - -void HttpServerPropertiesImpl::MarkAlternativeServiceBroken( - const AlternativeService& alternative_service) { - broken_alternative_services_.MarkBroken(alternative_service); -} - -void HttpServerPropertiesImpl:: - MarkAlternativeServiceBrokenUntilDefaultNetworkChanges( - const AlternativeService& alternative_service) { - broken_alternative_services_.MarkBrokenUntilDefaultNetworkChanges( - alternative_service); -} - -void HttpServerPropertiesImpl::MarkAlternativeServiceRecentlyBroken( - const AlternativeService& alternative_service) { - broken_alternative_services_.MarkRecentlyBroken(alternative_service); -} - -bool HttpServerPropertiesImpl::IsAlternativeServiceBroken( - const AlternativeService& alternative_service) const { - return broken_alternative_services_.IsBroken(alternative_service); -} - -bool HttpServerPropertiesImpl::WasAlternativeServiceRecentlyBroken( - const AlternativeService& alternative_service) { - return broken_alternative_services_.WasRecentlyBroken(alternative_service); -} - -void HttpServerPropertiesImpl::ConfirmAlternativeService( - const AlternativeService& alternative_service) { - broken_alternative_services_.Confirm(alternative_service); -} - -bool HttpServerPropertiesImpl::OnDefaultNetworkChanged() { - return broken_alternative_services_.OnDefaultNetworkChanged(); -} - -const AlternativeServiceMap& HttpServerPropertiesImpl::alternative_service_map() - const { - return alternative_service_map_; -} - -std::unique_ptr<base::Value> -HttpServerPropertiesImpl::GetAlternativeServiceInfoAsValue() const { - const base::Time now = clock_->Now(); - const base::TimeTicks now_ticks = tick_clock_->NowTicks(); - std::unique_ptr<base::ListValue> dict_list(new base::ListValue); - for (const auto& alternative_service_map_item : alternative_service_map_) { - std::unique_ptr<base::ListValue> alternative_service_list( - new base::ListValue); - const url::SchemeHostPort& server = alternative_service_map_item.first; - for (const AlternativeServiceInfo& alternative_service_info : - alternative_service_map_item.second) { - std::string alternative_service_string( - alternative_service_info.ToString()); - AlternativeService alternative_service( - alternative_service_info.alternative_service()); - if (alternative_service.host.empty()) { - alternative_service.host = server.host(); - } - base::TimeTicks brokenness_expiration_ticks; - if (broken_alternative_services_.IsBroken(alternative_service, - &brokenness_expiration_ticks)) { - // Convert |brokenness_expiration| from TimeTicks to Time - base::Time brokenness_expiration = - now + (brokenness_expiration_ticks - now_ticks); - base::Time::Exploded exploded; - brokenness_expiration.LocalExplode(&exploded); - std::string broken_info_string = - " (broken until " + - base::StringPrintf("%04d-%02d-%02d %0d:%0d:%0d", exploded.year, - exploded.month, exploded.day_of_month, - exploded.hour, exploded.minute, - exploded.second) + - ")"; - alternative_service_string.append(broken_info_string); - } - alternative_service_list->AppendString(alternative_service_string); - } - if (alternative_service_list->empty()) - continue; - std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); - dict->SetString("server", server.Serialize()); - dict->Set("alternative_service", std::unique_ptr<base::Value>( - std::move(alternative_service_list))); - dict_list->Append(std::move(dict)); - } - return std::move(dict_list); -} - -bool HttpServerPropertiesImpl::GetSupportsQuic(IPAddress* last_address) const { - if (last_quic_address_.empty()) - return false; - - *last_address = last_quic_address_; - return true; -} - -void HttpServerPropertiesImpl::SetSupportsQuic(bool used_quic, - const IPAddress& address) { - if (!used_quic) { - last_quic_address_ = IPAddress(); - } else { - last_quic_address_ = address; - } -} - -void HttpServerPropertiesImpl::SetServerNetworkStats( - const url::SchemeHostPort& server, - ServerNetworkStats stats) { - server_network_stats_map_.Put(server, stats); -} - -void HttpServerPropertiesImpl::ClearServerNetworkStats( - const url::SchemeHostPort& server) { - auto it = server_network_stats_map_.Get(server); - if (it != server_network_stats_map_.end()) { - server_network_stats_map_.Erase(it); - } -} - -const ServerNetworkStats* HttpServerPropertiesImpl::GetServerNetworkStats( - const url::SchemeHostPort& server) { - auto it = server_network_stats_map_.Get(server); - if (it == server_network_stats_map_.end()) { - return nullptr; - } - return &it->second; -} - -const ServerNetworkStatsMap& -HttpServerPropertiesImpl::server_network_stats_map() const { - return server_network_stats_map_; -} - -bool HttpServerPropertiesImpl::SetQuicServerInfo( - const quic::QuicServerId& server_id, - const std::string& server_info) { - auto it = quic_server_info_map_.Peek(server_id); - bool changed = - (it == quic_server_info_map_.end() || it->second != server_info); - quic_server_info_map_.Put(server_id, server_info); - UpdateCanonicalServerInfoMap(server_id); - return changed; -} - -const std::string* HttpServerPropertiesImpl::GetQuicServerInfo( - const quic::QuicServerId& server_id) { - auto it = quic_server_info_map_.Get(server_id); - if (it != quic_server_info_map_.end()) { - // Since |canonical_server_info_map_| should always map to the most - // recent host, update it with the one that became MRU in - // |quic_server_info_map_|. - UpdateCanonicalServerInfoMap(server_id); - return &it->second; - } - - // If the exact match for |server_id| wasn't found, check - // |canonical_server_info_map_| whether there is server info for a host with - // the same canonical host suffix. - auto canonical_itr = GetCanonicalServerInfoHost(server_id); - if (canonical_itr == canonical_server_info_map_.end()) - return nullptr; - - // When search in |quic_server_info_map_|, do not change the MRU order. - it = quic_server_info_map_.Peek(canonical_itr->second); - if (it != quic_server_info_map_.end()) - return &it->second; - - return nullptr; -} - -HttpServerPropertiesImpl::CanonicalServerInfoMap::const_iterator -HttpServerPropertiesImpl::GetCanonicalServerInfoHost( - const quic::QuicServerId& server) const { - const std::string* canonical_suffix = GetCanonicalSuffix(server.host()); - if (canonical_suffix == nullptr) - return canonical_server_info_map_.end(); - - HostPortPair canonical_pair(*canonical_suffix, server.port()); - return canonical_server_info_map_.find(canonical_pair); -} - -const QuicServerInfoMap& HttpServerPropertiesImpl::quic_server_info_map() - const { - return quic_server_info_map_; -} - -size_t HttpServerPropertiesImpl::max_server_configs_stored_in_properties() - const { - return max_server_configs_stored_in_properties_; -} - -void HttpServerPropertiesImpl::SetMaxServerConfigsStoredInProperties( - size_t max_server_configs_stored_in_properties) { - // Do nothing if the new size is the same as the old one. - if (max_server_configs_stored_in_properties_ == - max_server_configs_stored_in_properties) - return; - - max_server_configs_stored_in_properties_ = - max_server_configs_stored_in_properties; - - // MRUCache doesn't allow the capacity of the cache to be changed. Thus create - // a new map with the new size and add current elements and swap the new map. - quic_server_info_map_.ShrinkToSize(max_server_configs_stored_in_properties_); - QuicServerInfoMap temp_map(max_server_configs_stored_in_properties_); - // Update the |canonical_server_info_map_| as well, so it stays in sync with - // |quic_server_info_map_|. - canonical_server_info_map_ = CanonicalServerInfoMap(); - for (auto it = quic_server_info_map_.rbegin(); - it != quic_server_info_map_.rend(); ++it) { - temp_map.Put(it->first, it->second); - UpdateCanonicalServerInfoMap(it->first); - } - - quic_server_info_map_.Swap(temp_map); -} - -void HttpServerPropertiesImpl::UpdateCanonicalServerInfoMap( - const quic::QuicServerId& server) { - const std::string* suffix = GetCanonicalSuffix(server.host()); - if (suffix) { - HostPortPair canonical_pair(*suffix, server.port()); - canonical_server_info_map_[canonical_pair] = server; - } -} - -bool HttpServerPropertiesImpl::IsInitialized() const { - // No initialization is needed. - return true; -} - -AlternativeServiceMap::const_iterator -HttpServerPropertiesImpl::GetAlternateProtocolIterator( - const url::SchemeHostPort& server) { - AlternativeServiceMap::const_iterator it = - alternative_service_map_.Get(server); - if (it != alternative_service_map_.end()) - return it; - - auto canonical = GetCanonicalAltSvcHost(server); - if (canonical == canonical_alt_svc_map_.end()) { - return alternative_service_map_.end(); - } - - const url::SchemeHostPort canonical_server = canonical->second; - it = alternative_service_map_.Get(canonical_server); - if (it == alternative_service_map_.end()) { - return alternative_service_map_.end(); - } - - for (const AlternativeServiceInfo& alternative_service_info : it->second) { - AlternativeService alternative_service( - alternative_service_info.alternative_service()); - if (alternative_service.host.empty()) { - alternative_service.host = canonical_server.host(); - } - if (!IsAlternativeServiceBroken(alternative_service)) { - return it; - } - } - - RemoveAltSvcCanonicalHost(canonical_server); - return alternative_service_map_.end(); -} - -HttpServerPropertiesImpl::CanonicalAltSvcMap::const_iterator -HttpServerPropertiesImpl::GetCanonicalAltSvcHost( - const url::SchemeHostPort& server) const { - const char* kCanonicalScheme = "https"; - if (server.scheme() != kCanonicalScheme) - return canonical_alt_svc_map_.end(); - - const std::string* canonical_suffix = GetCanonicalSuffix(server.host()); - if (canonical_suffix == nullptr) - return canonical_alt_svc_map_.end(); - - url::SchemeHostPort canonical_server(kCanonicalScheme, *canonical_suffix, - server.port()); - return canonical_alt_svc_map_.find(canonical_server); -} - -void HttpServerPropertiesImpl::RemoveAltSvcCanonicalHost( - const url::SchemeHostPort& server) { - auto canonical = GetCanonicalAltSvcHost(server); - if (canonical == canonical_alt_svc_map_.end()) - return; - - canonical_alt_svc_map_.erase(canonical->first); -} - -void HttpServerPropertiesImpl::OnExpireBrokenAlternativeService( - const AlternativeService& expired_alternative_service) { - // Remove every occurrence of |expired_alternative_service| from - // |alternative_service_map_|. - for (auto map_it = alternative_service_map_.begin(); - map_it != alternative_service_map_.end();) { - for (auto it = map_it->second.begin(); it != map_it->second.end();) { - AlternativeService alternative_service(it->alternative_service()); - // Empty hostname in map means hostname of key: substitute before - // comparing to |expired_alternative_service|. - if (alternative_service.host.empty()) { - alternative_service.host = map_it->first.host(); - } - if (alternative_service == expired_alternative_service) { - it = map_it->second.erase(it); - continue; - } - ++it; - } - // If an origin has an empty list of alternative services, then remove it - // from both |canonical_alt_svc_map_| and - // |alternative_service_map_|. - if (map_it->second.empty()) { - RemoveAltSvcCanonicalHost(map_it->first); - map_it = alternative_service_map_.Erase(map_it); - continue; - } - ++map_it; - } -} - -} // namespace net
diff --git a/net/http/http_server_properties_impl.h b/net/http/http_server_properties_impl.h deleted file mode 100644 index 863d153..0000000 --- a/net/http/http_server_properties_impl.h +++ /dev/null
@@ -1,229 +0,0 @@ -// 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. - -#ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ -#define NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ - -#include <stddef.h> -#include <stdint.h> - -#include <map> -#include <set> -#include <string> -#include <vector> - -#include "base/callback.h" -#include "base/macros.h" -#include "base/memory/weak_ptr.h" -#include "base/threading/thread_checker.h" -#include "base/time/default_tick_clock.h" -#include "base/values.h" -#include "net/base/host_port_pair.h" -#include "net/base/ip_address.h" -#include "net/base/net_export.h" -#include "net/http/broken_alternative_services.h" -#include "net/http/http_server_properties.h" - -namespace base { -class Clock; -class TickClock; -} - -namespace net { - -// The implementation for setting/retrieving the HTTP server properties. -class NET_EXPORT HttpServerPropertiesImpl - : public HttpServerProperties, - public BrokenAlternativeServices::Delegate { - public: - // |tick_clock| is used for setting expiration times and scheduling the - // expiration of broken alternative services. If null, default clock will be - // used. - // |clock| is used for converting base::TimeTicks to base::Time for - // wherever base::Time is preferable. - HttpServerPropertiesImpl(const base::TickClock* tick_clock, - base::Clock* clock); - - // Default clock will be used. - HttpServerPropertiesImpl(); - - ~HttpServerPropertiesImpl() override; - - // Sets |spdy_servers_map_| with the servers (host/port) from - // |spdy_servers| that either support SPDY or not. - void SetSpdyServers(std::unique_ptr<SpdyServersMap> spdy_servers_map); - - void SetAlternativeServiceServers( - std::unique_ptr<AlternativeServiceMap> alternate_protocol_servers); - - void SetSupportsQuic(const IPAddress& last_address); - - void SetServerNetworkStats( - std::unique_ptr<ServerNetworkStatsMap> server_network_stats_map); - - void SetQuicServerInfoMap( - std::unique_ptr<QuicServerInfoMap> quic_server_info_map); - - const SpdyServersMap& spdy_servers_map() const; - - void SetBrokenAndRecentlyBrokenAlternativeServices( - std::unique_ptr<BrokenAlternativeServiceList> - broken_alternative_service_list, - std::unique_ptr<RecentlyBrokenAlternativeServices> - recently_broken_alternative_services); - - const BrokenAlternativeServiceList& broken_alternative_service_list() const; - - const RecentlyBrokenAlternativeServices& - recently_broken_alternative_services() const; - - // Returns flattened string representation of the |host_port_pair|. Used by - // unittests. - static std::string GetFlattenedSpdyServer(const HostPortPair& host_port_pair); - - // Returns the canonical host suffix for |host|, or nullptr if none - // exists. - const std::string* GetCanonicalSuffix(const std::string& host) const; - - // ----------------------------- - // HttpServerProperties methods: - // ----------------------------- - - void Clear(base::OnceClosure callback) override; - bool SupportsRequestPriority(const url::SchemeHostPort& server) override; - bool GetSupportsSpdy(const url::SchemeHostPort& server) override; - void SetSupportsSpdy(const url::SchemeHostPort& server, - bool support_spdy) override; - bool RequiresHTTP11(const HostPortPair& server) override; - void SetHTTP11Required(const HostPortPair& server) override; - void MaybeForceHTTP11(const HostPortPair& server, - SSLConfig* ssl_config) override; - AlternativeServiceInfoVector GetAlternativeServiceInfos( - const url::SchemeHostPort& origin) override; - bool SetHttp2AlternativeService(const url::SchemeHostPort& origin, - const AlternativeService& alternative_service, - base::Time expiration) override; - bool SetQuicAlternativeService( - const url::SchemeHostPort& origin, - const AlternativeService& alternative_service, - base::Time expiration, - const quic::ParsedQuicVersionVector& advertised_versions) override; - bool SetAlternativeServices(const url::SchemeHostPort& origin, - const AlternativeServiceInfoVector& - alternative_service_info_vector) override; - void MarkAlternativeServiceBroken( - const AlternativeService& alternative_service) override; - void MarkAlternativeServiceBrokenUntilDefaultNetworkChanges( - const AlternativeService& alternative_service) override; - void MarkAlternativeServiceRecentlyBroken( - const AlternativeService& alternative_service) override; - bool IsAlternativeServiceBroken( - const AlternativeService& alternative_service) const override; - bool WasAlternativeServiceRecentlyBroken( - const AlternativeService& alternative_service) override; - void ConfirmAlternativeService( - const AlternativeService& alternative_service) override; - bool OnDefaultNetworkChanged() override; - const AlternativeServiceMap& alternative_service_map() const override; - std::unique_ptr<base::Value> GetAlternativeServiceInfoAsValue() - const override; - bool GetSupportsQuic(IPAddress* last_address) const override; - void SetSupportsQuic(bool used_quic, const IPAddress& address) override; - void SetServerNetworkStats(const url::SchemeHostPort& server, - ServerNetworkStats stats) override; - void ClearServerNetworkStats(const url::SchemeHostPort& server) override; - const ServerNetworkStats* GetServerNetworkStats( - const url::SchemeHostPort& server) override; - const ServerNetworkStatsMap& server_network_stats_map() const override; - bool SetQuicServerInfo(const quic::QuicServerId& server_id, - const std::string& server_info) override; - const std::string* GetQuicServerInfo( - const quic::QuicServerId& server_id) override; - const QuicServerInfoMap& quic_server_info_map() const override; - size_t max_server_configs_stored_in_properties() const override; - void SetMaxServerConfigsStoredInProperties( - size_t max_server_configs_stored_in_properties) override; - bool IsInitialized() const override; - - // BrokenAlternativeServices::Delegate method. - void OnExpireBrokenAlternativeService( - const AlternativeService& expired_alternative_service) override; - - private: - // TODO (wangyix): modify HttpServerPropertiesImpl unit tests so this - // friendness is no longer required. - friend class HttpServerPropertiesImplPeer; - - typedef base::flat_map<url::SchemeHostPort, url::SchemeHostPort> - CanonicalAltSvcMap; - typedef base::flat_map<HostPortPair, quic::QuicServerId> - CanonicalServerInfoMap; - typedef std::vector<std::string> CanonicalSuffixList; - typedef std::set<HostPortPair> Http11ServerHostPortSet; - - // Return the iterator for |server|, or for its canonical host, or end. - AlternativeServiceMap::const_iterator GetAlternateProtocolIterator( - const url::SchemeHostPort& server); - - // Return the canonical host for |server|, or end if none exists. - CanonicalAltSvcMap::const_iterator GetCanonicalAltSvcHost( - const url::SchemeHostPort& server) const; - - // Return the canonical host with the same canonical suffix as |server|. - // The returned canonical host can be used to search for server info in - // |quic_server_info_map_|. Return 'end' the host doesn't exist. - CanonicalServerInfoMap::const_iterator GetCanonicalServerInfoHost( - const quic::QuicServerId& server) const; - - // Remove the canonical alt-svc host for |server|. - void RemoveAltSvcCanonicalHost(const url::SchemeHostPort& server); - - // Update |canonical_server_info_map_| with the new canonical host. - // The |server| should have the corresponding server info associated with it - // in |quic_server_info_map_|. If |canonical_server_info_map_| doesn't - // have an entry associated with |server|, the method will add one. - void UpdateCanonicalServerInfoMap(const quic::QuicServerId& server); - - const base::TickClock* tick_clock_; // Unowned - base::Clock* clock_; // Unowned - - SpdyServersMap spdy_servers_map_; - Http11ServerHostPortSet http11_servers_; - - AlternativeServiceMap alternative_service_map_; - - BrokenAlternativeServices broken_alternative_services_; - - IPAddress last_quic_address_; - ServerNetworkStatsMap server_network_stats_map_; - // Contains a map of servers which could share the same alternate protocol. - // Map from a Canonical scheme/host/port (host is some postfix of host names) - // to an actual origin, which has a plausible alternate protocol mapping. - CanonicalAltSvcMap canonical_alt_svc_map_; - - // Contains list of suffixes (for example ".c.youtube.com", - // ".googlevideo.com", ".googleusercontent.com") of canonical hostnames. - const CanonicalSuffixList canonical_suffixes_; - - QuicServerInfoMap quic_server_info_map_; - - // Maps canonical suffixes to host names that have the same canonical suffix - // and have a corresponding entry in |quic_server_info_map_|. The map can be - // used to quickly look for server info for hosts that share the same - // canonical suffix but don't have exact match in |quic_server_info_map_|. The - // map exists solely to improve the search performance. It only contains - // derived data that can be recalculated by traversing - // |quic_server_info_map_|. - CanonicalServerInfoMap canonical_server_info_map_; - - size_t max_server_configs_stored_in_properties_; - - THREAD_CHECKER(thread_checker_); - - DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); -}; - -} // namespace net - -#endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_
diff --git a/net/http/http_server_properties_manager.cc b/net/http/http_server_properties_manager.cc index c3d64bd..62441f1e 100644 --- a/net/http/http_server_properties_manager.cc +++ b/net/http/http_server_properties_manager.cc
@@ -10,23 +10,21 @@ #include "base/metrics/histogram_macros.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" +#include "base/time/tick_clock.h" #include "base/values.h" #include "net/base/host_port_pair.h" #include "net/base/ip_address.h" #include "net/base/port_util.h" #include "net/base/privacy_mode.h" +#include "net/http/http_server_properties.h" #include "net/third_party/quiche/src/quic/platform/api/quic_hostname_utils.h" #include "url/gurl.h" +#include "url/scheme_host_port.h" namespace net { namespace { -// Time to wait before starting an update the preferences from the -// http_server_properties_impl_ cache. Scheduling another update during this -// period will be a no-op. -constexpr base::TimeDelta kUpdatePrefsDelay = base::TimeDelta::FromSeconds(60); - // "version" 0 indicates, http_server_properties doesn't have "version" // property. const int kMissingVersion = 0; @@ -100,324 +98,48 @@ //////////////////////////////////////////////////////////////////////////////// // HttpServerPropertiesManager -HttpServerPropertiesManager::PrefDelegate::~PrefDelegate() = default; - HttpServerPropertiesManager::HttpServerPropertiesManager( - std::unique_ptr<PrefDelegate> pref_delegate, + std::unique_ptr<HttpServerProperties::PrefDelegate> pref_delegate, + OnPrefsLoadedCallback on_prefs_loaded_callback, + size_t max_server_configs_stored_in_properties, NetLog* net_log, const base::TickClock* clock) : pref_delegate_(std::move(pref_delegate)), - clock_(clock ? clock : base::DefaultTickClock::GetInstance()), + on_prefs_loaded_callback_(std::move(on_prefs_loaded_callback)), + max_server_configs_stored_in_properties_( + max_server_configs_stored_in_properties), + clock_(clock), net_log_( NetLogWithSource::Make(net_log, NetLogSourceType::HTTP_SERVER_PROPERTIES)) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(pref_delegate_); + DCHECK(on_prefs_loaded_callback_); DCHECK(clock_); pref_delegate_->WaitForPrefLoad( base::BindOnce(&HttpServerPropertiesManager::OnHttpServerPropertiesLoaded, pref_load_weak_ptr_factory_.GetWeakPtr())); net_log_.BeginEvent(NetLogEventType::HTTP_SERVER_PROPERTIES_INITIALIZATION); - - http_server_properties_impl_.reset( - new HttpServerPropertiesImpl(clock_, nullptr)); } HttpServerPropertiesManager::~HttpServerPropertiesManager() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - // Flush settings on destruction. - is_initialized_ = true; - UpdatePrefsFromCache(base::OnceClosure()); } -void HttpServerPropertiesManager::Clear(base::OnceClosure callback) { +void HttpServerPropertiesManager::ReadPrefs( + std::unique_ptr<SpdyServersMap>* spdy_servers_map, + std::unique_ptr<AlternativeServiceMap>* alternative_service_map, + std::unique_ptr<ServerNetworkStatsMap>* server_network_stats_map, + IPAddress* last_quic_address, + std::unique_ptr<QuicServerInfoMap>* quic_server_info_map, + std::unique_ptr<BrokenAlternativeServiceList>* + broken_alternative_service_list, + std::unique_ptr<RecentlyBrokenAlternativeServices>* + recently_broken_alternative_services, + bool* detected_corrupted_prefs) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - // Stop waiting for initial load. UpdatePrefsFromCache() would otherwise - // result in a reentrant call to OnHttpServerPropertiesLoaded() with empty - // prefs, which should be safe, except for DCHECKs, but seems safest to avoid - // it. - pref_load_weak_ptr_factory_.InvalidateWeakPtrs(); - is_initialized_ = true; - - http_server_properties_impl_->Clear(base::OnceClosure()); - UpdatePrefsFromCache(std::move(callback)); -} - -bool HttpServerPropertiesManager::SupportsRequestPriority( - const url::SchemeHostPort& server) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - return http_server_properties_impl_->SupportsRequestPriority(server); -} - -bool HttpServerPropertiesManager::GetSupportsSpdy( - const url::SchemeHostPort& server) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - return http_server_properties_impl_->GetSupportsSpdy(server); -} - -void HttpServerPropertiesManager::SetSupportsSpdy( - const url::SchemeHostPort& server, - bool support_spdy) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - - bool old_support_spdy = http_server_properties_impl_->GetSupportsSpdy(server); - http_server_properties_impl_->SetSupportsSpdy(server, support_spdy); - bool new_support_spdy = http_server_properties_impl_->GetSupportsSpdy(server); - if (old_support_spdy != new_support_spdy) - ScheduleUpdatePrefs(); -} - -bool HttpServerPropertiesManager::RequiresHTTP11(const HostPortPair& server) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - return http_server_properties_impl_->RequiresHTTP11(server); -} - -void HttpServerPropertiesManager::SetHTTP11Required( - const HostPortPair& server) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - - http_server_properties_impl_->SetHTTP11Required(server); - ScheduleUpdatePrefs(); -} - -void HttpServerPropertiesManager::MaybeForceHTTP11(const HostPortPair& server, - SSLConfig* ssl_config) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - http_server_properties_impl_->MaybeForceHTTP11(server, ssl_config); -} - -AlternativeServiceInfoVector -HttpServerPropertiesManager::GetAlternativeServiceInfos( - const url::SchemeHostPort& origin) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - return http_server_properties_impl_->GetAlternativeServiceInfos(origin); -} - -bool HttpServerPropertiesManager::SetHttp2AlternativeService( - const url::SchemeHostPort& origin, - const AlternativeService& alternative_service, - base::Time expiration) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - const bool changed = http_server_properties_impl_->SetHttp2AlternativeService( - origin, alternative_service, expiration); - if (changed) { - ScheduleUpdatePrefs(); - } - return changed; -} - -bool HttpServerPropertiesManager::SetQuicAlternativeService( - const url::SchemeHostPort& origin, - const AlternativeService& alternative_service, - base::Time expiration, - const quic::ParsedQuicVersionVector& advertised_versions) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - const bool changed = http_server_properties_impl_->SetQuicAlternativeService( - origin, alternative_service, expiration, advertised_versions); - if (changed) { - ScheduleUpdatePrefs(); - } - return changed; -} - -bool HttpServerPropertiesManager::SetAlternativeServices( - const url::SchemeHostPort& origin, - const AlternativeServiceInfoVector& alternative_service_info_vector) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - const bool changed = http_server_properties_impl_->SetAlternativeServices( - origin, alternative_service_info_vector); - if (changed) { - ScheduleUpdatePrefs(); - } - return changed; -} - -void HttpServerPropertiesManager::MarkAlternativeServiceBroken( - const AlternativeService& alternative_service) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - http_server_properties_impl_->MarkAlternativeServiceBroken( - alternative_service); - ScheduleUpdatePrefs(); -} - -void HttpServerPropertiesManager:: - MarkAlternativeServiceBrokenUntilDefaultNetworkChanges( - const AlternativeService& alternative_service) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - http_server_properties_impl_ - ->MarkAlternativeServiceBrokenUntilDefaultNetworkChanges( - alternative_service); - ScheduleUpdatePrefs(); -} - -void HttpServerPropertiesManager::MarkAlternativeServiceRecentlyBroken( - const AlternativeService& alternative_service) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - http_server_properties_impl_->MarkAlternativeServiceRecentlyBroken( - alternative_service); - ScheduleUpdatePrefs(); -} - -bool HttpServerPropertiesManager::IsAlternativeServiceBroken( - const AlternativeService& alternative_service) const { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - return http_server_properties_impl_->IsAlternativeServiceBroken( - alternative_service); -} - -bool HttpServerPropertiesManager::WasAlternativeServiceRecentlyBroken( - const AlternativeService& alternative_service) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - return http_server_properties_impl_->WasAlternativeServiceRecentlyBroken( - alternative_service); -} - -void HttpServerPropertiesManager::ConfirmAlternativeService( - const AlternativeService& alternative_service) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - bool old_value = http_server_properties_impl_->IsAlternativeServiceBroken( - alternative_service); - http_server_properties_impl_->ConfirmAlternativeService(alternative_service); - bool new_value = http_server_properties_impl_->IsAlternativeServiceBroken( - alternative_service); - // For persisting, we only care about the value returned by - // IsAlternativeServiceBroken. If that value changes, then call persist. - if (old_value != new_value) - ScheduleUpdatePrefs(); -} - -bool HttpServerPropertiesManager::OnDefaultNetworkChanged() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - bool changed = http_server_properties_impl_->OnDefaultNetworkChanged(); - if (changed) - ScheduleUpdatePrefs(); - return changed; -} - -const AlternativeServiceMap& -HttpServerPropertiesManager::alternative_service_map() const { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - return http_server_properties_impl_->alternative_service_map(); -} - -std::unique_ptr<base::Value> -HttpServerPropertiesManager::GetAlternativeServiceInfoAsValue() const { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - return http_server_properties_impl_->GetAlternativeServiceInfoAsValue(); -} - -bool HttpServerPropertiesManager::GetSupportsQuic( - IPAddress* last_address) const { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - return http_server_properties_impl_->GetSupportsQuic(last_address); -} - -void HttpServerPropertiesManager::SetSupportsQuic(bool used_quic, - const IPAddress& address) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - IPAddress old_last_quic_addr; - http_server_properties_impl_->GetSupportsQuic(&old_last_quic_addr); - http_server_properties_impl_->SetSupportsQuic(used_quic, address); - IPAddress new_last_quic_addr; - http_server_properties_impl_->GetSupportsQuic(&new_last_quic_addr); - if (old_last_quic_addr != new_last_quic_addr) - ScheduleUpdatePrefs(); -} - -void HttpServerPropertiesManager::SetServerNetworkStats( - const url::SchemeHostPort& server, - ServerNetworkStats stats) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - ServerNetworkStats old_stats; - const ServerNetworkStats* old_stats_ptr = - http_server_properties_impl_->GetServerNetworkStats(server); - if (http_server_properties_impl_->GetServerNetworkStats(server)) - old_stats = *old_stats_ptr; - http_server_properties_impl_->SetServerNetworkStats(server, stats); - ServerNetworkStats new_stats = - *(http_server_properties_impl_->GetServerNetworkStats(server)); - if (old_stats != new_stats) - ScheduleUpdatePrefs(); -} - -void HttpServerPropertiesManager::ClearServerNetworkStats( - const url::SchemeHostPort& server) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - bool need_update = - http_server_properties_impl_->GetServerNetworkStats(server) != nullptr; - http_server_properties_impl_->ClearServerNetworkStats(server); - if (need_update) - ScheduleUpdatePrefs(); -} - -const ServerNetworkStats* HttpServerPropertiesManager::GetServerNetworkStats( - const url::SchemeHostPort& server) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - return http_server_properties_impl_->GetServerNetworkStats(server); -} - -const ServerNetworkStatsMap& -HttpServerPropertiesManager::server_network_stats_map() const { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - return http_server_properties_impl_->server_network_stats_map(); -} - -bool HttpServerPropertiesManager::SetQuicServerInfo( - const quic::QuicServerId& server_id, - const std::string& server_info) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - bool changed = - http_server_properties_impl_->SetQuicServerInfo(server_id, server_info); - if (changed) - ScheduleUpdatePrefs(); - return changed; -} - -const std::string* HttpServerPropertiesManager::GetQuicServerInfo( - const quic::QuicServerId& server_id) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - return http_server_properties_impl_->GetQuicServerInfo(server_id); -} - -const QuicServerInfoMap& HttpServerPropertiesManager::quic_server_info_map() - const { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - return http_server_properties_impl_->quic_server_info_map(); -} - -size_t HttpServerPropertiesManager::max_server_configs_stored_in_properties() - const { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - return http_server_properties_impl_ - ->max_server_configs_stored_in_properties(); -} - -void HttpServerPropertiesManager::SetMaxServerConfigsStoredInProperties( - size_t max_server_configs_stored_in_properties) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - return http_server_properties_impl_->SetMaxServerConfigsStoredInProperties( - max_server_configs_stored_in_properties); -} - -bool HttpServerPropertiesManager::IsInitialized() const { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - - return is_initialized_; -} - -// static -base::TimeDelta HttpServerPropertiesManager::GetUpdatePrefsDelayForTesting() { - return kUpdatePrefsDelay; -} - -void HttpServerPropertiesManager::UpdateCacheFromPrefs() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - - DCHECK(!is_initialized_); - is_initialized_ = true; - net_log_.EndEvent(NetLogEventType::HTTP_SERVER_PROPERTIES_INITIALIZATION); const base::DictionaryValue* http_server_properties_dict = @@ -426,7 +148,6 @@ if (!http_server_properties_dict) return; - bool detected_corrupted_prefs = false; net_log_.AddEvent(NetLogEventType::HTTP_SERVER_PROPERTIES_UPDATE_CACHE, [&] { return http_server_properties_dict->Clone(); }); int version_number = kMissingVersion; @@ -459,19 +180,13 @@ return; } - std::unique_ptr<IPAddress> addr = std::make_unique<IPAddress>(); - ReadSupportsQuic(*http_server_properties_dict, addr.get()); + ReadSupportsQuic(*http_server_properties_dict, last_quic_address); - // String is "scheme://host:port" tuple of spdy server. - std::unique_ptr<SpdyServersMap> spdy_servers_map = - std::make_unique<SpdyServersMap>(); - std::unique_ptr<AlternativeServiceMap> alternative_service_map = - std::make_unique<AlternativeServiceMap>(); - std::unique_ptr<ServerNetworkStatsMap> server_network_stats_map = - std::make_unique<ServerNetworkStatsMap>(); - std::unique_ptr<QuicServerInfoMap> quic_server_info_map = - std::make_unique<QuicServerInfoMap>( - max_server_configs_stored_in_properties()); + *spdy_servers_map = std::make_unique<SpdyServersMap>(); + *alternative_service_map = std::make_unique<AlternativeServiceMap>(); + *server_network_stats_map = std::make_unique<ServerNetworkStatsMap>(); + *quic_server_info_map = std::make_unique<QuicServerInfoMap>( + max_server_configs_stored_in_properties_); // Iterate servers list in reverse MRU order so that entries are inserted // into |spdy_servers_map|, |alternative_service_map|, and @@ -480,33 +195,31 @@ --it; if (!it->GetAsDictionary(&servers_dict)) { DVLOG(1) << "Malformed http_server_properties for servers dictionary."; - detected_corrupted_prefs = true; + *detected_corrupted_prefs = true; continue; } - if (!AddServersData(*servers_dict, spdy_servers_map.get(), - alternative_service_map.get(), - server_network_stats_map.get())) { - detected_corrupted_prefs = true; + if (!AddServersData(*servers_dict, spdy_servers_map->get(), + alternative_service_map->get(), + server_network_stats_map->get())) { + *detected_corrupted_prefs = true; } } if (!AddToQuicServerInfoMap(*http_server_properties_dict, - quic_server_info_map.get())) { - detected_corrupted_prefs = true; + quic_server_info_map->get())) { + *detected_corrupted_prefs = true; } // Read list containing broken and recently-broken alternative services, if // it exists. - std::unique_ptr<BrokenAlternativeServiceList> broken_alternative_service_list; - std::unique_ptr<RecentlyBrokenAlternativeServices> - recently_broken_alternative_services; const base::ListValue* broken_alt_svc_list; if (http_server_properties_dict->GetListWithoutPathExpansion( kBrokenAlternativeServicesKey, &broken_alt_svc_list)) { - broken_alternative_service_list = + *broken_alternative_service_list = std::make_unique<BrokenAlternativeServiceList>(); - recently_broken_alternative_services = - std::make_unique<RecentlyBrokenAlternativeServices>(); + *recently_broken_alternative_services = + std::make_unique<RecentlyBrokenAlternativeServices>( + kMaxRecentlyBrokenAlternativeServiceEntries); // Iterate list in reverse-MRU order for (auto it = broken_alt_svc_list->end(); @@ -515,13 +228,13 @@ const base::DictionaryValue* entry_dict; if (!it->GetAsDictionary(&entry_dict)) { DVLOG(1) << "Malformed broken alterantive service entry."; - detected_corrupted_prefs = true; + *detected_corrupted_prefs = true; continue; } if (!AddToBrokenAlternativeServices( - *entry_dict, broken_alternative_service_list.get(), - recently_broken_alternative_services.get())) { - detected_corrupted_prefs = true; + *entry_dict, broken_alternative_service_list->get(), + recently_broken_alternative_services->get())) { + *detected_corrupted_prefs = true; continue; } } @@ -529,43 +242,25 @@ // Set the properties loaded from prefs on |http_server_properties_impl_|. - UMA_HISTOGRAM_COUNTS_1M("Net.CountOfSpdyServers", spdy_servers_map->size()); - http_server_properties_impl_->SetSpdyServers(std::move(spdy_servers_map)); + UMA_HISTOGRAM_COUNTS_1M("Net.CountOfSpdyServers", + (*spdy_servers_map)->size()); // Update the cached data and use the new alternative service list from // preferences. UMA_HISTOGRAM_COUNTS_1M("Net.CountOfAlternateProtocolServers", - alternative_service_map->size()); - http_server_properties_impl_->SetAlternativeServiceServers( - std::move(alternative_service_map)); - - http_server_properties_impl_->SetSupportsQuic(*addr); - - http_server_properties_impl_->SetServerNetworkStats( - std::move(server_network_stats_map)); + (*alternative_service_map)->size()); UMA_HISTOGRAM_COUNTS_1000("Net.CountOfQuicServerInfos", - quic_server_info_map->size()); + (*quic_server_info_map)->size()); - http_server_properties_impl_->SetQuicServerInfoMap( - std::move(quic_server_info_map)); - - if (recently_broken_alternative_services) { - DCHECK(broken_alternative_service_list); + if (*recently_broken_alternative_services) { + DCHECK(*broken_alternative_service_list); UMA_HISTOGRAM_COUNTS_1000("Net.CountOfBrokenAlternativeServices", - broken_alternative_service_list->size()); + (*broken_alternative_service_list)->size()); UMA_HISTOGRAM_COUNTS_1000("Net.CountOfRecentlyBrokenAlternativeServices", - recently_broken_alternative_services->size()); - - http_server_properties_impl_->SetBrokenAndRecentlyBrokenAlternativeServices( - std::move(broken_alternative_service_list), - std::move(recently_broken_alternative_services)); + (*recently_broken_alternative_services)->size()); } - - // Update the prefs with what we have read (delete all corrupted prefs). - if (detected_corrupted_prefs) - ScheduleUpdatePrefs(); } bool HttpServerPropertiesManager::AddToBrokenAlternativeServices( @@ -917,32 +612,27 @@ return !detected_corrupted_prefs; } -void HttpServerPropertiesManager::ScheduleUpdatePrefs() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - // Do not schedule an update if prefs are still loading, or there is already - // an update scheduled. - if (!is_initialized_ || network_prefs_update_timer_.IsRunning()) - return; - - network_prefs_update_timer_.Start( - FROM_HERE, kUpdatePrefsDelay, - base::Bind(&HttpServerPropertiesManager::UpdatePrefsFromCache, - base::Unretained(this), base::Passed(base::OnceClosure()))); -} - -void HttpServerPropertiesManager::UpdatePrefsFromCache( +void HttpServerPropertiesManager::WriteToPrefs( + const SpdyServersMap& spdy_servers_map, + const AlternativeServiceMap& alternative_service_map, + const GetCannonicalSuffix& get_canonical_suffix, + const ServerNetworkStatsMap& server_network_stats_map, + const IPAddress& last_quic_address, + const QuicServerInfoMap& quic_server_info_map, + const BrokenAlternativeServiceList& broken_alternative_service_list, + const RecentlyBrokenAlternativeServices& + recently_broken_alternative_services, base::OnceClosure callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - // Shouldn't update prefs until the initial prefs have been loaded. - DCHECK(is_initialized_); + // If loading prefs hasn't completed, don't call it, since this will overwrite + // existing prefs. + on_prefs_loaded_callback_.Reset(); typedef base::MRUCache<url::SchemeHostPort, ServerPref> ServerPrefMap; ServerPrefMap server_pref_map(ServerPrefMap::NO_AUTO_EVICT); // Add SPDY servers to |server_pref_map|. - const SpdyServersMap& spdy_servers_map = - http_server_properties_impl_->spdy_servers_map(); for (auto it = spdy_servers_map.rbegin(); it != spdy_servers_map.rend(); ++it) { // Only add servers that support SPDY. @@ -955,8 +645,6 @@ } // Add alternative service info to |server_pref_map|. - const AlternativeServiceMap& alternative_service_map = - http_server_properties_impl_->alternative_service_map(); UMA_HISTOGRAM_COUNTS_1M("Net.CountOfAlternateProtocolServers.Memory", alternative_service_map.size()); typedef std::map<std::string, bool> CanonicalHostPersistedMap; @@ -982,7 +670,7 @@ continue; } const std::string* canonical_suffix = - http_server_properties_impl_->GetCanonicalSuffix(server.host()); + get_canonical_suffix.Run(server.host()); if (canonical_suffix != nullptr) { if (persisted_map.find(*canonical_suffix) != persisted_map.end()) continue; @@ -997,8 +685,6 @@ } // Add server network stats to |server_pref_map|. - const ServerNetworkStatsMap& server_network_stats_map = - http_server_properties_impl_->server_network_stats_map(); for (auto it = server_network_stats_map.rbegin(); it != server_network_stats_map.rend(); ++it) { const url::SchemeHostPort& server = it->first; @@ -1044,20 +730,15 @@ http_server_properties_dict.SetInteger(kVersionKey, kVersionNumber); - IPAddress last_quic_addr; - if (http_server_properties_impl_->GetSupportsQuic(&last_quic_addr)) { - SaveSupportsQuicToPrefs(last_quic_addr, &http_server_properties_dict); - } + if (last_quic_address.IsValid()) + SaveSupportsQuicToPrefs(last_quic_address, &http_server_properties_dict); - SaveQuicServerInfoMapToServerPrefs( - http_server_properties_impl_->quic_server_info_map(), - &http_server_properties_dict); + SaveQuicServerInfoMapToServerPrefs(quic_server_info_map, + &http_server_properties_dict); SaveBrokenAlternativeServicesToPrefs( - http_server_properties_impl_->broken_alternative_service_list(), - kMaxBrokenAlternativeServicesToPersist, - http_server_properties_impl_->recently_broken_alternative_services(), - &http_server_properties_dict); + broken_alternative_service_list, kMaxBrokenAlternativeServicesToPersist, + recently_broken_alternative_services, &http_server_properties_dict); pref_delegate_->SetServerProperties(http_server_properties_dict, std::move(callback)); @@ -1222,7 +903,33 @@ void HttpServerPropertiesManager::OnHttpServerPropertiesLoaded() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - UpdateCacheFromPrefs(); + + // If prefs have already been written, nothing to do. + if (!on_prefs_loaded_callback_) + return; + + std::unique_ptr<SpdyServersMap> spdy_servers_map; + std::unique_ptr<AlternativeServiceMap> alternative_service_map; + std::unique_ptr<ServerNetworkStatsMap> server_network_stats_map; + IPAddress last_quic_address; + std::unique_ptr<QuicServerInfoMap> quic_server_info_map; + std::unique_ptr<BrokenAlternativeServiceList> broken_alternative_service_list; + std::unique_ptr<RecentlyBrokenAlternativeServices> + recently_broken_alternative_services; + bool detected_corrupted_prefs = false; + + ReadPrefs(&spdy_servers_map, &alternative_service_map, + &server_network_stats_map, &last_quic_address, + &quic_server_info_map, &broken_alternative_service_list, + &recently_broken_alternative_services, &detected_corrupted_prefs); + + std::move(on_prefs_loaded_callback_) + .Run(std::move(spdy_servers_map), std::move(alternative_service_map), + std::move(server_network_stats_map), last_quic_address, + std::move(quic_server_info_map), + std::move(broken_alternative_service_list), + std::move(recently_broken_alternative_services), + detected_corrupted_prefs); } } // namespace net
diff --git a/net/http/http_server_properties_manager.h b/net/http/http_server_properties_manager.h index 52b5744d..c2a3f5a 100644 --- a/net/http/http_server_properties_manager.h +++ b/net/http/http_server_properties_manager.h
@@ -5,29 +5,24 @@ #ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ #define NET_HTTP_HTTP_SERVER_PROPERTIES_MANAGER_H_ -#include <stdint.h> - #include <memory> #include <string> -#include <vector> #include "base/callback.h" -#include "base/compiler_specific.h" #include "base/gtest_prod_util.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/sequence_checker.h" -#include "base/time/default_tick_clock.h" -#include "base/time/time.h" -#include "base/timer/timer.h" #include "net/base/host_port_pair.h" #include "net/base/net_export.h" +#include "net/http/alternative_service.h" +#include "net/http/broken_alternative_services.h" #include "net/http/http_server_properties.h" -#include "net/http/http_server_properties_impl.h" #include "net/log/net_log_with_source.h" namespace base { class DictionaryValue; +class TickClock; } namespace net { @@ -37,128 +32,94 @@ //////////////////////////////////////////////////////////////////////////////// // HttpServerPropertiesManager -// The manager for creating and updating an HttpServerProperties (for example it -// tracks if a server supports SPDY or not). -class NET_EXPORT HttpServerPropertiesManager : public HttpServerProperties { +// Class responsible for serializing/deserializing HttpServerProperties and +// reading from/writing to preferences. +class NET_EXPORT_PRIVATE HttpServerPropertiesManager { public: - // Provides an interface to interact with persistent preferences storage - // implemented by the embedder. The prefs are assumed not to have been loaded - // before HttpServerPropertiesManager construction. - class NET_EXPORT PrefDelegate { - public: - virtual ~PrefDelegate(); + // Called when prefs are loaded. If prefs completely failed to load, + // everything will be nullptr. Otherwise, everything will be populated, except + // |broken_alternative_service_list| and + // |recently_broken_alternative_services|, which may be null. If prefs were + // present but some were corrupt, |prefs_corrupt| will be true. + using OnPrefsLoadedCallback = base::OnceCallback<void( + std::unique_ptr<SpdyServersMap> spdy_servers_map, + std::unique_ptr<AlternativeServiceMap> alternative_service_map, + std::unique_ptr<ServerNetworkStatsMap> server_network_stats_map, + const IPAddress& last_quic_address, + std::unique_ptr<QuicServerInfoMap> quic_server_info_map, + std::unique_ptr<BrokenAlternativeServiceList> + broken_alternative_service_list, + std::unique_ptr<RecentlyBrokenAlternativeServices> + recently_broken_alternative_services, + bool prefs_corrupt)>; - // Returns the branch of the preferences system for the server properties. - // Returns nullptr if the pref system has no data for the server properties. - virtual const base::DictionaryValue* GetServerProperties() const = 0; - - // Sets the server properties to the given value. If |callback| is - // non-empty, flushes data to persistent storage and invokes |callback| - // asynchronously when complete. - virtual void SetServerProperties(const base::DictionaryValue& value, - base::OnceClosure callback) = 0; - - // Starts listening for prefs to be loaded. If prefs are already loaded, - // |pref_loaded_callback| will be invoked asynchronously. Callback will be - // invoked even if prefs fail to load. Will only be called once by the - // HttpServerPropertiesManager. - virtual void WaitForPrefLoad(base::OnceClosure pref_loaded_callback) = 0; - }; + using GetCannonicalSuffix = + base::RepeatingCallback<const std::string*(const std::string& host)>; // Create an instance of the HttpServerPropertiesManager. // - // Server propertise will be loaded from |pref_delegate| the first time it - // notifies the HttpServerPropertiesManager of an update, indicating the prefs - // have been loaded from disk. + // |on_prefs_loaded_callback| will be invoked with values loaded from + // |prefs_delegate| once prefs have been loaded from disk. + // If WriteToPrefs() is invoked before this happens, + // |on_prefs_loaded_callback| will never be invoked, since the written prefs + // take precedence over the ones previously stored on disk. // // |clock| is used for setting expiration times and scheduling the - // expiration of broken alternative services. If null, the default clock will - // be used. - HttpServerPropertiesManager(std::unique_ptr<PrefDelegate> pref_delegate, - NetLog* net_log, - const base::TickClock* clock = nullptr); + // expiration of broken alternative services, and must not be nullptr. + HttpServerPropertiesManager( + std::unique_ptr<HttpServerProperties::PrefDelegate> pref_delegate, + OnPrefsLoadedCallback on_prefs_loaded_callback, + size_t max_server_configs_stored_in_properties, + NetLog* net_log, + const base::TickClock* clock = nullptr); - ~HttpServerPropertiesManager() override; + ~HttpServerPropertiesManager(); - // ---------------------------------- - // HttpServerProperties methods: - // ---------------------------------- + // Populates passed in objects with data from preferences. If pref data is not + // present, leaves all values alone. Otherwise, populates them all, with the + // possible exception of the two broken alt services lists. + // + // TODO(mmenke): Consider always populating fields, unconditionally, for a + // simpler API. + void ReadPrefs( + std::unique_ptr<SpdyServersMap>* spdy_servers_map, + std::unique_ptr<AlternativeServiceMap>* alternative_service_map, + std::unique_ptr<ServerNetworkStatsMap>* server_network_stats_map, + IPAddress* last_quic_address, + std::unique_ptr<QuicServerInfoMap>* quic_server_info_map, + std::unique_ptr<BrokenAlternativeServiceList>* + broken_alternative_service_list, + std::unique_ptr<RecentlyBrokenAlternativeServices>* + recently_broken_alternative_services, + bool* detected_corrupted_prefs); - void Clear(base::OnceClosure callback) override; - bool SupportsRequestPriority(const url::SchemeHostPort& server) override; - bool GetSupportsSpdy(const url::SchemeHostPort& server) override; - void SetSupportsSpdy(const url::SchemeHostPort& server, - bool support_spdy) override; - bool RequiresHTTP11(const HostPortPair& server) override; - void SetHTTP11Required(const HostPortPair& server) override; - void MaybeForceHTTP11(const HostPortPair& server, - SSLConfig* ssl_config) override; - AlternativeServiceInfoVector GetAlternativeServiceInfos( - const url::SchemeHostPort& origin) override; - bool SetHttp2AlternativeService(const url::SchemeHostPort& origin, - const AlternativeService& alternative_service, - base::Time expiration) override; - bool SetQuicAlternativeService( - const url::SchemeHostPort& origin, - const AlternativeService& alternative_service, - base::Time expiration, - const quic::ParsedQuicVersionVector& advertised_versions) override; - bool SetAlternativeServices(const url::SchemeHostPort& origin, - const AlternativeServiceInfoVector& - alternative_service_info_vector) override; - void MarkAlternativeServiceBroken( - const AlternativeService& alternative_service) override; - void MarkAlternativeServiceBrokenUntilDefaultNetworkChanges( - const AlternativeService& alternative_service) override; - void MarkAlternativeServiceRecentlyBroken( - const AlternativeService& alternative_service) override; - bool IsAlternativeServiceBroken( - const AlternativeService& alternative_service) const override; - bool WasAlternativeServiceRecentlyBroken( - const AlternativeService& alternative_service) override; - void ConfirmAlternativeService( - const AlternativeService& alternative_service) override; - bool OnDefaultNetworkChanged() override; - const AlternativeServiceMap& alternative_service_map() const override; - std::unique_ptr<base::Value> GetAlternativeServiceInfoAsValue() - const override; - bool GetSupportsQuic(IPAddress* last_address) const override; - void SetSupportsQuic(bool used_quic, const IPAddress& last_address) override; - void SetServerNetworkStats(const url::SchemeHostPort& server, - ServerNetworkStats stats) override; - void ClearServerNetworkStats(const url::SchemeHostPort& server) override; - const ServerNetworkStats* GetServerNetworkStats( - const url::SchemeHostPort& server) override; - const ServerNetworkStatsMap& server_network_stats_map() const override; - bool SetQuicServerInfo(const quic::QuicServerId& server_id, - const std::string& server_info) override; - const std::string* GetQuicServerInfo( - const quic::QuicServerId& server_id) override; - const QuicServerInfoMap& quic_server_info_map() const override; - size_t max_server_configs_stored_in_properties() const override; - void SetMaxServerConfigsStoredInProperties( - size_t max_server_configs_stored_in_properties) override; - bool IsInitialized() const override; + void set_max_server_configs_stored_in_properties( + size_t max_server_configs_stored_in_properties) { + max_server_configs_stored_in_properties_ = + max_server_configs_stored_in_properties; + } - static base::TimeDelta GetUpdatePrefsDelayForTesting(); - - protected: - // Update cached prefs in |http_server_properties_impl_| with data from - // preferences. - void UpdateCacheFromPrefs(); - - // These are used to delay updating the preferences when cached data in - // |http_server_properties_impl_| is changing, and execute only one update per - // simultaneous changes. - // |location| specifies where this method is called from. - void ScheduleUpdatePrefs(); - - // Update prefs::kHttpServerProperties in preferences with the cached data - // from |http_server_properties_impl_|. Invokes |callback| when changes have - // been committed, if non-null. - void UpdatePrefsFromCache(base::OnceClosure callback); + // Update preferences with caller-provided data. Invokes |callback| when + // changes have been committed, if non-null. + // + // If the OnPrefLoadCallback() passed to the constructor hasn't been invoked + // by the time this method is called, calling this will prevent it from ever + // being invoked, as this method will overwrite any previous preferences. + void WriteToPrefs( + const SpdyServersMap& spdy_servers_map, + const AlternativeServiceMap& alternative_service_map, + const GetCannonicalSuffix& get_canonical_suffix, + const ServerNetworkStatsMap& server_network_stats_map, + const IPAddress& last_quic_address, + const QuicServerInfoMap& quic_server_info_map, + const BrokenAlternativeServiceList& broken_alternative_service_list, + const RecentlyBrokenAlternativeServices& + recently_broken_alternative_services, + base::OnceClosure callback); private: + // TODO(mmenke): Remove these friend methods, and make all methods static that + // can be. FRIEND_TEST_ALL_PREFIXES(HttpServerPropertiesManagerTest, AddToAlternativeServiceMap); FRIEND_TEST_ALL_PREFIXES(HttpServerPropertiesManagerTest, @@ -225,18 +186,14 @@ void OnHttpServerPropertiesLoaded(); - std::unique_ptr<PrefDelegate> pref_delegate_; + std::unique_ptr<HttpServerProperties::PrefDelegate> pref_delegate_; + + OnPrefsLoadedCallback on_prefs_loaded_callback_; + + size_t max_server_configs_stored_in_properties_; const base::TickClock* clock_; // Unowned - // Set to true once the initial prefs have been loaded. - bool is_initialized_ = false; - - // Used to post |prefs::kHttpServerProperties| pref update tasks. - base::OneShotTimer network_prefs_update_timer_; - - std::unique_ptr<HttpServerPropertiesImpl> http_server_properties_impl_; - const NetLogWithSource net_log_; SEQUENCE_CHECKER(sequence_checker_);
diff --git a/net/http/http_server_properties_manager_unittest.cc b/net/http/http_server_properties_manager_unittest.cc index 3dbf12ce..7d47e53 100644 --- a/net/http/http_server_properties_manager_unittest.cc +++ b/net/http/http_server_properties_manager_unittest.cc
@@ -18,6 +18,7 @@ #include "base/values.h" #include "net/base/ip_address.h" #include "net/http/http_network_session.h" +#include "net/http/http_server_properties.h" #include "net/test/test_with_scoped_task_environment.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -34,12 +35,12 @@ using ::testing::Mock; using ::testing::StrictMock; -class MockPrefDelegate : public net::HttpServerPropertiesManager::PrefDelegate { +class MockPrefDelegate : public net::HttpServerProperties::PrefDelegate { public: MockPrefDelegate() = default; ~MockPrefDelegate() override = default; - // HttpServerPropertiesManager::PrefDelegate implementation. + // HttpServerProperties::PrefDelegate implementation. const base::DictionaryValue* GetServerProperties() const override { return &prefs_; } @@ -99,6 +100,8 @@ } // namespace +// TODO(mmenke): Move these tests in with the other HttpServerProperties +// tests, and rename |http_server_props_manager_|. class HttpServerPropertiesManagerTest : public testing::Test, public WithScopedTaskEnvironment { protected: @@ -112,7 +115,7 @@ HttpNetworkSession::Params().quic_params.supported_versions; pref_delegate_ = new MockPrefDelegate; - http_server_props_manager_ = std::make_unique<HttpServerPropertiesManager>( + http_server_props_manager_ = std::make_unique<HttpServerProperties>( base::WrapUnique(pref_delegate_), /*net_log=*/nullptr, GetMockTickClock()); @@ -148,7 +151,7 @@ // Run pending non-delayed tasks but don't FastForwardUntilNoTasksRemain() // as some delayed tasks may forever repost (e.g. because impl doesn't use a // mock clock and doesn't see timings as having expired, ref. - // HttpServerPropertiesImpl:: + // HttpServerProperties:: // ScheduleBrokenAlternateProtocolMappingsExpiration()). base::RunLoop().RunUntilIdle(); http_server_props_manager_.reset(); @@ -168,7 +171,7 @@ } MockPrefDelegate* pref_delegate_; // Owned by HttpServerPropertiesManager. - std::unique_ptr<HttpServerPropertiesManager> http_server_props_manager_; + std::unique_ptr<HttpServerProperties> http_server_props_manager_; base::Time one_day_from_now_; quic::ParsedQuicVersionVector advertised_versions_; @@ -313,7 +316,7 @@ EXPECT_EQ(1u, GetPendingMainThreadTaskCount()); // Move forward the task runner short by 20ms. - FastForwardBy(HttpServerPropertiesManager::GetUpdatePrefsDelayForTesting() - + FastForwardBy(HttpServerProperties::GetUpdatePrefsDelayForTesting() - base::TimeDelta::FromMilliseconds(20)); // Set another spdy server to trigger another call to @@ -842,7 +845,7 @@ // Advance time by just enough so that the prefs update task is executed but // not the task to expire the brokenness of |broken_alternative_service|. - FastForwardBy(HttpServerPropertiesManager::GetUpdatePrefsDelayForTesting()); + FastForwardBy(HttpServerProperties::GetUpdatePrefsDelayForTesting()); EXPECT_NE(0u, GetPendingMainThreadTaskCount()); EXPECT_EQ(1, pref_delegate_->GetAndClearNumPrefUpdates()); @@ -1015,7 +1018,7 @@ // |broken_alternative_service|. EXPECT_EQ(2u, GetPendingMainThreadTaskCount()); EXPECT_EQ(0, pref_delegate_->GetAndClearNumPrefUpdates()); - FastForwardBy(HttpServerPropertiesManager::GetUpdatePrefsDelayForTesting()); + FastForwardBy(HttpServerProperties::GetUpdatePrefsDelayForTesting()); EXPECT_EQ(1u, GetPendingMainThreadTaskCount()); EXPECT_EQ(1, pref_delegate_->GetAndClearNumPrefUpdates()); @@ -1058,7 +1061,7 @@ ASSERT_TRUE(base::StringToInt64(expiration_string, &expiration_int64)); base::TimeDelta expiration_delta = base::TimeDelta::FromMinutes(5) - - HttpServerPropertiesManager::GetUpdatePrefsDelayForTesting(); + HttpServerProperties::GetUpdatePrefsDelayForTesting(); time_t time_t_of_prefs_update = static_cast<time_t>(expiration_int64); EXPECT_LE((time_before_prefs_update + expiration_delta).ToTimeT(), time_t_of_prefs_update); @@ -1112,8 +1115,9 @@ const url::SchemeHostPort server("https", "example.com", 443); AlternativeServiceMap alternative_service_map; - EXPECT_TRUE(http_server_props_manager_->AddToAlternativeServiceMap( - server, *server_dict, &alternative_service_map)); + EXPECT_TRUE(http_server_props_manager_->properties_manager_for_testing() + ->AddToAlternativeServiceMap(server, *server_dict, + &alternative_service_map)); auto it = alternative_service_map.Get(server); ASSERT_NE(alternative_service_map.end(), it); @@ -1163,8 +1167,9 @@ const url::SchemeHostPort server("http", "example.com", 80); AlternativeServiceMap alternative_service_map; - EXPECT_FALSE(http_server_props_manager_->AddToAlternativeServiceMap( - server, *server_dict, &alternative_service_map)); + EXPECT_FALSE(http_server_props_manager_->properties_manager_for_testing() + ->AddToAlternativeServiceMap(server, *server_dict, + &alternative_service_map)); auto it = alternative_service_map.Get(server); EXPECT_EQ(alternative_service_map.end(), it); @@ -1212,7 +1217,7 @@ // |broken_alternative_service|. EXPECT_EQ(2U, GetPendingMainThreadTaskCount()); EXPECT_EQ(0, pref_delegate_->GetAndClearNumPrefUpdates()); - FastForwardBy(HttpServerPropertiesManager::GetUpdatePrefsDelayForTesting()); + FastForwardBy(HttpServerProperties::GetUpdatePrefsDelayForTesting()); EXPECT_EQ(1U, GetPendingMainThreadTaskCount()); EXPECT_EQ(1, pref_delegate_->GetAndClearNumPrefUpdates()); @@ -1276,8 +1281,9 @@ const url::SchemeHostPort server("https", "example.com", 443); AlternativeServiceMap alternative_service_map; - ASSERT_TRUE(http_server_props_manager_->AddToAlternativeServiceMap( - server, server_pref_dict, &alternative_service_map)); + ASSERT_TRUE(http_server_props_manager_->properties_manager_for_testing() + ->AddToAlternativeServiceMap(server, server_pref_dict, + &alternative_service_map)); auto it = alternative_service_map.Get(server); ASSERT_NE(alternative_service_map.end(), it); @@ -1400,8 +1406,9 @@ const url::SchemeHostPort server("https", "example.com", 443); AlternativeServiceMap alternative_service_map; - EXPECT_TRUE(http_server_props_manager_->AddToAlternativeServiceMap( - server, *server_dict, &alternative_service_map)); + EXPECT_TRUE(http_server_props_manager_->properties_manager_for_testing() + ->AddToAlternativeServiceMap(server, *server_dict, + &alternative_service_map)); auto it = alternative_service_map.Get(server); ASSERT_NE(alternative_service_map.end(), it);
diff --git a/net/http/http_server_properties_impl_unittest.cc b/net/http/http_server_properties_unittest.cc similarity index 94% rename from net/http/http_server_properties_impl_unittest.cc rename to net/http/http_server_properties_unittest.cc index 95aa25dd..1f997c9 100644 --- a/net/http/http_server_properties_impl_unittest.cc +++ b/net/http/http_server_properties_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include <memory> #include <string> @@ -36,10 +36,10 @@ base::TimeDelta::FromSeconds(76800), base::TimeDelta::FromSeconds(153600), }; -class HttpServerPropertiesImplPeer { +class HttpServerPropertiesPeer { public: static void AddBrokenAlternativeServiceWithExpirationTime( - HttpServerPropertiesImpl* impl, + HttpServerProperties* impl, const AlternativeService& alternative_service, base::TimeTicks when) { BrokenAlternativeServiceList::iterator unused_it; @@ -58,20 +58,23 @@ } static void ExpireBrokenAlternateProtocolMappings( - HttpServerPropertiesImpl* impl) { + HttpServerProperties* impl) { impl->broken_alternative_services_.ExpireBrokenAlternateProtocolMappings(); } }; namespace { -class HttpServerPropertiesImplTest : public TestWithScopedTaskEnvironment { +class HttpServerPropertiesTest : public TestWithScopedTaskEnvironment { protected: - HttpServerPropertiesImplTest() + HttpServerPropertiesTest() : TestWithScopedTaskEnvironment( base::test::ScopedTaskEnvironment::TimeSource::MOCK_TIME), test_tick_clock_(GetMockTickClock()), - impl_(test_tick_clock_, &test_clock_) { + impl_(nullptr /* pref_delegate */, + nullptr /* net_log */, + test_tick_clock_, + &test_clock_) { // Set |test_clock_| to some random time. test_clock_.Advance(base::TimeDelta::FromSeconds(12345)); } @@ -103,10 +106,10 @@ const base::TickClock* test_tick_clock_; base::SimpleTestClock test_clock_; - HttpServerPropertiesImpl impl_; + HttpServerProperties impl_; }; -typedef HttpServerPropertiesImplTest SpdyServerPropertiesTest; +typedef HttpServerPropertiesTest SpdyServerPropertiesTest; TEST_F(SpdyServerPropertiesTest, SetWithSchemeHostPort) { // Check spdy servers are correctly set with SchemeHostPort key. @@ -127,7 +130,7 @@ std::make_unique<SpdyServersMap>(); spdy_servers1->Put(spdy_server_g, true); spdy_servers1->Put(spdy_server_p, true); - impl_.SetSpdyServers(std::move(spdy_servers1)); + impl_.OnSpdyServersLoadedForTesting(std::move(spdy_servers1)); EXPECT_TRUE(impl_.SupportsRequestPriority(http_photo_server)); EXPECT_TRUE(impl_.SupportsRequestPriority(https_www_server)); EXPECT_FALSE(impl_.SupportsRequestPriority(http_google_server)); @@ -151,7 +154,7 @@ // Check by initializing empty spdy servers. std::unique_ptr<SpdyServersMap> spdy_servers = std::make_unique<SpdyServersMap>(); - impl_.SetSpdyServers(std::move(spdy_servers)); + impl_.OnSpdyServersLoadedForTesting(std::move(spdy_servers)); EXPECT_FALSE(impl_.SupportsRequestPriority(spdy_server_google)); // Check by initializing www.google.com:443 and photos.google.com:443 as spdy @@ -160,14 +163,14 @@ std::make_unique<SpdyServersMap>(); spdy_servers1->Put(spdy_server_g, true); spdy_servers1->Put(spdy_server_p, true); - impl_.SetSpdyServers(std::move(spdy_servers1)); + impl_.OnSpdyServersLoadedForTesting(std::move(spdy_servers1)); // Note: these calls affect MRU order. EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_google)); EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_photos)); // Verify spdy_server_g and spdy_server_d are in the list in MRU order. - ASSERT_EQ(2U, impl_.spdy_servers_map().size()); - auto it = impl_.spdy_servers_map().begin(); + ASSERT_EQ(2U, impl_.spdy_servers_map_for_testing().size()); + auto it = impl_.spdy_servers_map_for_testing().begin(); EXPECT_EQ(spdy_server_p, it->first); EXPECT_TRUE(it->second); ++it; @@ -180,13 +183,13 @@ std::make_unique<SpdyServersMap>(); spdy_servers2->Put(spdy_server_m, true); spdy_servers2->Put(spdy_server_d, true); - impl_.SetSpdyServers(std::move(spdy_servers2)); + impl_.OnSpdyServersLoadedForTesting(std::move(spdy_servers2)); // Verify all the servers are in the list in MRU order. Note that - // SetSpdyServers will put existing spdy server entries in front of newly - // added entries. - ASSERT_EQ(4U, impl_.spdy_servers_map().size()); - it = impl_.spdy_servers_map().begin(); + // OnSpdyServersLoadedForTesting will put existing spdy server entries in + // front of newly added entries. + ASSERT_EQ(4U, impl_.spdy_servers_map_for_testing().size()); + it = impl_.spdy_servers_map_for_testing().begin(); EXPECT_EQ(spdy_server_p, it->first); EXPECT_TRUE(it->second); ++it; @@ -214,11 +217,11 @@ std::make_unique<SpdyServersMap>(); spdy_servers3->Put(spdy_server_m, false); spdy_servers3->Put(spdy_server_p, false); - impl_.SetSpdyServers(std::move(spdy_servers3)); + impl_.OnSpdyServersLoadedForTesting(std::move(spdy_servers3)); // Verify the entries are in the same order. - ASSERT_EQ(4U, impl_.spdy_servers_map().size()); - it = impl_.spdy_servers_map().begin(); + ASSERT_EQ(4U, impl_.spdy_servers_map_for_testing().size()); + it = impl_.spdy_servers_map_for_testing().begin(); EXPECT_EQ(spdy_server_p, it->first); EXPECT_FALSE(it->second); ++it; @@ -314,29 +317,29 @@ // Add www.google.com:443 as supporting SPDY. impl_.SetSupportsSpdy(spdy_server_google, true); - ASSERT_EQ(1u, impl_.spdy_servers_map().size()); - auto it = impl_.spdy_servers_map().begin(); + ASSERT_EQ(1u, impl_.spdy_servers_map_for_testing().size()); + auto it = impl_.spdy_servers_map_for_testing().begin(); ASSERT_EQ(spdy_server_g, it->first); // Add mail.google.com:443 as supporting SPDY. Verify mail.google.com:443 and // www.google.com:443 are in the list. impl_.SetSupportsSpdy(spdy_server_mail, true); - ASSERT_EQ(2u, impl_.spdy_servers_map().size()); - it = impl_.spdy_servers_map().begin(); + ASSERT_EQ(2u, impl_.spdy_servers_map_for_testing().size()); + it = impl_.spdy_servers_map_for_testing().begin(); ASSERT_EQ(spdy_server_m, it->first); ++it; ASSERT_EQ(spdy_server_g, it->first); // Get www.google.com:443. It should become the most-recently-used server. EXPECT_TRUE(impl_.SupportsRequestPriority(spdy_server_google)); - ASSERT_EQ(2u, impl_.spdy_servers_map().size()); - it = impl_.spdy_servers_map().begin(); + ASSERT_EQ(2u, impl_.spdy_servers_map_for_testing().size()); + it = impl_.spdy_servers_map_for_testing().begin(); ASSERT_EQ(spdy_server_g, it->first); ++it; ASSERT_EQ(spdy_server_m, it->first); } -typedef HttpServerPropertiesImplTest AlternateProtocolServerPropertiesTest; +typedef HttpServerPropertiesTest AlternateProtocolServerPropertiesTest; TEST_F(AlternateProtocolServerPropertiesTest, Basic) { url::SchemeHostPort test_server("http", "foo", 80); @@ -392,7 +395,7 @@ TEST_F(AlternateProtocolServerPropertiesTest, Set) { // |test_server1| has an alternative service, which will not be - // affected by SetAlternativeServiceServers(), because + // affected by OnAlternativeServiceServersLoadedForTesting(), because // |alternative_service_map| does not have an entry for // |test_server1|. url::SchemeHostPort test_server1("http", "foo1", 80); @@ -404,7 +407,7 @@ expiration1); // |test_server2| has an alternative service, which will be - // overwritten by SetAlternativeServiceServers(), because + // overwritten by OnAlternativeServiceServersLoadedForTesting(), because // |alternative_service_map| has an entry for // |test_server2|. AlternativeServiceInfoVector alternative_service_info_vector; @@ -418,7 +421,7 @@ impl_.SetAlternativeServices(test_server2, alternative_service_info_vector); // Prepare |alternative_service_map| to be loaded by - // SetAlternativeServiceServers(). + // OnAlternativeServiceServersLoadedForTesting(). std::unique_ptr<AlternativeServiceMap> alternative_service_map = std::make_unique<AlternativeServiceMap>(); const AlternativeService alternative_service3(kProtoHTTP2, "bar3", 123); @@ -444,7 +447,8 @@ AlternativeServiceInfoVector(/*size=*/1, alternative_service_info2)); // MRU list will be test_server2, test_server1, test_server3. - impl_.SetAlternativeServiceServers(std::move(alternative_service_map)); + impl_.OnAlternativeServiceServersLoadedForTesting( + std::move(alternative_service_map)); // Verify alternative_service_map. const AlternativeServiceMap& map = impl_.alternative_service_map(); @@ -468,8 +472,8 @@ } // Regression test for https://crbug.com/504032: -// SetAlternativeServiceServers() should not crash if there is an empty -// hostname is the mapping. +// OnAlternativeServiceServersLoadedForTesting() should not crash if there is an +// empty hostname is the mapping. TEST_F(AlternateProtocolServerPropertiesTest, SetWithEmptyHostname) { url::SchemeHostPort server("https", "foo", 443); const AlternativeService alternative_service_with_empty_hostname(kProtoHTTP2, @@ -481,7 +485,8 @@ std::unique_ptr<AlternativeServiceMap> alternative_service_map = std::make_unique<AlternativeServiceMap>(); - impl_.SetAlternativeServiceServers(std::move(alternative_service_map)); + impl_.OnAlternativeServiceServersLoadedForTesting( + std::move(alternative_service_map)); EXPECT_TRUE( impl_.IsAlternativeServiceBroken(alternative_service_with_foo_hostname)); @@ -510,7 +515,8 @@ // Prepare |alternative_service_map_| with a single key that has a single // AlternativeServiceInfo with identical hostname and port. - impl_.SetAlternativeServiceServers(std::move(alternative_service_map)); + impl_.OnAlternativeServiceServersLoadedForTesting( + std::move(alternative_service_map)); // GetAlternativeServiceInfos() should remove such AlternativeServiceInfo from // |alternative_service_map_|, emptying the AlternativeServiceInfoVector @@ -544,7 +550,8 @@ // Prepare |alternative_service_map_| with a single key that has a single // AlternativeServiceInfo with identical hostname and port. - impl_.SetAlternativeServiceServers(std::move(alternative_service_map)); + impl_.OnAlternativeServiceServersLoadedForTesting( + std::move(alternative_service_map)); // GetAlternativeServiceInfos() should remove such AlternativeServiceInfo from // |alternative_service_map_|, emptying the AlternativeServiceInfoVector @@ -1014,9 +1021,10 @@ alternative_service_info_vector2[1].alternative_service().port); // Verify the canonical suffix. - EXPECT_EQ(".c.youtube.com", *impl_.GetCanonicalSuffix(test_server.host())); EXPECT_EQ(".c.youtube.com", - *impl_.GetCanonicalSuffix(canonical_server.host())); + *impl_.GetCanonicalSuffixForTesting(test_server.host())); + EXPECT_EQ(".c.youtube.com", + *impl_.GetCanonicalSuffixForTesting(canonical_server.host())); } TEST_F(AlternateProtocolServerPropertiesTest, ClearCanonical) { @@ -1103,12 +1111,12 @@ base::TimeTicks past = test_tick_clock_->NowTicks() - base::TimeDelta::FromSeconds(42); - HttpServerPropertiesImplPeer::AddBrokenAlternativeServiceWithExpirationTime( + HttpServerPropertiesPeer::AddBrokenAlternativeServiceWithExpirationTime( &impl_, alternative_service, past); EXPECT_TRUE(impl_.IsAlternativeServiceBroken(alternative_service)); EXPECT_TRUE(impl_.WasAlternativeServiceRecentlyBroken(alternative_service)); - HttpServerPropertiesImplPeer::ExpireBrokenAlternateProtocolMappings(&impl_); + HttpServerPropertiesPeer::ExpireBrokenAlternateProtocolMappings(&impl_); EXPECT_FALSE(impl_.IsAlternativeServiceBroken(alternative_service)); EXPECT_TRUE(impl_.WasAlternativeServiceRecentlyBroken(alternative_service)); } @@ -1133,11 +1141,11 @@ // Mark "bar:443" as broken. base::TimeTicks past = test_tick_clock_->NowTicks() - base::TimeDelta::FromSeconds(42); - HttpServerPropertiesImplPeer::AddBrokenAlternativeServiceWithExpirationTime( + HttpServerPropertiesPeer::AddBrokenAlternativeServiceWithExpirationTime( &impl_, bar_alternative_service, past); // Expire brokenness of "bar:443". - HttpServerPropertiesImplPeer::ExpireBrokenAlternateProtocolMappings(&impl_); + HttpServerPropertiesPeer::ExpireBrokenAlternateProtocolMappings(&impl_); // "foo:443" should have no alternative service now. EXPECT_FALSE(HasAlternativeService(foo_server)); @@ -1284,14 +1292,14 @@ EXPECT_EQ(expected_json, alternative_service_info_json); } -typedef HttpServerPropertiesImplTest SupportsQuicServerPropertiesTest; +typedef HttpServerPropertiesTest SupportsQuicServerPropertiesTest; TEST_F(SupportsQuicServerPropertiesTest, Set) { HostPortPair quic_server_google("www.google.com", 443); // Check by initializing empty address. IPAddress initial_address; - impl_.SetSupportsQuic(initial_address); + impl_.OnSupportsQuicLoadedForTesting(initial_address); IPAddress address; EXPECT_FALSE(impl_.GetSupportsQuic(&address)); @@ -1299,7 +1307,7 @@ // Check by initializing with a valid address. initial_address = IPAddress::IPv4Localhost(); - impl_.SetSupportsQuic(initial_address); + impl_.OnSupportsQuicLoadedForTesting(initial_address); EXPECT_TRUE(impl_.GetSupportsQuic(&address)); EXPECT_EQ(initial_address, address); @@ -1321,7 +1329,7 @@ EXPECT_FALSE(impl_.GetSupportsQuic(&address)); } -typedef HttpServerPropertiesImplTest ServerNetworkStatsServerPropertiesTest; +typedef HttpServerPropertiesTest ServerNetworkStatsServerPropertiesTest; TEST_F(ServerNetworkStatsServerPropertiesTest, Set) { url::SchemeHostPort google_server("https", "www.google.com", 443); @@ -1329,9 +1337,10 @@ // Check by initializing empty ServerNetworkStats. std::unique_ptr<ServerNetworkStatsMap> init_server_network_stats_map = std::make_unique<ServerNetworkStatsMap>(); - impl_.SetServerNetworkStats(std::move(init_server_network_stats_map)); + impl_.OnServerNetworkStatsLoadedForTesting( + std::move(init_server_network_stats_map)); const ServerNetworkStats* stats = impl_.GetServerNetworkStats(google_server); - EXPECT_EQ(NULL, stats); + EXPECT_EQ(nullptr, stats); // Check by initializing with www.google.com:443. ServerNetworkStats stats_google; @@ -1339,7 +1348,8 @@ stats_google.bandwidth_estimate = quic::QuicBandwidth::FromBitsPerSecond(100); init_server_network_stats_map = std::make_unique<ServerNetworkStatsMap>(); init_server_network_stats_map->Put(google_server, stats_google); - impl_.SetServerNetworkStats(std::move(init_server_network_stats_map)); + impl_.OnServerNetworkStatsLoadedForTesting( + std::move(init_server_network_stats_map)); // Verify data for www.google.com:443. ASSERT_EQ(1u, impl_.server_network_stats_map().size()); @@ -1376,7 +1386,8 @@ server_network_stats_map->Put(mail_server, stats_mail); // Recency order will be |docs_server|, |google_server| and |mail_server|. - impl_.SetServerNetworkStats(std::move(server_network_stats_map)); + impl_.OnServerNetworkStatsLoadedForTesting( + std::move(server_network_stats_map)); const ServerNetworkStatsMap& map = impl_.server_network_stats_map(); ASSERT_EQ(3u, map.size()); @@ -1395,8 +1406,8 @@ TEST_F(ServerNetworkStatsServerPropertiesTest, SetServerNetworkStats) { url::SchemeHostPort foo_http_server("http", "foo", 443); url::SchemeHostPort foo_https_server("https", "foo", 443); - EXPECT_EQ(NULL, impl_.GetServerNetworkStats(foo_http_server)); - EXPECT_EQ(NULL, impl_.GetServerNetworkStats(foo_https_server)); + EXPECT_EQ(nullptr, impl_.GetServerNetworkStats(foo_http_server)); + EXPECT_EQ(nullptr, impl_.GetServerNetworkStats(foo_https_server)); ServerNetworkStats stats1; stats1.srtt = base::TimeDelta::FromMicroseconds(10); @@ -1408,11 +1419,11 @@ EXPECT_EQ(10, stats2->srtt.ToInternalValue()); EXPECT_EQ(100, stats2->bandwidth_estimate.ToBitsPerSecond()); // Https server should have nothing set for server network stats. - EXPECT_EQ(NULL, impl_.GetServerNetworkStats(foo_https_server)); + EXPECT_EQ(nullptr, impl_.GetServerNetworkStats(foo_https_server)); impl_.Clear(base::OnceClosure()); - EXPECT_EQ(NULL, impl_.GetServerNetworkStats(foo_http_server)); - EXPECT_EQ(NULL, impl_.GetServerNetworkStats(foo_https_server)); + EXPECT_EQ(nullptr, impl_.GetServerNetworkStats(foo_http_server)); + EXPECT_EQ(nullptr, impl_.GetServerNetworkStats(foo_https_server)); } TEST_F(ServerNetworkStatsServerPropertiesTest, ClearServerNetworkStats) { @@ -1426,7 +1437,7 @@ EXPECT_EQ(nullptr, impl_.GetServerNetworkStats(foo_https_server)); } -typedef HttpServerPropertiesImplTest QuicServerInfoServerPropertiesTest; +typedef HttpServerPropertiesTest QuicServerInfoServerPropertiesTest; TEST_F(QuicServerInfoServerPropertiesTest, Set) { quic::QuicServerId google_quic_server_id("www.google.com", 443, true); @@ -1438,7 +1449,8 @@ // Check empty map. std::unique_ptr<QuicServerInfoMap> init_quic_server_info_map = std::make_unique<QuicServerInfoMap>(kMaxQuicServerEntries); - impl_.SetQuicServerInfoMap(std::move(init_quic_server_info_map)); + impl_.OnQuicServerInfoMapLoadedForTesting( + std::move(init_quic_server_info_map)); EXPECT_EQ(0u, impl_.quic_server_info_map().size()); // Check by initializing with www.google.com:443. @@ -1446,7 +1458,8 @@ init_quic_server_info_map = std::make_unique<QuicServerInfoMap>(kMaxQuicServerEntries); init_quic_server_info_map->Put(google_quic_server_id, google_server_info); - impl_.SetQuicServerInfoMap(std::move(init_quic_server_info_map)); + impl_.OnQuicServerInfoMapLoadedForTesting( + std::move(init_quic_server_info_map)); // Verify data for www.google.com:443. EXPECT_EQ(1u, impl_.quic_server_info_map().size()); @@ -1483,7 +1496,7 @@ quic::QuicServerId mail_quic_server_id("mail.google.com", 443, true); std::string mail_server_info("mail_quic_server_info"); quic_server_info_map->Put(mail_quic_server_id, mail_server_info); - impl_.SetQuicServerInfoMap(std::move(quic_server_info_map)); + impl_.OnQuicServerInfoMapLoadedForTesting(std::move(quic_server_info_map)); // Recency order will be |docs_server|, |google_server| and |mail_server|. const QuicServerInfoMap& memory_map = impl_.quic_server_info_map(); @@ -1645,7 +1658,7 @@ new QuicServerInfoMap(kMaxQuicServerEntries)); quic_server_info_map->Put(h2_server_id, h2_server_info); quic_server_info_map->Put(h3_server_id, h3_server_info); - impl_.SetQuicServerInfoMap(std::move(quic_server_info_map)); + impl_.OnQuicServerInfoMapLoadedForTesting(std::move(quic_server_info_map)); // Check that the server info from the memory cache is returned since unique // entries from the memory cache are added after entries from the
diff --git a/net/http/http_stream_factory.cc b/net/http/http_stream_factory.cc index 51bcae2..e7df1dd 100644 --- a/net/http/http_stream_factory.cc +++ b/net/http/http_stream_factory.cc
@@ -40,6 +40,10 @@ namespace net { +namespace { +const char kAlternativeServiceHeader[] = "Alt-Svc"; +} // namespace + HttpStreamFactory::HttpStreamFactory(HttpNetworkSession* session) : session_(session), job_factory_(std::make_unique<JobFactory>()) {}
diff --git a/net/http/http_stream_factory_job_controller_unittest.cc b/net/http/http_stream_factory_job_controller_unittest.cc index 75356c9..8d77df78 100644 --- a/net/http/http_stream_factory_job_controller_unittest.cc +++ b/net/http/http_stream_factory_job_controller_unittest.cc
@@ -26,6 +26,8 @@ #include "net/dns/mock_host_resolver.h" #include "net/http/http_basic_stream.h" #include "net/http/http_network_session_peer.h" +#include "net/http/http_server_properties.h" +#include "net/http/http_server_properties_manager.h" #include "net/http/http_stream_factory.h" #include "net/http/http_stream_factory_job.h" #include "net/http/http_stream_factory_test_util.h" @@ -97,12 +99,23 @@ } }; -// A mock HttpServerProperties that always returns false for IsInitialized(). -class MockHttpServerProperties : public HttpServerPropertiesImpl { +// A mock HttpServerProperties::PrefDelegate that never finishes loading, so +// HttpServerProperties::IsInitialized() always returns false. +class MockPrefDelegate : public HttpServerProperties::PrefDelegate { public: - MockHttpServerProperties() = default; - ~MockHttpServerProperties() override = default; - bool IsInitialized() const override { return false; } + MockPrefDelegate() = default; + ~MockPrefDelegate() override = default; + + // HttpServerProperties::PrefDelegate implementation: + const base::DictionaryValue* GetServerProperties() const override { + return nullptr; + } + void SetServerProperties(const base::DictionaryValue& value, + base::OnceClosure callback) override {} + void WaitForPrefLoad(base::OnceClosure pref_loaded_callback) override {} + + private: + DISALLOW_COPY_AND_ASSIGN(MockPrefDelegate); }; } // anonymous namespace @@ -2847,7 +2860,8 @@ void Initialize() { session_deps_.http_server_properties = - std::make_unique<MockHttpServerProperties>(); + std::make_unique<HttpServerProperties>( + std::make_unique<MockPrefDelegate>(), nullptr /* net_log */); session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps_); factory_ = session_->http_stream_factory(); request_info_.method = "GET";
diff --git a/net/http/http_stream_factory_unittest.cc b/net/http/http_stream_factory_unittest.cc index be453dc..d97482d 100644 --- a/net/http/http_stream_factory_unittest.cc +++ b/net/http/http_stream_factory_unittest.cc
@@ -40,7 +40,6 @@ #include "net/http/http_proxy_connect_job.h" #include "net/http/http_request_info.h" #include "net/http/http_server_properties.h" -#include "net/http/http_server_properties_impl.h" #include "net/http/http_stream.h" #include "net/http/transport_security_state.h" #include "net/log/net_log_with_source.h" @@ -407,8 +406,7 @@ base::TimeDelta(), ProxyServer::Direct(), false /* is_for_websockets */, - common_connect_job_params, - nullptr /* ssl_config_service */), + common_connect_job_params), last_num_streams_(-1) {} int last_num_streams() const { return last_num_streams_; } @@ -791,7 +789,7 @@ HttpNetworkSession::Context session_context; SSLConfigServiceDefaults ssl_config_service; - HttpServerPropertiesImpl http_server_properties; + HttpServerProperties http_server_properties; MockClientSocketFactory socket_factory; session_context.client_socket_factory = &socket_factory; MockHostResolver host_resolver; @@ -924,7 +922,7 @@ MockClientSocketFactory* socket_factory, ProxyResolutionService* proxy_resolution_service, TestProxyDelegate* test_proxy_delegate, - HttpServerPropertiesImpl* http_server_properties, + HttpServerProperties* http_server_properties, MockCertVerifier* cert_verifier, CTPolicyEnforcer* ct_policy_enforcer, MultiLogCTVerifier* ct_verifier, @@ -973,7 +971,7 @@ "HTTPS badproxy:99; HTTPS badfallbackproxy:98; DIRECT", TRAFFIC_ANNOTATION_FOR_TESTS); TestProxyDelegate test_proxy_delegate; - HttpServerPropertiesImpl http_server_properties; + HttpServerProperties http_server_properties; MockCertVerifier cert_verifier; DefaultCTPolicyEnforcer ct_policy_enforcer; MultiLogCTVerifier ct_verifier; @@ -1087,7 +1085,7 @@ ProxyResolutionService::CreateFixedFromPacResult( "HTTPS badproxy:99; DIRECT", TRAFFIC_ANNOTATION_FOR_TESTS); TestProxyDelegate test_proxy_delegate; - HttpServerPropertiesImpl http_server_properties; + HttpServerProperties http_server_properties; MockCertVerifier cert_verifier; DefaultCTPolicyEnforcer ct_policy_enforcer; MultiLogCTVerifier ct_verifier; @@ -1182,7 +1180,7 @@ session_params.enable_quic = true; // Set up QUIC as alternative_service. - HttpServerPropertiesImpl http_server_properties; + HttpServerProperties http_server_properties; const AlternativeService alternative_service(kProtoQUIC, url.host().c_str(), url.IntPort()); base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); @@ -1228,7 +1226,7 @@ "HTTPS myproxy.org:443", TRAFFIC_ANNOTATION_FOR_TESTS); // Set up the proxy server as a server that supports request priorities. - HttpServerPropertiesImpl http_server_properties; + HttpServerProperties http_server_properties; if (set_http_server_properties) { url::SchemeHostPort spdy_server("https", "myproxy.org", 443); http_server_properties.SetSupportsSpdy(spdy_server, true); @@ -1312,7 +1310,7 @@ "HTTPS myproxy.org:443", TRAFFIC_ANNOTATION_FOR_TESTS); // Set up the proxy server as a server that supports request priorities. - HttpServerPropertiesImpl http_server_properties; + HttpServerProperties http_server_properties; url::SchemeHostPort spdy_server("https", "myproxy.org", 443); http_server_properties.SetSupportsSpdy(spdy_server, true); @@ -1710,7 +1708,7 @@ "https://myproxy.org:443", TRAFFIC_ANNOTATION_FOR_TESTS)); // Set up the proxy server as a server that supports request priorities. - auto http_server_properties = std::make_unique<HttpServerPropertiesImpl>(); + auto http_server_properties = std::make_unique<HttpServerProperties>(); url::SchemeHostPort spdy_server("https", "myproxy.org", 443); http_server_properties->SetSupportsSpdy(spdy_server, true); session_deps.http_server_properties = std::move(http_server_properties); @@ -2338,7 +2336,7 @@ MockCertVerifier cert_verifier_; ProofVerifyDetailsChromium verify_details_; MockCryptoClientStreamFactory crypto_client_stream_factory_; - HttpServerPropertiesImpl http_server_properties_; + HttpServerProperties http_server_properties_; TransportSecurityState transport_security_state_; MultiLogCTVerifier ct_verifier_; DefaultCTPolicyEnforcer ct_policy_enforcer_;
diff --git a/net/proxy_resolution/pac_file_fetcher_impl_unittest.cc b/net/proxy_resolution/pac_file_fetcher_impl_unittest.cc index 7db2739e..15e796e 100644 --- a/net/proxy_resolution/pac_file_fetcher_impl_unittest.cc +++ b/net/proxy_resolution/pac_file_fetcher_impl_unittest.cc
@@ -30,7 +30,7 @@ #include "net/dns/mock_host_resolver.h" #include "net/http/http_cache.h" #include "net/http/http_network_session.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/http/http_transaction_factory.h" #include "net/http/transport_security_state.h" #include "net/net_buildflags.h" @@ -94,7 +94,7 @@ storage_.set_ssl_config_service( std::make_unique<SSLConfigServiceDefaults>()); storage_.set_http_server_properties( - std::make_unique<HttpServerPropertiesImpl>()); + std::make_unique<HttpServerProperties>()); HttpNetworkSession::Context session_context; session_context.host_resolver = host_resolver();
diff --git a/net/quic/platform/impl/quic_system_event_loop_impl.h b/net/quic/platform/impl/quic_system_event_loop_impl.h index 05439c22..87369b2c 100644 --- a/net/quic/platform/impl/quic_system_event_loop_impl.h +++ b/net/quic/platform/impl/quic_system_event_loop_impl.h
@@ -5,6 +5,7 @@ #ifndef NET_QUIC_PLATFORM_IMPL_QUIC_SYSTEM_EVENT_LOOP_IMPL_H_ #define NET_QUIC_PLATFORM_IMPL_QUIC_SYSTEM_EVENT_LOOP_IMPL_H_ +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "base/task/thread_pool/thread_pool.h" @@ -20,7 +21,7 @@ } private: - base::SingleThreadTaskExecutor io_task_executor_{base::MessagePump::Type::IO}; + base::SingleThreadTaskExecutor io_task_executor_{base::MessagePumpType::IO}; }; #endif // NET_QUIC_PLATFORM_IMPL_QUIC_SYSTEM_EVENT_LOOP_IMPL_H_
diff --git a/net/quic/properties_based_quic_server_info_test.cc b/net/quic/properties_based_quic_server_info_test.cc index 8056e5f..488841b 100644 --- a/net/quic/properties_based_quic_server_info_test.cc +++ b/net/quic/properties_based_quic_server_info_test.cc
@@ -9,7 +9,7 @@ #include "net/base/host_port_pair.h" #include "net/base/net_errors.h" #include "net/base/privacy_mode.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/test/gtest_util.h" #include "net/third_party/quiche/src/quic/core/quic_server_id.h" #include "testing/gmock/include/gmock/gmock.h" @@ -58,7 +58,7 @@ EXPECT_EQ(kCertA, state.certs[0]); } - HttpServerPropertiesImpl http_server_properties_; + HttpServerProperties http_server_properties_; quic::QuicServerId server_id_; PropertiesBasedQuicServerInfo server_info_; };
diff --git a/net/quic/quic_end_to_end_unittest.cc b/net/quic/quic_end_to_end_unittest.cc index fa86012..6383abf 100644 --- a/net/quic/quic_end_to_end_unittest.cc +++ b/net/quic/quic_end_to_end_unittest.cc
@@ -25,7 +25,7 @@ #include "net/http/http_auth_handler_factory.h" #include "net/http/http_network_session.h" #include "net/http/http_network_transaction.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/http/http_transaction_test_util.h" #include "net/http/transport_security_state.h" #include "net/log/net_log_with_source.h" @@ -221,7 +221,7 @@ std::unique_ptr<SSLConfigServiceDefaults> ssl_config_service_; std::unique_ptr<ProxyResolutionService> proxy_resolution_service_; std::unique_ptr<HttpAuthHandlerFactory> auth_handler_factory_; - HttpServerPropertiesImpl http_server_properties_; + HttpServerProperties http_server_properties_; HttpNetworkSession::Params session_params_; HttpNetworkSession::Context session_context_; std::unique_ptr<TestTransactionFactory> transaction_factory_;
diff --git a/net/quic/quic_network_transaction_unittest.cc b/net/quic/quic_network_transaction_unittest.cc index 745ccf5..c1e325a 100644 --- a/net/quic/quic_network_transaction_unittest.cc +++ b/net/quic/quic_network_transaction_unittest.cc
@@ -33,7 +33,7 @@ #include "net/http/http_network_session.h" #include "net/http/http_network_transaction.h" #include "net/http/http_proxy_connect_job.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/http/http_stream.h" #include "net/http/http_stream_factory.h" #include "net/http/http_transaction_test_util.h" @@ -929,7 +929,7 @@ std::unique_ptr<SSLConfigServiceDefaults> ssl_config_service_; std::unique_ptr<ProxyResolutionService> proxy_resolution_service_; std::unique_ptr<HttpAuthHandlerFactory> auth_handler_factory_; - HttpServerPropertiesImpl http_server_properties_; + HttpServerProperties http_server_properties_; HttpNetworkSession::Params session_params_; HttpNetworkSession::Context session_context_; HttpRequestInfo request_; @@ -6327,7 +6327,7 @@ storage_.set_http_auth_handler_factory( HttpAuthHandlerFactory::CreateDefault()); storage_.set_http_server_properties( - std::make_unique<HttpServerPropertiesImpl>()); + std::make_unique<HttpServerProperties>()); storage_.set_job_factory(std::make_unique<URLRequestJobFactoryImpl>()); storage_.set_http_network_session(std::move(session)); storage_.set_http_transaction_factory(std::make_unique<HttpCache>( @@ -6824,7 +6824,7 @@ std::unique_ptr<ProxyResolutionService> proxy_resolution_service_; std::unique_ptr<HttpAuthHandlerFactory> auth_handler_factory_; quic::test::MockRandom random_generator_; - HttpServerPropertiesImpl http_server_properties_; + HttpServerProperties http_server_properties_; BoundTestNetLog net_log_; MockCryptoClientStreamFactory crypto_client_stream_factory_; std::vector<std::unique_ptr<StaticSocketDataProvider>>
diff --git a/net/quic/quic_stream_factory_fuzzer.cc b/net/quic/quic_stream_factory_fuzzer.cc index 783cb010..bdb753e8 100644 --- a/net/quic/quic_stream_factory_fuzzer.cc +++ b/net/quic/quic_stream_factory_fuzzer.cc
@@ -13,7 +13,7 @@ #include "net/cert/x509_certificate.h" #include "net/dns/context_host_resolver.h" #include "net/dns/fuzzed_host_resolver_util.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/http/transport_security_state.h" #include "net/quic/mock_crypto_client_stream_factory.h" #include "net/quic/quic_http_stream.h" @@ -91,7 +91,7 @@ FuzzedSocketFactory socket_factory(&data_provider); // Initialize this on each loop since some options mutate this. - HttpServerPropertiesImpl http_server_properties; + HttpServerProperties http_server_properties; QuicParams params; params.max_server_configs_stored_in_properties =
diff --git a/net/quic/quic_stream_factory_test.cc b/net/quic/quic_stream_factory_test.cc index 760da1749..bde2862d 100644 --- a/net/quic/quic_stream_factory_test.cc +++ b/net/quic/quic_stream_factory_test.cc
@@ -25,7 +25,7 @@ #include "net/dns/mock_host_resolver.h" #include "net/http/http_response_headers.h" #include "net/http/http_response_info.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/http/http_util.h" #include "net/http/transport_security_state.h" #include "net/http/transport_security_state_test_util.h" @@ -827,7 +827,7 @@ const quic::ParsedQuicVersion version_; QuicTestPacketMaker client_maker_; QuicTestPacketMaker server_maker_; - HttpServerPropertiesImpl http_server_properties_; + HttpServerProperties http_server_properties_; std::unique_ptr<CertVerifier> cert_verifier_; TransportSecurityState transport_security_state_; std::unique_ptr<CTVerifier> cert_transparency_verifier_; @@ -1047,7 +1047,7 @@ "192.168.0.1", ""); Initialize(); factory_->set_require_confirmation(true); - http_server_properties_.SetSupportsQuic(IPAddress(192, 0, 2, 33)); + http_server_properties_.SetSupportsQuic(true, IPAddress(192, 0, 2, 33)); ProofVerifyDetailsChromium verify_details = DefaultProofVerifyDetails(); crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details);
diff --git a/net/socket/client_socket_pool_manager_impl.cc b/net/socket/client_socket_pool_manager_impl.cc index 4b4d334f..fdbbae8 100644 --- a/net/socket/client_socket_pool_manager_impl.cc +++ b/net/socket/client_socket_pool_manager_impl.cc
@@ -16,7 +16,6 @@ #include "net/socket/transport_client_socket_pool.h" #include "net/socket/transport_connect_job.h" #include "net/socket/websocket_transport_client_socket_pool.h" -#include "net/ssl/ssl_config_service.h" namespace net { @@ -25,11 +24,9 @@ ClientSocketPoolManagerImpl::ClientSocketPoolManagerImpl( const CommonConnectJobParams& common_connect_job_params, const CommonConnectJobParams& websocket_common_connect_job_params, - SSLConfigService* ssl_config_service, HttpNetworkSession::SocketPoolType pool_type) : common_connect_job_params_(common_connect_job_params), websocket_common_connect_job_params_(websocket_common_connect_job_params), - ssl_config_service_(ssl_config_service), pool_type_(pool_type) { // |websocket_endpoint_lock_manager| must only be set for websocket // connections. @@ -86,7 +83,7 @@ sockets_per_proxy_server, sockets_per_group, unused_idle_socket_timeout(pool_type_), proxy_server, pool_type_ == HttpNetworkSession::WEBSOCKET_SOCKET_POOL, - &common_connect_job_params_, ssl_config_service_); + &common_connect_job_params_); } std::pair<SocketPoolMap::iterator, bool> ret =
diff --git a/net/socket/client_socket_pool_manager_impl.h b/net/socket/client_socket_pool_manager_impl.h index de6fd42..973b2ecb7 100644 --- a/net/socket/client_socket_pool_manager_impl.h +++ b/net/socket/client_socket_pool_manager_impl.h
@@ -29,7 +29,6 @@ namespace net { class ProxyServer; -class SSLConfigService; class ClientSocketPool; class NET_EXPORT_PRIVATE ClientSocketPoolManagerImpl @@ -42,7 +41,6 @@ ClientSocketPoolManagerImpl( const CommonConnectJobParams& common_connect_job_params, const CommonConnectJobParams& websocket_common_connect_job_params, - SSLConfigService* ssl_config_service, HttpNetworkSession::SocketPoolType pool_type); ~ClientSocketPoolManagerImpl() override; @@ -69,8 +67,6 @@ // Used only for direct WebSocket connections (i.e., no proxy in use). const CommonConnectJobParams websocket_common_connect_job_params_; - SSLConfigService* const ssl_config_service_; - const HttpNetworkSession::SocketPoolType pool_type_; SocketPoolMap socket_pools_;
diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc index 65f7840..6fad42a7 100644 --- a/net/socket/socket_test_util.cc +++ b/net/socket/socket_test_util.cc
@@ -805,8 +805,16 @@ next_ssl_data->next_protos_expected_in_ssl_config.value().end(), ssl_config.alpn_protos.begin())); } - EXPECT_EQ(next_ssl_data->expected_ssl_version_min, ssl_config.version_min); - EXPECT_EQ(next_ssl_data->expected_ssl_version_max, ssl_config.version_max); + + // The protocol version used is a combination of the per-socket SSLConfig and + // the SSLConfigService. + EXPECT_EQ( + next_ssl_data->expected_ssl_version_min, + ssl_config.version_min_override.value_or(context->config().version_min)); + EXPECT_EQ( + next_ssl_data->expected_ssl_version_max, + ssl_config.version_max_override.value_or(context->config().version_max)); + if (next_ssl_data->expected_send_client_cert) { EXPECT_EQ(*next_ssl_data->expected_send_client_cert, ssl_config.send_client_cert); @@ -2122,8 +2130,7 @@ base::TimeDelta::FromSeconds(10) /* unused_idle_socket_timeout */, ProxyServer::Direct(), false /* is_for_websockets */, - common_connect_job_params, - nullptr /* ssl_config_service */), + common_connect_job_params), client_socket_factory_(common_connect_job_params->client_socket_factory), last_request_priority_(DEFAULT_PRIORITY), release_count_(0),
diff --git a/net/socket/ssl_client_socket.cc b/net/socket/ssl_client_socket.cc index 52ae9bed..3b3fbb2e 100644 --- a/net/socket/ssl_client_socket.cc +++ b/net/socket/ssl_client_socket.cc
@@ -46,12 +46,14 @@ } SSLClientContext::SSLClientContext( + SSLConfigService* ssl_config_service, CertVerifier* cert_verifier, TransportSecurityState* transport_security_state, CTVerifier* cert_transparency_verifier, CTPolicyEnforcer* ct_policy_enforcer, SSLClientSessionCache* ssl_client_session_cache) - : cert_verifier_(cert_verifier), + : ssl_config_service_(ssl_config_service), + cert_verifier_(cert_verifier), transport_security_state_(transport_security_state), cert_transparency_verifier_(cert_transparency_verifier), ct_policy_enforcer_(ct_policy_enforcer), @@ -60,9 +62,18 @@ CHECK(transport_security_state_); CHECK(cert_transparency_verifier_); CHECK(ct_policy_enforcer_); + + if (ssl_config_service_) { + config_ = ssl_config_service_->GetSSLContextConfig(); + ssl_config_service_->AddObserver(this); + } } -SSLClientContext::~SSLClientContext() = default; +SSLClientContext::~SSLClientContext() { + if (ssl_config_service_) { + ssl_config_service_->RemoveObserver(this); + } +} std::unique_ptr<SSLClientSocket> SSLClientContext::CreateSSLClientSocket( std::unique_ptr<StreamSocket> stream_socket, @@ -72,4 +83,23 @@ host_and_port, ssl_config); } +void SSLClientContext::AddObserver(Observer* observer) { + observers_.AddObserver(observer); +} + +void SSLClientContext::RemoveObserver(Observer* observer) { + observers_.RemoveObserver(observer); +} + +void SSLClientContext::OnSSLContextConfigChanged() { + // TODO(davidben): Should we flush |ssl_client_session_cache_| here? We flush + // the socket pools, but not the session cache. While BoringSSL-based servers + // never change version or cipher negotiation based on client-offered + // sessions, other servers do. + config_ = ssl_config_service_->GetSSLContextConfig(); + for (Observer& observer : observers_) { + observer.OnSSLConfigChanged(); + } +} + } // namespace net
diff --git a/net/socket/ssl_client_socket.h b/net/socket/ssl_client_socket.h index 8b7d08a..562751e 100644 --- a/net/socket/ssl_client_socket.h +++ b/net/socket/ssl_client_socket.h
@@ -12,8 +12,10 @@ #include "base/gtest_prod_util.h" #include "base/macros.h" +#include "base/observer_list.h" #include "net/base/net_export.h" #include "net/socket/ssl_socket.h" +#include "net/ssl/ssl_config_service.h" namespace net { @@ -78,19 +80,32 @@ }; // Shared state and configuration across multiple SSLClientSockets. -class NET_EXPORT SSLClientContext { +class NET_EXPORT SSLClientContext : public SSLConfigService::Observer { public: + class NET_EXPORT Observer : public base::CheckedObserver { + public: + // Called when SSL configuration for all hosts changed. Newly-created + // SSLClientSockets will pick up the new configuration. + virtual void OnSSLConfigChanged() = 0; + }; + // Creates a new SSLClientContext with the specified parameters. The // SSLClientContext may not outlive the input parameters. // - // |ssl_client_session_cache| may be null to disable session caching. - SSLClientContext(CertVerifier* cert_verifier, + // |ssl_config_service| may be null to always use the default + // SSLContextConfig. |ssl_client_session_cache| may be null to disable session + // caching. + SSLClientContext(SSLConfigService* ssl_config_service, + CertVerifier* cert_verifier, TransportSecurityState* transport_security_state, CTVerifier* cert_transparency_verifier, CTPolicyEnforcer* ct_policy_enforcer, SSLClientSessionCache* ssl_client_session_cache); - ~SSLClientContext(); + ~SSLClientContext() override; + const SSLContextConfig& config() { return config_; } + + SSLConfigService* ssl_config_service() { return ssl_config_service_; } CertVerifier* cert_verifier() { return cert_verifier_; } TransportSecurityState* transport_security_state() { return transport_security_state_; @@ -110,13 +125,28 @@ const HostPortPair& host_and_port, const SSLConfig& ssl_config); + // Add an observer to be notified when configuration has changed. + // RemoveObserver() must be called before |observer| is destroyed. + void AddObserver(Observer* observer); + + // Remove an observer added with AddObserver(). + void RemoveObserver(Observer* observer); + + // SSLConfigService::Observer: + void OnSSLContextConfigChanged() override; + private: + SSLContextConfig config_; + + SSLConfigService* ssl_config_service_; CertVerifier* cert_verifier_; TransportSecurityState* transport_security_state_; CTVerifier* cert_transparency_verifier_; CTPolicyEnforcer* ct_policy_enforcer_; SSLClientSessionCache* ssl_client_session_cache_; + base::ObserverList<Observer, true /* check_empty */> observers_; + DISALLOW_COPY_AND_ASSIGN(SSLClientContext); };
diff --git a/net/socket/ssl_client_socket_impl.cc b/net/socket/ssl_client_socket_impl.cc index 2253e47..9c805350 100644 --- a/net/socket/ssl_client_socket_impl.cc +++ b/net/socket/ssl_client_socket_impl.cc
@@ -832,10 +832,14 @@ BIO_up_ref(transport_bio); // SSL_set0_wbio takes ownership. SSL_set0_wbio(ssl_.get(), transport_bio); - DCHECK_LT(SSL3_VERSION, ssl_config_.version_min); - DCHECK_LT(SSL3_VERSION, ssl_config_.version_max); - if (!SSL_set_min_proto_version(ssl_.get(), ssl_config_.version_min) || - !SSL_set_max_proto_version(ssl_.get(), ssl_config_.version_max)) { + uint16_t version_min = + ssl_config_.version_min_override.value_or(context_->config().version_min); + uint16_t version_max = + ssl_config_.version_max_override.value_or(context_->config().version_max); + DCHECK_LT(SSL3_VERSION, version_min); + DCHECK_LT(SSL3_VERSION, version_max); + if (!SSL_set_min_proto_version(ssl_.get(), version_min) || + !SSL_set_max_proto_version(ssl_.get(), version_max)) { return ERR_UNEXPECTED; } @@ -877,7 +881,7 @@ command.append(":!kRSA"); // Remove any disabled ciphers. - for (uint16_t id : ssl_config_.disabled_cipher_suites) { + for (uint16_t id : context_->config().disabled_cipher_suites) { const SSL_CIPHER* cipher = SSL_get_cipher_by_value(id); if (cipher) { command.append(":!");
diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc index 917d43b4..1ce80ba 100644 --- a/net/socket/ssl_client_socket_unittest.cc +++ b/net/socket/ssl_client_socket_unittest.cc
@@ -69,6 +69,7 @@ #include "net/ssl/ssl_handshake_details.h" #include "net/ssl/ssl_info.h" #include "net/ssl/ssl_server_config.h" +#include "net/ssl/test_ssl_config_service.h" #include "net/ssl/test_ssl_private_key.h" #include "net/test/cert_test_util.h" #include "net/test/embedded_test_server/embedded_test_server.h" @@ -793,6 +794,8 @@ public: SSLClientSocketTest() : socket_factory_(ClientSocketFactory::GetDefaultFactory()), + ssl_config_service_( + std::make_unique<TestSSLConfigService>(SSLContextConfig())), cert_verifier_(std::make_unique<MockCertVerifier>()), transport_security_state_(std::make_unique<TransportSecurityState>()), ct_verifier_(std::make_unique<DoNothingCTVerifier>()), @@ -800,6 +803,7 @@ ssl_client_session_cache_(std::make_unique<SSLClientSessionCache>( SSLClientSessionCache::Config())), context_(std::make_unique<SSLClientContext>( + ssl_config_service_.get(), cert_verifier_.get(), transport_security_state_.get(), ct_verifier_.get(), @@ -940,6 +944,7 @@ TestNetLog log_; ClientSocketFactory* socket_factory_; + std::unique_ptr<TestSSLConfigService> ssl_config_service_; std::unique_ptr<MockCertVerifier> cert_verifier_; std::unique_ptr<TransportSecurityState> transport_security_state_; std::unique_ptr<DoNothingCTVerifier> ct_verifier_; @@ -1306,7 +1311,11 @@ class SSLClientSocketZeroRTTTest : public SSLClientSocketTest { protected: - SSLClientSocketZeroRTTTest() : SSLClientSocketTest() {} + SSLClientSocketZeroRTTTest() : SSLClientSocketTest() { + SSLContextConfig config; + config.version_max = SSL_PROTOCOL_VERSION_TLS1_3; + ssl_config_service_->UpdateSSLConfigAndNotify(config); + } bool StartServer() { SSLServerConfig server_config; @@ -1327,7 +1336,6 @@ FakeBlockingStreamSocket* MakeClient(bool early_data_enabled) { SSLConfig ssl_config; - ssl_config.version_max = SSL_PROTOCOL_VERSION_TLS1_3; ssl_config.early_data_enabled = early_data_enabled; real_transport_.reset( @@ -1541,8 +1549,9 @@ HangingCertVerifier verifier; context_ = std::make_unique<SSLClientContext>( - &verifier, transport_security_state_.get(), ct_verifier_.get(), - ct_policy_enforcer_.get(), ssl_client_session_cache_.get()); + ssl_config_service_.get(), &verifier, transport_security_state_.get(), + ct_verifier_.get(), ct_policy_enforcer_.get(), + ssl_client_session_cache_.get()); TestCompletionCallback callback; auto transport = @@ -2475,12 +2484,13 @@ ssl_options.bulk_ciphers = SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128; ASSERT_TRUE(StartTestServer(ssl_options)); - SSLConfig ssl_config; + SSLContextConfig ssl_context_config; for (size_t i = 0; i < base::size(kCiphersToDisable); ++i) - ssl_config.disabled_cipher_suites.push_back(kCiphersToDisable[i]); + ssl_context_config.disabled_cipher_suites.push_back(kCiphersToDisable[i]); + ssl_config_service_->UpdateSSLConfigAndNotify(ssl_context_config); int rv; - ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); + ASSERT_TRUE(CreateAndConnectSSLClientSocket(SSLConfig(), &rv)); EXPECT_THAT(rv, IsError(ERR_SSL_VERSION_OR_CIPHER_MISMATCH)); } @@ -2806,8 +2816,9 @@ MockCTVerifier ct_verifier; context_ = std::make_unique<SSLClientContext>( - cert_verifier_.get(), transport_security_state_.get(), &ct_verifier, - ct_policy_enforcer_.get(), ssl_client_session_cache_.get()); + ssl_config_service_.get(), cert_verifier_.get(), + transport_security_state_.get(), &ct_verifier, ct_policy_enforcer_.get(), + ssl_client_session_cache_.get()); // Check that the SCT list is extracted from the TLS extension as expected, // while also simulating that it was an unparsable response. @@ -5217,10 +5228,12 @@ SpawnedTestServer::SSLOptions::TLS_MAX_VERSION_TLS1_2; ASSERT_TRUE(StartTestServer(ssl_options)); - SSLConfig config; + SSLContextConfig config; config.version_max = SSL_PROTOCOL_VERSION_TLS1_3; + ssl_config_service_->UpdateSSLConfigAndNotify(config); + int rv; - ASSERT_TRUE(CreateAndConnectSSLClientSocket(config, &rv)); + ASSERT_TRUE(CreateAndConnectSSLClientSocket(SSLConfig(), &rv)); EXPECT_THAT(rv, IsError(ERR_TLS13_DOWNGRADE_DETECTED)); EXPECT_FALSE(sock_->IsConnected()); } @@ -5237,10 +5250,12 @@ SpawnedTestServer::SSLOptions::TLS_MAX_VERSION_TLS1_1; ASSERT_TRUE(StartTestServer(ssl_options)); - SSLConfig config; + SSLContextConfig config; config.version_max = SSL_PROTOCOL_VERSION_TLS1_3; + ssl_config_service_->UpdateSSLConfigAndNotify(config); + int rv; - ASSERT_TRUE(CreateAndConnectSSLClientSocket(config, &rv)); + ASSERT_TRUE(CreateAndConnectSSLClientSocket(SSLConfig(), &rv)); EXPECT_THAT(rv, IsError(ERR_TLS13_DOWNGRADE_DETECTED)); EXPECT_FALSE(sock_->IsConnected()); } @@ -5257,10 +5272,12 @@ SpawnedTestServer::SSLOptions::TLS_MAX_VERSION_TLS1_0; ASSERT_TRUE(StartTestServer(ssl_options)); - SSLConfig config; + SSLContextConfig config; config.version_max = SSL_PROTOCOL_VERSION_TLS1_3; + ssl_config_service_->UpdateSSLConfigAndNotify(config); + int rv; - ASSERT_TRUE(CreateAndConnectSSLClientSocket(config, &rv)); + ASSERT_TRUE(CreateAndConnectSSLClientSocket(SSLConfig(), &rv)); EXPECT_THAT(rv, IsError(ERR_TLS13_DOWNGRADE_DETECTED)); EXPECT_FALSE(sock_->IsConnected()); } @@ -5275,10 +5292,12 @@ SpawnedTestServer::SSLOptions::TLS_MAX_VERSION_TLS1_2; ASSERT_TRUE(StartTestServer(ssl_options)); - SSLConfig config; + SSLContextConfig config; config.version_max = SSL_PROTOCOL_VERSION_TLS1_3; + ssl_config_service_->UpdateSSLConfigAndNotify(config); + int rv; - ASSERT_TRUE(CreateAndConnectSSLClientSocket(config, &rv)); + ASSERT_TRUE(CreateAndConnectSSLClientSocket(SSLConfig(), &rv)); EXPECT_THAT(rv, IsOk()); EXPECT_TRUE(sock_->IsConnected()); @@ -5300,10 +5319,12 @@ ssl_options.simulate_tls13_downgrade = true; ASSERT_TRUE(StartTestServer(ssl_options)); - SSLConfig config; + SSLContextConfig config; config.version_max = SSL_PROTOCOL_VERSION_TLS1_3; + ssl_config_service_->UpdateSSLConfigAndNotify(config); + int rv; - ASSERT_TRUE(CreateAndConnectSSLClientSocket(config, &rv)); + ASSERT_TRUE(CreateAndConnectSSLClientSocket(SSLConfig(), &rv)); EXPECT_THAT(rv, IsOk()); EXPECT_TRUE(sock_->IsConnected()); @@ -5325,10 +5346,12 @@ SpawnedTestServer::SSLOptions::TLS_MAX_VERSION_TLS1_1; ASSERT_TRUE(StartTestServer(ssl_options)); - SSLConfig config; + SSLContextConfig config; config.version_max = SSL_PROTOCOL_VERSION_TLS1_3; + ssl_config_service_->UpdateSSLConfigAndNotify(config); + int rv; - ASSERT_TRUE(CreateAndConnectSSLClientSocket(config, &rv)); + ASSERT_TRUE(CreateAndConnectSSLClientSocket(SSLConfig(), &rv)); EXPECT_THAT(rv, IsOk()); EXPECT_TRUE(sock_->IsConnected()); @@ -5350,10 +5373,12 @@ SpawnedTestServer::SSLOptions::TLS_MAX_VERSION_TLS1_0; ASSERT_TRUE(StartTestServer(ssl_options)); - SSLConfig config; + SSLContextConfig config; config.version_max = SSL_PROTOCOL_VERSION_TLS1_3; + ssl_config_service_->UpdateSSLConfigAndNotify(config); + int rv; - ASSERT_TRUE(CreateAndConnectSSLClientSocket(config, &rv)); + ASSERT_TRUE(CreateAndConnectSSLClientSocket(SSLConfig(), &rv)); EXPECT_THAT(rv, IsOk()); EXPECT_TRUE(sock_->IsConnected()); @@ -5384,10 +5409,12 @@ verify_result.verified_cert = server_cert; cert_verifier_->AddResultForCert(server_cert.get(), verify_result, OK); - SSLConfig config; + SSLContextConfig config; config.version_max = SSL_PROTOCOL_VERSION_TLS1_3; + ssl_config_service_->UpdateSSLConfigAndNotify(config); + int rv; - ASSERT_TRUE(CreateAndConnectSSLClientSocket(config, &rv)); + ASSERT_TRUE(CreateAndConnectSSLClientSocket(SSLConfig(), &rv)); EXPECT_THAT(rv, IsError(ERR_TLS13_DOWNGRADE_DETECTED)); EXPECT_FALSE(sock_->IsConnected()); } @@ -5410,10 +5437,12 @@ verify_result.verified_cert = server_cert; cert_verifier_->AddResultForCert(server_cert.get(), verify_result, OK); - SSLConfig config; + SSLContextConfig config; config.version_max = SSL_PROTOCOL_VERSION_TLS1_3; + ssl_config_service_->UpdateSSLConfigAndNotify(config); + int rv; - ASSERT_TRUE(CreateAndConnectSSLClientSocket(config, &rv)); + ASSERT_TRUE(CreateAndConnectSSLClientSocket(SSLConfig(), &rv)); EXPECT_THAT(rv, IsOk()); EXPECT_TRUE(sock_->IsConnected()); } @@ -5439,10 +5468,12 @@ verify_result.verified_cert = server_cert; cert_verifier_->AddResultForCert(server_cert.get(), verify_result, OK); - SSLConfig config; + SSLContextConfig config; config.version_max = SSL_PROTOCOL_VERSION_TLS1_3; + ssl_config_service_->UpdateSSLConfigAndNotify(config); + int rv; - ASSERT_TRUE(CreateAndConnectSSLClientSocket(config, &rv)); + ASSERT_TRUE(CreateAndConnectSSLClientSocket(SSLConfig(), &rv)); EXPECT_THAT(rv, IsOk()); EXPECT_TRUE(sock_->IsConnected()); } @@ -5544,10 +5575,12 @@ int rv = callback.GetResult(transport->Connect(callback.callback())); ASSERT_THAT(rv, IsOk()); - SSLConfig config; + SSLContextConfig config; config.version_max = SSL_PROTOCOL_VERSION_TLS1_3; + ssl_config_service_->UpdateSSLConfigAndNotify(config); + std::unique_ptr<SSLClientSocket> ssl_socket = - CreateSSLClientSocket(std::move(transport), host_port_pair, config); + CreateSSLClientSocket(std::move(transport), host_port_pair, SSLConfig()); rv = callback.GetResult(ssl_socket->Connect(callback.callback())); EXPECT_THAT(rv, IsOk()); @@ -5623,9 +5656,14 @@ ASSERT_TRUE( StartEmbeddedTestServer(EmbeddedTestServer::CERT_OK, server_config)); + SSLContextConfig client_context_config; + client_context_config.version_min = GetParam().version; + client_context_config.version_max = GetParam().version; + ssl_config_service_->UpdateSSLConfigAndNotify(client_context_config); + SSLConfig client_config; - client_config.version_min = GetParam().version; - client_config.version_max = GetParam().version; + client_config.version_min_override = GetParam().version; + client_config.version_max_override = GetParam().version; client_config.early_data_enabled = GetParam().early_data; if (GetParam().alpn) { client_config.alpn_protos = {kProtoHTTP11}; @@ -5704,4 +5742,41 @@ } } +TEST_F(SSLClientSocketTest, VersionOverride) { + // Enable all test features in the server. + SSLServerConfig server_config; + server_config.version_max = SSL_PROTOCOL_VERSION_TLS1_2; + ASSERT_TRUE( + StartEmbeddedTestServer(EmbeddedTestServer::CERT_OK, server_config)); + + SSLContextConfig context_config; + context_config.version_min = SSL_PROTOCOL_VERSION_TLS1_1; + context_config.version_max = SSL_PROTOCOL_VERSION_TLS1_1; + ssl_config_service_->UpdateSSLConfigAndNotify(context_config); + + // Connecting normally uses the global configuration. + SSLConfig config; + int rv; + ASSERT_TRUE(CreateAndConnectSSLClientSocket(config, &rv)); + EXPECT_THAT(rv, IsOk()); + SSLInfo info; + ASSERT_TRUE(sock_->GetSSLInfo(&info)); + EXPECT_EQ(SSL_CONNECTION_VERSION_TLS1_1, + SSLConnectionStatusToVersion(info.connection_status)); + + // Individual sockets may override the maximum version. + config.version_max_override = SSL_PROTOCOL_VERSION_TLS1_2; + ASSERT_TRUE(CreateAndConnectSSLClientSocket(config, &rv)); + EXPECT_THAT(rv, IsOk()); + ASSERT_TRUE(sock_->GetSSLInfo(&info)); + EXPECT_EQ(SSL_CONNECTION_VERSION_TLS1_2, + SSLConnectionStatusToVersion(info.connection_status)); + + // Individual sockets may also override the minimum version. + config.version_min_override = SSL_PROTOCOL_VERSION_TLS1_3; + config.version_max_override = SSL_PROTOCOL_VERSION_TLS1_3; + ASSERT_TRUE(CreateAndConnectSSLClientSocket(config, &rv)); + EXPECT_THAT(rv, IsError(ERR_SSL_VERSION_OR_CIPHER_MISMATCH)); +} + } // namespace net
diff --git a/net/socket/ssl_connect_job_unittest.cc b/net/socket/ssl_connect_job_unittest.cc index 3ffef96..b6bc4e4b 100644 --- a/net/socket/ssl_connect_job_unittest.cc +++ b/net/socket/ssl_connect_job_unittest.cc
@@ -27,7 +27,7 @@ #include "net/http/http_proxy_connect_job.h" #include "net/http/http_request_headers.h" #include "net/http/http_response_headers.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/http/transport_security_state.h" #include "net/log/net_log_source.h" #include "net/log/net_log_with_source.h" @@ -104,7 +104,6 @@ TRAFFIC_ANNOTATION_FOR_TESTS, NetworkIsolationKey())), common_connect_job_params_(session_->CreateCommonConnectJobParams()) { - ssl_config_service_->GetSSLConfig(&ssl_config_); } ~SSLConnectJobTest() override = default; @@ -124,7 +123,7 @@ : nullptr, proxy == ProxyServer::SCHEME_SOCKS5 ? socks_socket_params_ : nullptr, proxy == ProxyServer::SCHEME_HTTP ? http_proxy_socket_params_ : nullptr, - HostPortPair("host", 443), ssl_config_, PRIVACY_MODE_DISABLED, + HostPortPair("host", 443), SSLConfig(), PRIVACY_MODE_DISABLED, NetworkIsolationKey()); } @@ -163,7 +162,7 @@ const std::unique_ptr<ProxyResolutionService> proxy_resolution_service_; const std::unique_ptr<SSLConfigService> ssl_config_service_; const std::unique_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; - HttpServerPropertiesImpl http_server_properties_; + HttpServerProperties http_server_properties_; const std::unique_ptr<HttpNetworkSession> session_; scoped_refptr<TransportSocketParams> direct_transport_socket_params_; @@ -172,7 +171,6 @@ scoped_refptr<SOCKSSocketParams> socks_socket_params_; scoped_refptr<HttpProxySocketParams> http_proxy_socket_params_; - SSLConfig ssl_config_; const CommonConnectJobParams common_connect_job_params_; };
diff --git a/net/socket/ssl_server_socket_unittest.cc b/net/socket/ssl_server_socket_unittest.cc index c288bcad..8323e80e 100644 --- a/net/socket/ssl_server_socket_unittest.cc +++ b/net/socket/ssl_server_socket_unittest.cc
@@ -64,6 +64,7 @@ #include "net/ssl/ssl_info.h" #include "net/ssl/ssl_private_key.h" #include "net/ssl/ssl_server_config.h" +#include "net/ssl/test_ssl_config_service.h" #include "net/ssl/test_ssl_private_key.h" #include "net/test/cert_test_util.h" #include "net/test/gtest_util.h" @@ -353,7 +354,8 @@ public WithScopedTaskEnvironment { public: SSLServerSocketTest() - : cert_verifier_(new MockCertVerifier()), + : ssl_config_service_(new TestSSLConfigService(SSLContextConfig())), + cert_verifier_(new MockCertVerifier()), client_cert_verifier_(new MockClientCertVerifier()), transport_security_state_(new TransportSecurityState), ct_verifier_(new DoNothingCTVerifier), @@ -385,9 +387,9 @@ server_cert_, CERT_STATUS_AUTHORITY_INVALID); client_context_ = std::make_unique<SSLClientContext>( - cert_verifier_.get(), transport_security_state_.get(), - ct_verifier_.get(), ct_policy_enforcer_.get(), - ssl_client_session_cache_.get()); + ssl_config_service_.get(), cert_verifier_.get(), + transport_security_state_.get(), ct_verifier_.get(), + ct_policy_enforcer_.get(), ssl_client_session_cache_.get()); } protected: @@ -509,6 +511,7 @@ std::unique_ptr<FakeDataChannel> channel_2_; SSLConfig client_ssl_config_; SSLServerConfig server_ssl_config_; + std::unique_ptr<TestSSLConfigService> ssl_config_service_; std::unique_ptr<MockCertVerifier> cert_verifier_; std::unique_ptr<MockClientCertVerifier> client_cert_verifier_; std::unique_ptr<TransportSecurityState> transport_security_state_; @@ -897,7 +900,7 @@ ImportCertFromFile(GetTestCertsDirectory(), kClientCertFileName); ASSERT_TRUE(client_cert); - client_ssl_config_.version_max = SSL_PROTOCOL_VERSION_TLS1_2; + client_ssl_config_.version_max_override = SSL_PROTOCOL_VERSION_TLS1_2; ASSERT_NO_FATAL_FAILURE(ConfigureClientCertsForClient( kWrongClientCertFileName, kWrongClientPrivateKeyFileName)); ASSERT_NO_FATAL_FAILURE(ConfigureClientCertsForServer()); @@ -1169,11 +1172,13 @@ 0xcca8, // ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 0xcca9, // ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 }; - client_ssl_config_.disabled_cipher_suites.assign( + SSLContextConfig config; + config.disabled_cipher_suites.assign( kEcdheCiphers, kEcdheCiphers + base::size(kEcdheCiphers)); // Legacy RSA key exchange ciphers only exist in TLS 1.2 and below. - client_ssl_config_.version_max = SSL_PROTOCOL_VERSION_TLS1_2; + config.version_max = SSL_PROTOCOL_VERSION_TLS1_2; + ssl_config_service_->UpdateSSLConfigAndNotify(config); // Require ECDHE on the server. server_ssl_config_.require_ecdhe = true; @@ -1247,11 +1252,12 @@ 0xcca8, // ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 0xcca9, // ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 }; - client_ssl_config_.disabled_cipher_suites.assign( + SSLContextConfig config; + config.disabled_cipher_suites.assign( kEcdheCiphers, kEcdheCiphers + base::size(kEcdheCiphers)); - // TLS 1.3 always works with SSLPrivateKey. - client_ssl_config_.version_max = SSL_PROTOCOL_VERSION_TLS1_2; + config.version_max = SSL_PROTOCOL_VERSION_TLS1_2; + ssl_config_service_->UpdateSSLConfigAndNotify(config); ASSERT_NO_FATAL_FAILURE(CreateContextSSLPrivateKey()); ASSERT_NO_FATAL_FAILURE(CreateSockets());
diff --git a/net/socket/transport_client_socket_pool.cc b/net/socket/transport_client_socket_pool.cc index 5c569152..58b6f40 100644 --- a/net/socket/transport_client_socket_pool.cc +++ b/net/socket/transport_client_socket_pool.cc
@@ -139,8 +139,7 @@ base::TimeDelta unused_idle_socket_timeout, const ProxyServer& proxy_server, bool is_for_websockets, - const CommonConnectJobParams* common_connect_job_params, - SSLConfigService* ssl_config_service) + const CommonConnectJobParams* common_connect_job_params) : TransportClientSocketPool( max_sockets, max_sockets_per_group, @@ -149,7 +148,7 @@ std::make_unique<ConnectJobFactoryImpl>(proxy_server, is_for_websockets, common_connect_job_params), - ssl_config_service, + common_connect_job_params->ssl_client_context, true /* connect_backup_jobs_enabled */) {} TransportClientSocketPool::~TransportClientSocketPool() { @@ -163,8 +162,8 @@ DCHECK_EQ(0, handed_out_socket_count_); CHECK(higher_pools_.empty()); - if (ssl_config_service_) - ssl_config_service_->RemoveObserver(this); + if (ssl_client_context_) + ssl_client_context_->RemoveObserver(this); NetworkChangeNotifier::RemoveIPAddressObserver(this); } @@ -176,13 +175,13 @@ base::TimeDelta unused_idle_socket_timeout, base::TimeDelta used_idle_socket_timeout, std::unique_ptr<ConnectJobFactory> connect_job_factory, - SSLConfigService* ssl_config_service, + SSLClientContext* ssl_client_context, bool connect_backup_jobs_enabled) { return base::WrapUnique<TransportClientSocketPool>( new TransportClientSocketPool( max_sockets, max_sockets_per_group, unused_idle_socket_timeout, used_idle_socket_timeout, std::move(connect_job_factory), - ssl_config_service, connect_backup_jobs_enabled)); + ssl_client_context, connect_backup_jobs_enabled)); } TransportClientSocketPool::CallbackResultPair::CallbackResultPair() @@ -766,7 +765,7 @@ base::TimeDelta unused_idle_socket_timeout, base::TimeDelta used_idle_socket_timeout, std::unique_ptr<ConnectJobFactory> connect_job_factory, - SSLConfigService* ssl_config_service, + SSLClientContext* ssl_client_context, bool connect_backup_jobs_enabled) : idle_socket_count_(0), connecting_socket_count_(0), @@ -778,14 +777,14 @@ connect_job_factory_(std::move(connect_job_factory)), connect_backup_jobs_enabled_(connect_backup_jobs_enabled && g_connect_backup_jobs_enabled), - ssl_config_service_(ssl_config_service) { + ssl_client_context_(ssl_client_context) { DCHECK_LE(0, max_sockets_per_group); DCHECK_LE(max_sockets_per_group, max_sockets); NetworkChangeNotifier::AddIPAddressObserver(this); - if (ssl_config_service_) - ssl_config_service_->AddObserver(this); + if (ssl_client_context_) + ssl_client_context_->AddObserver(this); } void TransportClientSocketPool::OnSSLConfigChanged() {
diff --git a/net/socket/transport_client_socket_pool.h b/net/socket/transport_client_socket_pool.h index 02ac61e..e388acf 100644 --- a/net/socket/transport_client_socket_pool.h +++ b/net/socket/transport_client_socket_pool.h
@@ -40,7 +40,6 @@ #include "net/socket/socket_tag.h" #include "net/socket/ssl_client_socket.h" #include "net/socket/stream_socket.h" -#include "net/ssl/ssl_config_service.h" namespace base { class DictionaryValue; @@ -72,7 +71,7 @@ class NET_EXPORT_PRIVATE TransportClientSocketPool : public ClientSocketPool, public NetworkChangeNotifier::IPAddressObserver, - public SSLConfigService::Observer { + public SSLClientContext::Observer { public: using Flags = uint32_t; @@ -165,8 +164,7 @@ base::TimeDelta unused_idle_socket_timeout, const ProxyServer& proxy_server, bool is_for_websockets, - const CommonConnectJobParams* common_connect_job_params, - SSLConfigService* ssl_config_service); + const CommonConnectJobParams* common_connect_job_params); // Creates a socket pool with an alternative ConnectJobFactory, for use in // testing. @@ -179,7 +177,7 @@ base::TimeDelta unused_idle_socket_timeout, base::TimeDelta used_idle_socket_timeout, std::unique_ptr<ConnectJobFactory> connect_job_factory, - SSLConfigService* ssl_config_service, + SSLClientContext* ssl_client_context, bool connect_backup_jobs_enabled); ~TransportClientSocketPool() override; @@ -601,10 +599,10 @@ base::TimeDelta unused_idle_socket_timeout, base::TimeDelta used_idle_socket_timeout, std::unique_ptr<ConnectJobFactory> connect_job_factory, - SSLConfigService* ssl_config_service, + SSLClientContext* ssl_client_context, bool connect_backup_jobs_enabled); - // SSLConfigService::Observer methods. + // SSLClientContext::Observer methods. void OnSSLConfigChanged() override; base::TimeDelta ConnectRetryInterval() const { @@ -793,7 +791,7 @@ // their idle sockets when it stalls. Must be empty on destruction. std::set<HigherLayeredPool*> higher_pools_; - SSLConfigService* const ssl_config_service_; + SSLClientContext* const ssl_client_context_; base::WeakPtrFactory<TransportClientSocketPool> weak_factory_{this};
diff --git a/net/socket/transport_client_socket_pool_unittest.cc b/net/socket/transport_client_socket_pool_unittest.cc index 8a10584..0797e81 100644 --- a/net/socket/transport_client_socket_pool_unittest.cc +++ b/net/socket/transport_client_socket_pool_unittest.cc
@@ -120,8 +120,7 @@ pool_ = std::make_unique<TransportClientSocketPool>( kMaxSockets, kMaxSocketsPerGroup, kUnusedIdleSocketTimeout, ProxyServer::Direct(), false /* is_for_websockets */, - common_connect_job_params_.get(), - session_deps_.ssl_config_service.get()); + common_connect_job_params_.get()); tagging_common_connect_job_params_ = std::make_unique<CommonConnectJobParams>( @@ -131,8 +130,7 @@ tagging_pool_ = std::make_unique<TransportClientSocketPool>( kMaxSockets, kMaxSocketsPerGroup, kUnusedIdleSocketTimeout, ProxyServer::Direct(), false /* is_for_websockets */, - tagging_common_connect_job_params_.get(), - session_deps_.ssl_config_service.get()); + tagging_common_connect_job_params_.get()); common_connect_job_params_for_real_sockets_ = std::make_unique<CommonConnectJobParams>( @@ -142,8 +140,7 @@ pool_for_real_sockets_ = std::make_unique<TransportClientSocketPool>( kMaxSockets, kMaxSocketsPerGroup, kUnusedIdleSocketTimeout, ProxyServer::Direct(), false /* is_for_websockets */, - common_connect_job_params_for_real_sockets_.get(), - session_deps_.ssl_config_service.get()); + common_connect_job_params_for_real_sockets_.get()); } ~TransportClientSocketPoolTest() override { @@ -178,12 +175,6 @@ } size_t completion_count() const { return test_base_.completion_count(); } - std::unique_ptr<SSLConfig> GetSSLConfig() const { - std::unique_ptr<SSLConfig> ssl_config = std::make_unique<SSLConfig>(); - session_deps_.ssl_config_service->GetSSLConfig(ssl_config.get()); - return ssl_config; - } - bool connect_backup_jobs_enabled_; TestNetLog net_log_; @@ -510,8 +501,7 @@ TEST_F(TransportClientSocketPoolTest, RequestIgnoringLimitsIsReprioritized) { TransportClientSocketPool pool( kMaxSockets, 1, kUnusedIdleSocketTimeout, ProxyServer::Direct(), - false /* is_for_websockets */, common_connect_job_params_.get(), - nullptr /* ssl_config_service */); + false /* is_for_websockets */, common_connect_job_params_.get()); // Creates a job which ignores limits whose priority is MAXIMUM_PRIORITY. TestCompletionCallback callback1; @@ -1022,7 +1012,7 @@ scoped_refptr<ClientSocketPool::SocketParams> socket_params = base::MakeRefCounted<ClientSocketPool::SocketParams>( - GetSSLConfig() /* ssl_config_for_origin */, + std::make_unique<SSLConfig>() /* ssl_config_for_origin */, nullptr /* ssl_config_for_proxy */); ClientSocketHandle handle; @@ -1069,7 +1059,7 @@ EXPECT_EQ(1, pool_->IdleSocketCount()); // After an SSL configuration change, we should have 0 idle sockets. - session_deps_.ssl_config_service->NotifySSLConfigChange(); + session_deps_.ssl_config_service->NotifySSLContextConfigChange(); base::RunLoop().RunUntilIdle(); // Notification happens async. EXPECT_EQ(0, pool_->IdleSocketCount()); @@ -1291,8 +1281,7 @@ kMaxSockets, kMaxSocketsPerGroup, kUnusedIdleSocketTimeout, ProxyServer::FromURI("socks5://foopy", ProxyServer::SCHEME_HTTP /* default_scheme */), - false /* is_for_websockets */, tagging_common_connect_job_params_.get(), - session_deps_.ssl_config_service.get()); + false /* is_for_websockets */, tagging_common_connect_job_params_.get()); for (IoMode socket_io_mode : {SYNCHRONOUS, ASYNC}) { scoped_refptr<ClientSocketPool::SocketParams> socket_params = @@ -1335,8 +1324,7 @@ 1, 1, kUnusedIdleSocketTimeout, ProxyServer::FromURI("https://unresolvable.proxy.name", ProxyServer::SCHEME_HTTP /* default_scheme */), - false /* is_for_websockets */, tagging_common_connect_job_params_.get(), - session_deps_.ssl_config_service.get()); + false /* is_for_websockets */, tagging_common_connect_job_params_.get()); // First connection attempt will get an error after creating the SpdyStream. @@ -1370,8 +1358,8 @@ scoped_refptr<ClientSocketPool::SocketParams> socket_params = base::MakeRefCounted<ClientSocketPool::SocketParams>( - GetSSLConfig() /* ssl_config_for_origin */, - GetSSLConfig() /* ssl_config_for_proxy */); + std::make_unique<SSLConfig>() /* ssl_config_for_origin */, + std::make_unique<SSLConfig>() /* ssl_config_for_proxy */); ClientSocketPool::GroupId group_id(kEndpoint, ClientSocketPool::SocketType::kSsl, @@ -1426,8 +1414,7 @@ 1, 1, kUnusedIdleSocketTimeout, ProxyServer::FromURI("https://unresolvable.proxy.name", ProxyServer::SCHEME_HTTP /* default_scheme */), - false /* is_for_websockets */, tagging_common_connect_job_params_.get(), - session_deps_.ssl_config_service.get()); + false /* is_for_websockets */, tagging_common_connect_job_params_.get()); SpdyTestUtil spdy_util; spdy::SpdySerializedFrame connect(spdy_util.ConstructSpdyConnect( @@ -1474,8 +1461,8 @@ scoped_refptr<ClientSocketPool::SocketParams> socket_params = base::MakeRefCounted<ClientSocketPool::SocketParams>( - GetSSLConfig() /* ssl_config_for_origin */, - GetSSLConfig() /* ssl_config_for_proxy */); + std::make_unique<SSLConfig>() /* ssl_config_for_origin */, + std::make_unique<SSLConfig>() /* ssl_config_for_proxy */); ClientSocketPool::GroupId group_id(kEndpoint, ClientSocketPool::SocketType::kSsl, @@ -1548,8 +1535,7 @@ use_https_proxy ? "https://proxy.test" : "http://proxy.test", ProxyServer::SCHEME_HTTP /* default_scheme */), false /* is_for_websockets */, - tagging_common_connect_job_params_.get(), - session_deps_.ssl_config_service.get()); + tagging_common_connect_job_params_.get()); MockWrite writes[] = { MockWrite(ASYNC, 0, @@ -1571,8 +1557,8 @@ scoped_refptr<ClientSocketPool::SocketParams> socket_params = base::MakeRefCounted<ClientSocketPool::SocketParams>( - GetSSLConfig() /* ssl_config_for_origin */, - GetSSLConfig() /* ssl_config_for_proxy */); + std::make_unique<SSLConfig>() /* ssl_config_for_origin */, + std::make_unique<SSLConfig>() /* ssl_config_for_proxy */); int rv = handle.Init( ClientSocketPool::GroupId(kEndpoint, @@ -1734,8 +1720,7 @@ kMaxSockets, kMaxSocketsPerGroup, kUnusedIdleSocketTimeout, ProxyServer::FromURI("socks5://proxy", ProxyServer::SCHEME_HTTP /* default_scheme */), - false /* is_for_websockets */, tagging_common_connect_job_params_.get(), - session_deps_.ssl_config_service.get()); + false /* is_for_websockets */, tagging_common_connect_job_params_.get()); SocketTag tag1(SocketTag::UNSET_UID, 0x12345678); SocketTag tag2(getuid(), 0x87654321); @@ -1908,7 +1893,7 @@ PrivacyMode::PRIVACY_MODE_DISABLED); scoped_refptr<ClientSocketPool::SocketParams> socket_params = base::MakeRefCounted<ClientSocketPool::SocketParams>( - GetSSLConfig() /* ssl_config_for_origin */, + std::make_unique<SSLConfig>() /* ssl_config_for_origin */, nullptr /* ssl_config_for_proxy */); // Test connect jobs that are orphaned and then adopted, appropriately apply @@ -1971,7 +1956,7 @@ PrivacyMode::PRIVACY_MODE_DISABLED); scoped_refptr<ClientSocketPool::SocketParams> socket_params = base::MakeRefCounted<ClientSocketPool::SocketParams>( - GetSSLConfig() /* ssl_config_for_origin */, + std::make_unique<SSLConfig>() /* ssl_config_for_origin */, nullptr /* ssl_config_for_proxy */); // Test that sockets paused by a full underlying socket pool are properly @@ -2037,8 +2022,7 @@ kMaxSockets, kMaxSocketsPerGroup, kUnusedIdleSocketTimeout, ProxyServer::FromURI("http://proxy", ProxyServer::SCHEME_HTTP /* default_scheme */), - false /* is_for_websockets */, tagging_common_connect_job_params_.get(), - session_deps_.ssl_config_service.get()); + false /* is_for_websockets */, tagging_common_connect_job_params_.get()); session_deps_.host_resolver->set_synchronous_mode(true); SequencedSocketData socket_data; @@ -2097,8 +2081,7 @@ kMaxSockets, kMaxSocketsPerGroup, kUnusedIdleSocketTimeout, ProxyServer::FromURI("http://proxy", ProxyServer::SCHEME_HTTP /* default_scheme */), - false /* is_for_websockets */, tagging_common_connect_job_params_.get(), - session_deps_.ssl_config_service.get()); + false /* is_for_websockets */, tagging_common_connect_job_params_.get()); session_deps_.host_resolver->set_synchronous_mode(true); @@ -2125,7 +2108,7 @@ scoped_refptr<ClientSocketPool::SocketParams> socket_params = base::MakeRefCounted<ClientSocketPool::SocketParams>( - GetSSLConfig() /* ssl_config_for_origin */, + std::make_unique<SSLConfig>() /* ssl_config_for_origin */, nullptr /* ssl_config_for_proxy */); // Verify requested socket is tagged properly.
diff --git a/net/socket/udp_socket_perftest.cc b/net/socket/udp_socket_perftest.cc index 05018ff..4e42c52b 100644 --- a/net/socket/udp_socket_perftest.cc +++ b/net/socket/udp_socket_perftest.cc
@@ -4,9 +4,9 @@ #include "base/bind.h" #include "base/memory/weak_ptr.h" -#include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/test/perf_time_logger.h" +#include "base/test/scoped_task_environment.h" #include "net/base/io_buffer.h" #include "net/base/ip_endpoint.h" #include "net/base/net_errors.h" @@ -91,7 +91,8 @@ } void UDPSocketPerfTest::WriteBenchmark(bool use_nonblocking_io) { - base::MessageLoopForIO message_loop; + base::test::ScopedTaskEnvironment scoped_task_environment( + base::test::ScopedTaskEnvironment::MainThreadType::IO); const uint16_t kPort = 9999; // Setup the server to listen.
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc index e470370..0556642 100644 --- a/net/spdy/spdy_session_pool.cc +++ b/net/spdy/spdy_session_pool.cc
@@ -78,7 +78,7 @@ SpdySessionPool::SpdySessionPool( HostResolver* resolver, - SSLConfigService* ssl_config_service, + SSLClientContext* ssl_client_context, HttpServerProperties* http_server_properties, TransportSecurityState* transport_security_state, const quic::ParsedQuicVersionVector& quic_supported_versions, @@ -91,7 +91,7 @@ NetworkQualityEstimator* network_quality_estimator) : http_server_properties_(http_server_properties), transport_security_state_(transport_security_state), - ssl_config_service_(ssl_config_service), + ssl_client_context_(ssl_client_context), resolver_(resolver), quic_supported_versions_(quic_supported_versions), enable_sending_initial_data_(true), @@ -105,8 +105,8 @@ push_delegate_(nullptr), network_quality_estimator_(network_quality_estimator) { NetworkChangeNotifier::AddIPAddressObserver(this); - if (ssl_config_service_) - ssl_config_service_->AddObserver(this); + if (ssl_client_context_) + ssl_client_context_->AddObserver(this); CertDatabase::GetInstance()->AddObserver(this); } @@ -130,8 +130,8 @@ RemoveUnavailableSession((*sessions_.begin())->GetWeakPtr()); } - if (ssl_config_service_) - ssl_config_service_->RemoveObserver(this); + if (ssl_client_context_) + ssl_client_context_->RemoveObserver(this); NetworkChangeNotifier::RemoveIPAddressObserver(this); CertDatabase::GetInstance()->RemoveObserver(this); } @@ -646,11 +646,12 @@ return std::make_unique<SpdySession>( key, http_server_properties_, transport_security_state_, - ssl_config_service_, quic_supported_versions_, - enable_sending_initial_data_, enable_ping_based_connection_checking_, - support_ietf_format_quic_altsvc_, is_trusted_proxy, - session_max_recv_window_size_, initial_settings_, greased_http2_frame_, - time_func_, push_delegate_, network_quality_estimator_, net_log); + ssl_client_context_ ? ssl_client_context_->ssl_config_service() : nullptr, + quic_supported_versions_, enable_sending_initial_data_, + enable_ping_based_connection_checking_, support_ietf_format_quic_altsvc_, + is_trusted_proxy, session_max_recv_window_size_, initial_settings_, + greased_http2_frame_, time_func_, push_delegate_, + network_quality_estimator_, net_log); } base::WeakPtr<SpdySession> SpdySessionPool::InsertSession(
diff --git a/net/spdy/spdy_session_pool.h b/net/spdy/spdy_session_pool.h index 3dbfba25..1a2b3fea 100644 --- a/net/spdy/spdy_session_pool.h +++ b/net/spdy/spdy_session_pool.h
@@ -29,6 +29,7 @@ #include "net/log/net_log_source.h" #include "net/proxy_resolution/proxy_config.h" #include "net/socket/connect_job.h" +#include "net/socket/ssl_client_socket.h" #include "net/spdy/http2_push_promise_index.h" #include "net/spdy/server_push_delegate.h" #include "net/spdy/spdy_session_key.h" @@ -56,7 +57,7 @@ // This is a very simple pool for open SpdySessions. class NET_EXPORT SpdySessionPool : public NetworkChangeNotifier::IPAddressObserver, - public SSLConfigService::Observer, + public SSLClientContext::Observer, public CertDatabase::Observer { public: typedef base::TimeTicks (*TimeFunc)(void); @@ -134,7 +135,7 @@ }; SpdySessionPool(HostResolver* host_resolver, - SSLConfigService* ssl_config_service, + SSLClientContext* ssl_client_context, HttpServerProperties* http_server_properties, TransportSecurityState* transport_security_state, const quic::ParsedQuicVersionVector& quic_supported_versions, @@ -289,7 +290,7 @@ // or error out due to the IP address change. void OnIPAddressChanged() override; - // SSLConfigService::Observer methods: + // SSLClientContext::Observer methods: // We perform the same flushing as described above when SSL settings change. void OnSSLConfigChanged() override; @@ -414,7 +415,7 @@ // The index of all unclaimed pushed streams of all SpdySessions in this pool. Http2PushPromiseIndex push_promise_index_; - SSLConfigService* const ssl_config_service_; + SSLClientContext* const ssl_client_context_; HostResolver* const resolver_; // Versions of QUIC which may be used.
diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc index a8ffdfc..def20b7 100644 --- a/net/spdy/spdy_session_unittest.cc +++ b/net/spdy/spdy_session_unittest.cc
@@ -6631,7 +6631,7 @@ TestSSLConfigService() {} ~TestSSLConfigService() override = default; - void GetSSLConfig(SSLConfig* config) override { *config = config_; } + SSLContextConfig GetSSLContextConfig() override { return config_; } // Returns true if |hostname| is in domains_for_pooling_. This is a simpler // implementation than the production implementation in SSLConfigServiceMojo. @@ -6650,7 +6650,7 @@ } private: - SSLConfig config_; + SSLContextConfig config_; std::vector<std::string> domains_for_pooling_; };
diff --git a/net/spdy/spdy_test_util_common.cc b/net/spdy/spdy_test_util_common.cc index a7fde303..3d7710b5 100644 --- a/net/spdy/spdy_test_util_common.cc +++ b/net/spdy/spdy_test_util_common.cc
@@ -330,7 +330,7 @@ ssl_config_service(std::make_unique<SSLConfigServiceDefaults>()), socket_factory(std::make_unique<MockClientSocketFactory>()), http_auth_handler_factory(HttpAuthHandlerFactory::CreateDefault()), - http_server_properties(std::make_unique<HttpServerPropertiesImpl>()), + http_server_properties(std::make_unique<HttpServerProperties>()), enable_ip_pooling(true), enable_ping(false), enable_user_alternate_protocol_ports(false), @@ -440,8 +440,7 @@ storage_.set_ssl_config_service(std::make_unique<SSLConfigServiceDefaults>()); storage_.set_http_auth_handler_factory( HttpAuthHandlerFactory::CreateDefault()); - storage_.set_http_server_properties( - std::make_unique<HttpServerPropertiesImpl>()); + storage_.set_http_server_properties(std::make_unique<HttpServerProperties>()); storage_.set_job_factory(std::make_unique<URLRequestJobFactoryImpl>()); HttpNetworkSession::Params session_params; session_params.enable_spdy_ping_based_connection_checking = false;
diff --git a/net/spdy/spdy_test_util_common.h b/net/spdy/spdy_test_util_common.h index e0423d25..b5902199 100644 --- a/net/spdy/spdy_test_util_common.h +++ b/net/spdy/spdy_test_util_common.h
@@ -27,7 +27,7 @@ #include "net/http/http_auth_handler_factory.h" #include "net/http/http_network_session.h" #include "net/http/http_response_info.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/http/transport_security_state.h" #include "net/proxy_resolution/proxy_resolution_service.h" #include "net/socket/socket_test_util.h" @@ -216,7 +216,7 @@ std::unique_ptr<SSLConfigService> ssl_config_service; std::unique_ptr<MockClientSocketFactory> socket_factory; std::unique_ptr<HttpAuthHandlerFactory> http_auth_handler_factory; - std::unique_ptr<HttpServerPropertiesImpl> http_server_properties; + std::unique_ptr<HttpServerProperties> http_server_properties; #if BUILDFLAG(ENABLE_REPORTING) std::unique_ptr<ReportingService> reporting_service; std::unique_ptr<NetworkErrorLoggingService> network_error_logging_service;
diff --git a/net/ssl/ssl_config.cc b/net/ssl/ssl_config.cc index 4b1ce4c2..3ffdf6c7 100644 --- a/net/ssl/ssl_config.cc +++ b/net/ssl/ssl_config.cc
@@ -22,9 +22,7 @@ SSLConfig::CertAndStatus::~CertAndStatus() = default; SSLConfig::SSLConfig() - : version_min(kDefaultSSLVersionMin), - version_max(kDefaultSSLVersionMax), - early_data_enabled(false), + : early_data_enabled(false), false_start_enabled(true), require_ecdhe(false), ignore_certificate_errors(false),
diff --git a/net/ssl/ssl_config.h b/net/ssl/ssl_config.h index 44ea9fb..51c3e64 100644 --- a/net/ssl/ssl_config.h +++ b/net/ssl/ssl_config.h
@@ -8,6 +8,7 @@ #include <stdint.h> #include "base/memory/ref_counted.h" +#include "base/optional.h" #include "net/base/net_export.h" #include "net/base/network_isolation_key.h" #include "net/base/privacy_mode.h" @@ -54,12 +55,11 @@ // configuration. int GetCertVerifyFlags() const; - // The minimum and maximum protocol versions that are enabled. - // (Use the SSL_PROTOCOL_VERSION_xxx enumerators defined above.) - // SSL 2.0 and SSL 3.0 are not supported. If version_max < version_min, it - // means no protocol versions are enabled. - uint16_t version_min; - uint16_t version_max; + // If specified, the minimum and maximum protocol versions that are enabled. + // (Use the SSL_PROTOCOL_VERSION_xxx enumerators defined above.) If + // unspecified, values from the SSLConfigService are used. + base::Optional<uint16_t> version_min_override; + base::Optional<uint16_t> version_max_override; // Whether early data is enabled on this connection. Note that early data has // weaker security properties than normal data and changes the @@ -75,16 +75,6 @@ // If unsure, do not enable this option. bool early_data_enabled; - // Presorted list of cipher suites which should be explicitly prevented from - // being used in addition to those disabled by the net built-in policy. - // - // Though cipher suites are sent in TLS as "uint8_t CipherSuite[2]", in - // big-endian form, they should be declared in host byte order, with the - // first uint8_t occupying the most significant byte. - // Ex: To disable TLS_RSA_WITH_RC4_128_MD5, specify 0x0004, while to - // disable TLS_ECDH_ECDSA_WITH_RC4_128_SHA, specify 0xC002. - std::vector<uint16_t> disabled_cipher_suites; - bool false_start_enabled; // True if we'll use TLS False Start. // If true, causes only ECDHE cipher suites to be enabled.
diff --git a/net/ssl/ssl_config_service.cc b/net/ssl/ssl_config_service.cc index 3abd3289..a35d6b0a 100644 --- a/net/ssl/ssl_config_service.cc +++ b/net/ssl/ssl_config_service.cc
@@ -12,19 +12,26 @@ namespace { -// Checks if the config-service managed fields in two SSLConfigs are the same. -bool SSLConfigsAreEqual(const net::SSLConfig& config1, - const net::SSLConfig& config2) { +// Checks if the config-service managed fields in two SSLContextConfigs are the +// same. +bool SSLContextConfigsAreEqual(const net::SSLContextConfig& config1, + const net::SSLContextConfig& config2) { return std::tie(config1.version_min, config1.version_max, - config1.disabled_cipher_suites, config1.false_start_enabled, - config1.require_ecdhe) == + config1.disabled_cipher_suites) == std::tie(config2.version_min, config2.version_max, - config2.disabled_cipher_suites, config2.false_start_enabled, - config2.require_ecdhe); + config2.disabled_cipher_suites); } } // namespace +SSLContextConfig::SSLContextConfig() = default; +SSLContextConfig::SSLContextConfig(const SSLContextConfig&) = default; +SSLContextConfig::SSLContextConfig(SSLContextConfig&&) = default; +SSLContextConfig::~SSLContextConfig() = default; +SSLContextConfig& SSLContextConfig::operator=(const SSLContextConfig&) = + default; +SSLContextConfig& SSLContextConfig::operator=(SSLContextConfig&&) = default; + SSLConfigService::SSLConfigService() : observer_list_(base::ObserverListPolicy::EXISTING_ONLY) {} @@ -38,23 +45,23 @@ observer_list_.RemoveObserver(observer); } -void SSLConfigService::NotifySSLConfigChange() { +void SSLConfigService::NotifySSLContextConfigChange() { for (auto& observer : observer_list_) - observer.OnSSLConfigChanged(); + observer.OnSSLContextConfigChanged(); } -bool SSLConfigService::SSLConfigsAreEqualForTesting( - const net::SSLConfig& config1, - const net::SSLConfig& config2) { - return SSLConfigsAreEqual(config1, config2); +bool SSLConfigService::SSLContextConfigsAreEqualForTesting( + const SSLContextConfig& config1, + const SSLContextConfig& config2) { + return SSLContextConfigsAreEqual(config1, config2); } -void SSLConfigService::ProcessConfigUpdate(const SSLConfig& old_config, - const SSLConfig& new_config, +void SSLConfigService::ProcessConfigUpdate(const SSLContextConfig& old_config, + const SSLContextConfig& new_config, bool force_notification) { // Do nothing if the configuration hasn't changed. - if (!SSLConfigsAreEqual(old_config, new_config) || force_notification) - NotifySSLConfigChange(); + if (!SSLContextConfigsAreEqual(old_config, new_config) || force_notification) + NotifySSLContextConfigChange(); } } // namespace net
diff --git a/net/ssl/ssl_config_service.h b/net/ssl/ssl_config_service.h index 9136a65..73c7080b 100644 --- a/net/ssl/ssl_config_service.h +++ b/net/ssl/ssl_config_service.h
@@ -14,7 +14,33 @@ namespace net { -// The interface for retrieving the SSL configuration. This interface +struct NET_EXPORT SSLContextConfig { + SSLContextConfig(); + SSLContextConfig(const SSLContextConfig&); + SSLContextConfig(SSLContextConfig&&); + ~SSLContextConfig(); + SSLContextConfig& operator=(const SSLContextConfig&); + SSLContextConfig& operator=(SSLContextConfig&&); + + // The minimum and maximum protocol versions that are enabled. + // (Use the SSL_PROTOCOL_VERSION_xxx enumerators defined in ssl_config.h.) + // SSL 2.0 and SSL 3.0 are not supported. If version_max < version_min, it + // means no protocol versions are enabled. + uint16_t version_min = kDefaultSSLVersionMin; + uint16_t version_max = kDefaultSSLVersionMax; + + // Presorted list of cipher suites which should be explicitly prevented from + // being used in addition to those disabled by the net built-in policy. + // + // Though cipher suites are sent in TLS as "uint8_t CipherSuite[2]", in + // big-endian form, they should be declared in host byte order, with the + // first uint8_t occupying the most significant byte. + // Ex: To disable TLS_RSA_WITH_RC4_128_MD5, specify 0x0004, while to + // disable TLS_ECDH_ECDSA_WITH_RC4_128_SHA, specify 0xC002. + std::vector<uint16_t> disabled_cipher_suites; +}; + +// The interface for retrieving global SSL configuration. This interface // does not cover setting the SSL configuration, as on some systems, the // SSLConfigService objects may not have direct access to the configuration, or // live longer than the configuration preferences. @@ -23,15 +49,8 @@ // Observer is notified when SSL config settings have changed. class NET_EXPORT Observer { public: - // Notify observers if SSL settings have changed. We don't check all of the - // data in SSLConfig, just those that qualify as a user config change. - // The following settings are considered user changes: - // version_min - // version_max - // disabled_cipher_suites - // false_start_enabled - // require_ecdhe - virtual void OnSSLConfigChanged() = 0; + // Notify observers if SSL settings have changed. + virtual void OnSSLContextConfigChanged() = 0; protected: virtual ~Observer() {} @@ -41,7 +60,7 @@ virtual ~SSLConfigService(); // May not be thread-safe, should only be called on the IO thread. - virtual void GetSSLConfig(SSLConfig* config) = 0; + virtual SSLContextConfig GetSSLContextConfig() = 0; // Returns true if connections to |hostname| can reuse, or are permitted to // reuse, connections on which a client cert has been negotiated. Note that @@ -75,20 +94,22 @@ // Remove an observer of this service. void RemoveObserver(Observer* observer); - // Calls the OnSSLConfigChanged method of registered observers. Should only be - // called on the IO thread. - void NotifySSLConfigChange(); + // Calls the OnSSLContextConfigChanged method of registered observers. Should + // only be called on the IO thread. + void NotifySSLContextConfigChange(); - // Checks if the config-service managed fields in two SSLConfigs are the same. - static bool SSLConfigsAreEqualForTesting(const net::SSLConfig& config1, - const net::SSLConfig& config2); + // Checks if the config-service managed fields in two SSLContextConfigs are + // the same. + static bool SSLContextConfigsAreEqualForTesting( + const SSLContextConfig& config1, + const SSLContextConfig& config2); protected: // Process before/after config update. If |force_notification| is true, - // NotifySSLConfigChange will be called regardless of whether |orig_config| - // and |new_config| are equal. - void ProcessConfigUpdate(const SSLConfig& orig_config, - const SSLConfig& new_config, + // NotifySSLContextConfigChange will be called regardless of whether + // |orig_config| and |new_config| are equal. + void ProcessConfigUpdate(const SSLContextConfig& orig_config, + const SSLContextConfig& new_config, bool force_notification); private:
diff --git a/net/ssl/ssl_config_service_defaults.cc b/net/ssl/ssl_config_service_defaults.cc index f594f71..9348bb16 100644 --- a/net/ssl/ssl_config_service_defaults.cc +++ b/net/ssl/ssl_config_service_defaults.cc
@@ -9,8 +9,8 @@ SSLConfigServiceDefaults::SSLConfigServiceDefaults() = default; SSLConfigServiceDefaults::~SSLConfigServiceDefaults() = default; -void SSLConfigServiceDefaults::GetSSLConfig(SSLConfig* config) { - *config = default_config_; +SSLContextConfig SSLConfigServiceDefaults::GetSSLContextConfig() { + return default_config_; } bool SSLConfigServiceDefaults::CanShareConnectionWithClientCerts(
diff --git a/net/ssl/ssl_config_service_defaults.h b/net/ssl/ssl_config_service_defaults.h index ae7c477..ab5bb4b 100644 --- a/net/ssl/ssl_config_service_defaults.h +++ b/net/ssl/ssl_config_service_defaults.h
@@ -19,15 +19,15 @@ SSLConfigServiceDefaults(); ~SSLConfigServiceDefaults() override; - // Store default SSL config settings in |config|. - void GetSSLConfig(SSLConfig* config) override; + // Returns the default SSL config settings. + SSLContextConfig GetSSLContextConfig() override; bool CanShareConnectionWithClientCerts( const std::string& hostname) const override; private: // Default value of prefs. - const SSLConfig default_config_; + const SSLContextConfig default_config_; DISALLOW_COPY_AND_ASSIGN(SSLConfigServiceDefaults); };
diff --git a/net/ssl/ssl_config_service_unittest.cc b/net/ssl/ssl_config_service_unittest.cc index 4763a7b6..15d06cc 100644 --- a/net/ssl/ssl_config_service_unittest.cc +++ b/net/ssl/ssl_config_service_unittest.cc
@@ -15,21 +15,22 @@ class MockSSLConfigService : public SSLConfigService { public: - explicit MockSSLConfigService(const SSLConfig& config) : config_(config) {} + explicit MockSSLConfigService(const SSLContextConfig& config) + : config_(config) {} ~MockSSLConfigService() override = default; // SSLConfigService implementation - void GetSSLConfig(SSLConfig* config) override { *config = config_; } + SSLContextConfig GetSSLContextConfig() override { return config_; } bool CanShareConnectionWithClientCerts( const std::string& hostname) const override { return false; } - // Sets the SSLConfig to be returned by GetSSLConfig and processes any - // updates. - void SetSSLConfig(const SSLConfig& config) { - SSLConfig old_config = config_; + // Sets the SSLContextConfig to be returned by GetSSLContextConfig and + // processes any updates. + void SetSSLContextConfig(const SSLContextConfig& config) { + SSLContextConfig old_config = config_; config_ = config; ProcessConfigUpdate(old_config, config_, /*force_notification*/ false); } @@ -37,7 +38,7 @@ using SSLConfigService::ProcessConfigUpdate; private: - SSLConfig config_; + SSLContextConfig config_; }; class MockSSLConfigServiceObserver : public SSLConfigService::Observer { @@ -45,14 +46,13 @@ MockSSLConfigServiceObserver() = default; ~MockSSLConfigServiceObserver() override = default; - MOCK_METHOD0(OnSSLConfigChanged, void()); + MOCK_METHOD0(OnSSLContextConfigChanged, void()); }; } // namespace TEST(SSLConfigServiceTest, NoChangesWontNotifyObservers) { - SSLConfig initial_config; - initial_config.false_start_enabled = false; + SSLContextConfig initial_config; initial_config.version_min = SSL_PROTOCOL_VERSION_TLS1; initial_config.version_max = SSL_PROTOCOL_VERSION_TLS1_2; @@ -60,15 +60,14 @@ MockSSLConfigServiceObserver observer; mock_service.AddObserver(&observer); - EXPECT_CALL(observer, OnSSLConfigChanged()).Times(0); - mock_service.SetSSLConfig(initial_config); + EXPECT_CALL(observer, OnSSLContextConfigChanged()).Times(0); + mock_service.SetSSLContextConfig(initial_config); mock_service.RemoveObserver(&observer); } TEST(SSLConfigServiceTest, ForceNotificationNotifiesObservers) { - SSLConfig initial_config; - initial_config.false_start_enabled = false; + SSLContextConfig initial_config; initial_config.version_min = SSL_PROTOCOL_VERSION_TLS1; initial_config.version_max = SSL_PROTOCOL_VERSION_TLS1_2; @@ -76,16 +75,14 @@ MockSSLConfigServiceObserver observer; mock_service.AddObserver(&observer); - EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1); + EXPECT_CALL(observer, OnSSLContextConfigChanged()).Times(1); mock_service.ProcessConfigUpdate(initial_config, initial_config, true); mock_service.RemoveObserver(&observer); } TEST(SSLConfigServiceTest, ConfigUpdatesNotifyObservers) { - SSLConfig initial_config; - initial_config.false_start_enabled = false; - initial_config.require_ecdhe = false; + SSLContextConfig initial_config; initial_config.version_min = SSL_PROTOCOL_VERSION_TLS1; initial_config.version_max = SSL_PROTOCOL_VERSION_TLS1_2; @@ -93,23 +90,14 @@ MockSSLConfigServiceObserver observer; mock_service.AddObserver(&observer); - // Test that the basic boolean preferences trigger updates. - initial_config.false_start_enabled = true; - EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1); - mock_service.SetSSLConfig(initial_config); - - initial_config.require_ecdhe = true; - EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1); - mock_service.SetSSLConfig(initial_config); - // Test that changing the SSL version range triggers updates. initial_config.version_min = SSL_PROTOCOL_VERSION_TLS1_1; - EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1); - mock_service.SetSSLConfig(initial_config); + EXPECT_CALL(observer, OnSSLContextConfigChanged()).Times(1); + mock_service.SetSSLContextConfig(initial_config); initial_config.version_max = SSL_PROTOCOL_VERSION_TLS1_1; - EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1); - mock_service.SetSSLConfig(initial_config); + EXPECT_CALL(observer, OnSSLContextConfigChanged()).Times(1); + mock_service.SetSSLContextConfig(initial_config); // Test that disabling certain cipher suites triggers an update. std::vector<uint16_t> disabled_ciphers; @@ -117,22 +105,22 @@ disabled_ciphers.push_back(0xBEEFu); disabled_ciphers.push_back(0xDEADu); initial_config.disabled_cipher_suites = disabled_ciphers; - EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1); - mock_service.SetSSLConfig(initial_config); + EXPECT_CALL(observer, OnSSLContextConfigChanged()).Times(1); + mock_service.SetSSLContextConfig(initial_config); // Ensure that changing a disabled cipher suite, while still maintaining // sorted order, triggers an update. disabled_ciphers[1] = 0xCAFEu; initial_config.disabled_cipher_suites = disabled_ciphers; - EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1); - mock_service.SetSSLConfig(initial_config); + EXPECT_CALL(observer, OnSSLContextConfigChanged()).Times(1); + mock_service.SetSSLContextConfig(initial_config); // Ensure that removing a disabled cipher suite, while still keeping some // cipher suites disabled, triggers an update. disabled_ciphers.pop_back(); initial_config.disabled_cipher_suites = disabled_ciphers; - EXPECT_CALL(observer, OnSSLConfigChanged()).Times(1); - mock_service.SetSSLConfig(initial_config); + EXPECT_CALL(observer, OnSSLContextConfigChanged()).Times(1); + mock_service.SetSSLContextConfig(initial_config); mock_service.RemoveObserver(&observer); }
diff --git a/net/ssl/test_ssl_config_service.cc b/net/ssl/test_ssl_config_service.cc new file mode 100644 index 0000000..1d11fe7 --- /dev/null +++ b/net/ssl/test_ssl_config_service.cc
@@ -0,0 +1,29 @@ +// Copyright 2019 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 "net/ssl/test_ssl_config_service.h" + +namespace net { + +TestSSLConfigService::TestSSLConfigService(const SSLContextConfig& config) + : config_(config) {} + +TestSSLConfigService::~TestSSLConfigService() = default; + +SSLContextConfig TestSSLConfigService::GetSSLContextConfig() { + return config_; +} + +bool TestSSLConfigService::CanShareConnectionWithClientCerts( + const std::string& hostname) const { + return false; +} + +void TestSSLConfigService::UpdateSSLConfigAndNotify( + const SSLContextConfig& config) { + config_ = config; + NotifySSLContextConfigChange(); +} + +} // namespace net
diff --git a/net/ssl/test_ssl_config_service.h b/net/ssl/test_ssl_config_service.h new file mode 100644 index 0000000..cd7b04e --- /dev/null +++ b/net/ssl/test_ssl_config_service.h
@@ -0,0 +1,29 @@ +// Copyright 2019 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 NET_SSL_TEST_SSL_CONFIG_SERVICE_H_ +#define NET_SSL_TEST_SSL_CONFIG_SERVICE_H_ + +#include "net/ssl/ssl_config_service.h" + +namespace net { + +class TestSSLConfigService : public SSLConfigService { + public: + explicit TestSSLConfigService(const SSLContextConfig& config); + ~TestSSLConfigService() override; + + void UpdateSSLConfigAndNotify(const SSLContextConfig& config); + + SSLContextConfig GetSSLContextConfig() override; + bool CanShareConnectionWithClientCerts( + const std::string& hostname) const override; + + private: + SSLContextConfig config_; +}; + +} // namespace net + +#endif // NET_SSL_TEST_SSL_CONFIG_SERVICE_H_
diff --git a/net/test/embedded_test_server/embedded_test_server_unittest.cc b/net/test/embedded_test_server/embedded_test_server_unittest.cc index a61700f1..f4eafbb 100644 --- a/net/test/embedded_test_server/embedded_test_server_unittest.cc +++ b/net/test/embedded_test_server/embedded_test_server_unittest.cc
@@ -11,13 +11,13 @@ #include "base/bind_helpers.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" -#include "base/message_loop/message_loop.h" #include "base/message_loop/message_pump_type.h" #include "base/path_service.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" #include "base/strings/stringprintf.h" #include "base/synchronization/lock.h" +#include "base/task/single_thread_task_executor.h" #include "base/threading/thread.h" #include "base/threading/thread_task_runner_handle.h" #include "net/base/test_completion_callback.h" @@ -525,16 +525,11 @@ // base::PlatformThread::Delegate: void ThreadMain() override { - scoped_refptr<base::SingleThreadTaskRunner> io_thread_runner; - base::Thread io_thread("io_thread"); - base::Thread::Options thread_options; - thread_options.message_pump_type = base::MessagePumpType::IO; - ASSERT_TRUE(io_thread.StartWithOptions(thread_options)); - io_thread_runner = io_thread.task_runner(); - - std::unique_ptr<base::MessageLoop> loop; - if (message_loop_present_on_initialize_) - loop = std::make_unique<base::MessageLoopForIO>(); + std::unique_ptr<base::SingleThreadTaskExecutor> executor; + if (message_loop_present_on_initialize_) { + executor = std::make_unique<base::SingleThreadTaskExecutor>( + base::MessagePumpType::IO); + } // Create the test server instance. EmbeddedTestServer server(type_); @@ -543,14 +538,17 @@ ASSERT_TRUE(server.Start()); // Make a request and wait for the reply. - if (!loop) - loop = std::make_unique<base::MessageLoopForIO>(); + if (!executor) { + executor = std::make_unique<base::SingleThreadTaskExecutor>( + base::MessagePumpType::IO); + } std::unique_ptr<URLFetcher> fetcher = URLFetcher::Create(server.GetURL("/test?q=foo"), URLFetcher::GET, this, TRAFFIC_ANNOTATION_FOR_TESTS); auto test_context_getter = - base::MakeRefCounted<TestURLRequestContextGetter>(loop->task_runner()); + base::MakeRefCounted<TestURLRequestContextGetter>( + executor->task_runner()); fetcher->SetRequestContext(test_context_getter.get()); base::RunLoop run_loop; quit_run_loop_ = run_loop.QuitClosure(); @@ -560,7 +558,7 @@ // Shut down. if (message_loop_present_on_shutdown_) - loop.reset(); + executor.reset(); ASSERT_TRUE(server.ShutdownAndWaitUntilComplete()); }
diff --git a/net/tools/cachetool/cachetool.cc b/net/tools/cachetool/cachetool.cc index 7592203..2921583 100644 --- a/net/tools/cachetool/cachetool.cc +++ b/net/tools/cachetool/cachetool.cc
@@ -12,6 +12,7 @@ #include "base/format_macros.h" #include "base/hash/md5.h" #include "base/logging.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" @@ -667,7 +668,7 @@ int main(int argc, char* argv[]) { base::AtExitManager at_exit_manager; - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); base::CommandLine::Init(argc, argv); const base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess();
diff --git a/net/tools/cert_verify_tool/verify_using_path_builder.cc b/net/tools/cert_verify_tool/verify_using_path_builder.cc index 3363ff49..e847395 100644 --- a/net/tools/cert_verify_tool/verify_using_path_builder.cc +++ b/net/tools/cert_verify_tool/verify_using_path_builder.cc
@@ -166,12 +166,11 @@ // Verify the chain. net::SimplePathBuilderDelegate delegate( 2048, net::SimplePathBuilderDelegate::DigestPolicy::kWeakAllowSha1); - net::CertPathBuilder::Result result; net::CertPathBuilder path_builder( target_cert, ssl_trust_store->GetTrustStore(), &delegate, time, net::KeyPurpose::SERVER_AUTH, net::InitialExplicitPolicy::kFalse, {net::AnyPolicy()}, net::InitialPolicyMappingInhibit::kFalse, - net::InitialAnyPolicyInhibit::kFalse, &result); + net::InitialAnyPolicyInhibit::kFalse); path_builder.AddCertIssuerSource(&intermediate_cert_issuer_source); std::unique_ptr<net::CertIssuerSourceAia> aia_cert_issuer_source; @@ -182,7 +181,7 @@ } // Run the path builder. - path_builder.Run(); + net::CertPathBuilder::Result result = path_builder.Run(); // TODO(crbug.com/634443): Display any errors/warnings associated with path // building that were not part of a particular
diff --git a/net/tools/crash_cache/crash_cache.cc b/net/tools/crash_cache/crash_cache.cc index 4b01e3b..1c9b236f 100644 --- a/net/tools/crash_cache/crash_cache.cc +++ b/net/tools/crash_cache/crash_cache.cc
@@ -13,6 +13,7 @@ #include "base/command_line.h" #include "base/files/file_util.h" #include "base/logging.h" +#include "base/message_loop/message_pump_type.h" #include "base/path_service.h" #include "base/process/kill.h" #include "base/process/launch.h" @@ -327,7 +328,7 @@ // Main function on the child process. int SlaveCode(const base::FilePath& path, RankCrashes action) { - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); base::FilePath full_path; if (!CreateTargetFolder(path, action, &full_path)) { @@ -337,7 +338,7 @@ base::Thread cache_thread("CacheThread"); if (!cache_thread.StartWithOptions( - base::Thread::Options(base::MessagePump::Type::IO, 0))) + base::Thread::Options(base::MessagePumpType::IO, 0))) return GENERIC; if (action <= disk_cache::INSERT_ONE_3)
diff --git a/net/tools/disk_cache_memory_test/disk_cache_memory_test.cc b/net/tools/disk_cache_memory_test/disk_cache_memory_test.cc index a81b168..79dd276 100644 --- a/net/tools/disk_cache_memory_test/disk_cache_memory_test.cc +++ b/net/tools/disk_cache_memory_test/disk_cache_memory_test.cc
@@ -15,13 +15,14 @@ #include "base/command_line.h" #include "base/files/file_path.h" #include "base/logging.h" -#include "base/message_loop/message_loop.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_piece.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" +#include "base/task/single_thread_task_executor.h" #include "base/task/thread_pool/thread_pool.h" #include "base/threading/thread_task_runner_handle.h" #include "net/base/cache_type.h" @@ -258,7 +259,7 @@ bool Main(int argc, char** argv) { base::AtExitManager at_exit_manager; - base::MessageLoopForIO message_loop; + base::SingleThreadTaskExecutor executor(base::MessagePumpType::IO); base::ThreadPoolInstance::CreateAndStartWithDefaultParams( "disk_cache_memory_test"); base::CommandLine::Init(argc, argv);
diff --git a/net/tools/dump_cache/dump_files.cc b/net/tools/dump_cache/dump_files.cc index 6f68ee1..c0c42b7 100644 --- a/net/tools/dump_cache/dump_files.cc +++ b/net/tools/dump_cache/dump_files.cc
@@ -20,6 +20,7 @@ #include "base/files/file_util.h" #include "base/format_macros.h" #include "base/macros.h" +#include "base/message_loop/message_pump_type.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/task/single_thread_task_executor.h" @@ -62,7 +63,7 @@ // Dumps the contents of the Stats record. void DumpStats(const base::FilePath& path, disk_cache::CacheAddr addr) { // We need a task executor, although we really don't run any task. - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); disk_cache::BlockFiles block_files(path); if (!block_files.Init(false)) { @@ -446,7 +447,7 @@ DumpIndexHeader(input_path.Append(kIndexName), nullptr); // We need a task executor, although we really don't run any task. - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); CacheDumper dumper(input_path); if (!dumper.Init()) return -1; @@ -482,7 +483,7 @@ return -1; // We need a task executor, although we really don't run any task. - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); CacheDumper dumper(input_path); if (!dumper.Init()) return -1; @@ -535,7 +536,7 @@ return -1; // We need a task executor, although we really don't run any task. - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); CacheDumper dumper(input_path); if (!dumper.Init()) return -1;
diff --git a/net/tools/net_watcher/net_watcher.cc b/net/tools/net_watcher/net_watcher.cc index 09c55c5..e964d78 100644 --- a/net/tools/net_watcher/net_watcher.cc +++ b/net/tools/net_watcher/net_watcher.cc
@@ -20,6 +20,7 @@ #include "base/json/json_writer.h" #include "base/logging.h" #include "base/macros.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/strings/string_split.h" #include "base/task/single_thread_task_executor.h" @@ -155,7 +156,7 @@ logging::InitLogging(settings); // Just make the main task executor the network loop. - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); base::ThreadPoolInstance::CreateAndStartWithDefaultParams("NetWatcher");
diff --git a/net/tools/quic/quic_simple_server_bin.cc b/net/tools/quic/quic_simple_server_bin.cc index 8d371ba4..5c03da9 100644 --- a/net/tools/quic/quic_simple_server_bin.cc +++ b/net/tools/quic/quic_simple_server_bin.cc
@@ -10,6 +10,7 @@ #include "base/at_exit.h" #include "base/command_line.h" #include "base/logging.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/strings/string_number_conversions.h" #include "base/task/single_thread_task_executor.h" @@ -50,7 +51,7 @@ int main(int argc, char* argv[]) { base::ThreadPoolInstance::CreateAndStartWithDefaultParams("quic_server"); base::AtExitManager exit_manager; - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); base::CommandLine::Init(argc, argv); base::CommandLine* line = base::CommandLine::ForCurrentProcess();
diff --git a/net/tools/quic/synchronous_host_resolver.cc b/net/tools/quic/synchronous_host_resolver.cc index 1f8a16fd..fb2572d 100644 --- a/net/tools/quic/synchronous_host_resolver.cc +++ b/net/tools/quic/synchronous_host_resolver.cc
@@ -12,6 +12,7 @@ #include "base/location.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" +#include "base/message_loop/message_pump_type.h" #include "base/optional.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" @@ -57,7 +58,7 @@ ResolverThread::~ResolverThread() = default; void ResolverThread::Run() { - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); net::NetLog net_log; net::HostResolver::ManagerOptions options;
diff --git a/net/tools/stress_cache/stress_cache.cc b/net/tools/stress_cache/stress_cache.cc index ff485cf4..8b4428c9 100644 --- a/net/tools/stress_cache/stress_cache.cc +++ b/net/tools/stress_cache/stress_cache.cc
@@ -25,6 +25,7 @@ #include "base/files/file_path.h" #include "base/location.h" #include "base/logging.h" +#include "base/message_loop/message_pump_type.h" #include "base/path_service.h" #include "base/process/launch.h" #include "base/process/process.h" @@ -306,7 +307,7 @@ base::Thread cache_thread("CacheThread"); if (!cache_thread.StartWithOptions( - base::Thread::Options(base::MessagePump::Type::IO, 0))) + base::Thread::Options(base::MessagePumpType::IO, 0))) return; g_data = new Data(); @@ -429,7 +430,7 @@ // Some time for the memory manager to flush stuff. base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(3)); - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); char* end; long int iteration = strtol(argv[1], &end, 0);
diff --git a/net/tools/testserver/run_testserver.cc b/net/tools/testserver/run_testserver.cc index 0a997386..2f69598 100644 --- a/net/tools/testserver/run_testserver.cc +++ b/net/tools/testserver/run_testserver.cc
@@ -9,6 +9,7 @@ #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/logging.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" #include "base/task/single_thread_task_executor.h" @@ -24,7 +25,7 @@ int main(int argc, const char* argv[]) { base::AtExitManager at_exit_manager; - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); // Process command line base::CommandLine::Init(argc, argv);
diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py index cb7b75f..92727e9d 100755 --- a/net/tools/testserver/testserver.py +++ b/net/tools/testserver/testserver.py
@@ -1874,11 +1874,7 @@ my_data_dir = self.options.data_dir else: # Create the default path to our data dir, relative to the exe dir. - my_data_dir = os.path.join(BASE_DIR, "..", "..", "..", "..", - "test", "data") - - #TODO(ibrar): Must use Find* funtion defined in google\tools - #i.e my_data_dir = FindUpward(my_data_dir, "test", "data") + my_data_dir = os.path.join(BASE_DIR, "..", "..", "data") return my_data_dir
diff --git a/net/url_request/url_request_context_builder.cc b/net/url_request/url_request_context_builder.cc index d1c0d4be..4d5b9c1 100644 --- a/net/url_request/url_request_context_builder.cc +++ b/net/url_request/url_request_context_builder.cc
@@ -29,7 +29,7 @@ #include "net/http/http_auth_handler_factory.h" #include "net/http/http_cache.h" #include "net/http/http_network_layer.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/http/http_server_properties_manager.h" #include "net/http/transport_security_persister.h" #include "net/http/transport_security_state.h" @@ -497,7 +497,7 @@ storage->set_http_server_properties(std::move(http_server_properties_)); } else { storage->set_http_server_properties( - std::unique_ptr<HttpServerProperties>(new HttpServerPropertiesImpl())); + std::make_unique<HttpServerProperties>()); } if (cert_verifier_) {
diff --git a/net/url_request/url_request_test_util.cc b/net/url_request/url_request_test_util.cc index c8a5f3b..30654a6 100644 --- a/net/url_request/url_request_test_util.cc +++ b/net/url_request/url_request_test_util.cc
@@ -20,7 +20,7 @@ #include "net/dns/mock_host_resolver.h" #include "net/http/http_network_session.h" #include "net/http/http_response_headers.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/http/transport_security_state.h" #include "net/proxy_resolution/proxy_retry_info.h" #include "net/url_request/static_http_user_agent_settings.h" @@ -98,7 +98,7 @@ } if (!http_server_properties()) { context_storage_.set_http_server_properties( - std::unique_ptr<HttpServerProperties>(new HttpServerPropertiesImpl())); + std::make_unique<HttpServerProperties>()); } // In-memory cookie store. if (!cookie_store()) {
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index 286fb5e4..7907e95 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc
@@ -89,7 +89,7 @@ #include "net/http/http_network_session.h" #include "net/http/http_request_headers.h" #include "net/http/http_response_headers.h" -#include "net/http/http_server_properties_impl.h" +#include "net/http/http_server_properties.h" #include "net/http/http_util.h" #include "net/log/net_log_event_type.h" #include "net/log/net_log_source.h" @@ -105,6 +105,7 @@ #include "net/ssl/ssl_connection_status_flags.h" #include "net/ssl/ssl_private_key.h" #include "net/ssl/ssl_server_config.h" +#include "net/ssl/test_ssl_config_service.h" #include "net/test/cert_test_util.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "net/test/embedded_test_server/http_request.h" @@ -4381,33 +4382,6 @@ return std::move(http_response); } -class TestSSLConfigService : public SSLConfigService { - public: - TestSSLConfigService() - : min_version_(kDefaultSSLVersionMin), - max_version_(kDefaultSSLVersionMax) {} - ~TestSSLConfigService() override = default; - - void set_max_version(uint16_t version) { max_version_ = version; } - void set_min_version(uint16_t version) { min_version_ = version; } - - // SSLConfigService: - void GetSSLConfig(SSLConfig* config) override { - *config = SSLConfig(); - config->version_min = min_version_; - config->version_max = max_version_; - } - - bool CanShareConnectionWithClientCerts( - const std::string& hostname) const override { - return false; - } - - private: - uint16_t min_version_; - uint16_t max_version_; -}; - } // namespace // In this unit test, we're using the HTTPTestServer as a proxy server and @@ -11226,7 +11200,8 @@ class HTTPSFallbackTest : public TestWithScopedTaskEnvironment { public: HTTPSFallbackTest() : context_(true) { - ssl_config_service_ = std::make_unique<TestSSLConfigService>(); + ssl_config_service_ = + std::make_unique<TestSSLConfigService>(SSLContextConfig()); context_.set_ssl_config_service(ssl_config_service_.get()); } ~HTTPSFallbackTest() override = default; @@ -13344,8 +13319,9 @@ cert_verifier_.set_default_result(OK); context_.set_cert_verifier(&cert_verifier_); - ssl_config_service_ = std::make_unique<TestSSLConfigService>(); - ssl_config_service_->set_max_version(SSL_PROTOCOL_VERSION_TLS1_3); + SSLContextConfig config; + config.version_max = SSL_PROTOCOL_VERSION_TLS1_3; + ssl_config_service_ = std::make_unique<TestSSLConfigService>(config); context_.set_ssl_config_service(ssl_config_service_.get()); context_.Init();
diff --git a/remoting/host/desktop_process_main.cc b/remoting/host/desktop_process_main.cc index ac95b3eb..08c481d1 100644 --- a/remoting/host/desktop_process_main.cc +++ b/remoting/host/desktop_process_main.cc
@@ -11,6 +11,7 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/command_line.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "base/task/thread_pool/thread_pool.h" @@ -37,8 +38,7 @@ base::ThreadPoolInstance::CreateAndStartWithDefaultParams("Me2Me"); - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); base::RunLoop run_loop; scoped_refptr<AutoThreadTaskRunner> ui_task_runner = new AutoThreadTaskRunner( main_task_executor.task_runner(), run_loop.QuitClosure()); @@ -50,12 +50,12 @@ // Launch the input thread. scoped_refptr<AutoThreadTaskRunner> input_task_runner = AutoThread::CreateWithType("Input thread", ui_task_runner, - base::MessagePump::Type::IO); + base::MessagePumpType::IO); // Launch the I/O thread. scoped_refptr<AutoThreadTaskRunner> io_task_runner = AutoThread::CreateWithType("I/O thread", ui_task_runner, - base::MessagePump::Type::IO); + base::MessagePumpType::IO); mojo::core::ScopedIPCSupport ipc_support( io_task_runner->task_runner(),
diff --git a/remoting/host/host_config_upgrader.h b/remoting/host/host_config_upgrader.h index ae3ebe3e..0bd3bc8 100644 --- a/remoting/host/host_config_upgrader.h +++ b/remoting/host/host_config_upgrader.h
@@ -10,6 +10,7 @@ #include "base/files/file_path.h" #include "base/macros.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "base/values.h" @@ -47,7 +48,7 @@ void WriteConfig(); - base::SingleThreadTaskExecutor io_task_executor_{base::MessagePump::Type::IO}; + base::SingleThreadTaskExecutor io_task_executor_{base::MessagePumpType::IO}; base::RunLoop run_loop_; int exit_code_ = 0; base::FilePath config_path_;
diff --git a/remoting/host/it2me/it2me_native_messaging_host_main.cc b/remoting/host/it2me/it2me_native_messaging_host_main.cc index 5ad317a..8358f0eb 100644 --- a/remoting/host/it2me/it2me_native_messaging_host_main.cc +++ b/remoting/host/it2me/it2me_native_messaging_host_main.cc
@@ -9,6 +9,7 @@ #include "base/at_exit.h" #include "base/command_line.h" #include "base/i18n/icu_util.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "base/task/thread_pool/thread_pool.h" @@ -200,8 +201,7 @@ #error Not implemented. #endif - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); base::RunLoop run_loop; // NetworkChangeNotifier must be initialized after SingleThreadTaskExecutor.
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc index 0faeb4e6..773ceb2 100644 --- a/remoting/host/remoting_me2me_host.cc +++ b/remoting/host/remoting_me2me_host.cc
@@ -19,6 +19,7 @@ #include "base/files/file_path.h" #include "base/files/file_util.h" #include "base/macros.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" #include "base/strings/string_number_conversions.h" @@ -1734,8 +1735,7 @@ base::ThreadPoolInstance::CreateAndStartWithDefaultParams("Me2Me"); // Create the main task executor and start helper threads. - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); base::RunLoop run_loop; std::unique_ptr<ChromotingHostContext> context = ChromotingHostContext::Create(new AutoThreadTaskRunner(
diff --git a/remoting/host/security_key/remote_security_key_main.cc b/remoting/host/security_key/remote_security_key_main.cc index 754942b..3b5bc55 100644 --- a/remoting/host/security_key/remote_security_key_main.cc +++ b/remoting/host/security_key/remote_security_key_main.cc
@@ -10,6 +10,7 @@ #include "base/at_exit.h" #include "base/command_line.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "base/threading/thread_task_runner_handle.h" @@ -161,7 +162,7 @@ int RemoteSecurityKeyMain(int argc, char** argv) { // This object instance is required by Chrome classes (such as MessageLoop). base::AtExitManager exit_manager; - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); base::CommandLine::Init(argc, argv); remoting::InitHostLogging();
diff --git a/remoting/host/setup/me2me_native_messaging_host_main.cc b/remoting/host/setup/me2me_native_messaging_host_main.cc index 026041e..9389ab3 100644 --- a/remoting/host/setup/me2me_native_messaging_host_main.cc +++ b/remoting/host/setup/me2me_native_messaging_host_main.cc
@@ -13,6 +13,7 @@ #include "base/command_line.h" #include "base/files/file.h" #include "base/i18n/icu_util.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/strings/string_number_conversions.h" #include "base/task/single_thread_task_executor.h" @@ -96,10 +97,9 @@ // An IO thread is needed for the pairing registry and URL context getter. base::Thread io_thread("io_thread"); io_thread.StartWithOptions( - base::Thread::Options(base::MessagePump::Type::IO, 0)); + base::Thread::Options(base::MessagePumpType::IO, 0)); - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); base::RunLoop run_loop; scoped_refptr<DaemonController> daemon_controller =
diff --git a/remoting/host/setup/start_host_main.cc b/remoting/host/setup/start_host_main.cc index 90bbad0..dceadc4 100644 --- a/remoting/host/setup/start_host_main.cc +++ b/remoting/host/setup/start_host_main.cc
@@ -10,6 +10,7 @@ #include "base/at_exit.h" #include "base/bind.h" #include "base/command_line.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" #include "base/strings/stringprintf.h" @@ -218,7 +219,7 @@ // URLRequestContextGetter. base::SingleThreadTaskExecutor main_thread_task_executor; g_main_thread_task_executor = &main_thread_task_executor; - base::Thread::Options io_thread_options(base::MessagePump::Type::IO, 0); + base::Thread::Options io_thread_options(base::MessagePumpType::IO, 0); base::Thread io_thread("IO thread"); io_thread.StartWithOptions(io_thread_options);
diff --git a/remoting/host/win/chromoting_module.cc b/remoting/host/win/chromoting_module.cc index c972b40..20b82ff9 100644 --- a/remoting/host/win/chromoting_module.cc +++ b/remoting/host/win/chromoting_module.cc
@@ -6,6 +6,7 @@ #include "base/lazy_instance.h" #include "base/logging.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" #include "base/task/single_thread_task_executor.h" @@ -116,8 +117,7 @@ } // Arrange to run |main_task_executor| until no components depend on it. - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); base::RunLoop run_loop; g_module_task_runner.Get() = new AutoThreadTaskRunner( main_task_executor.task_runner(), run_loop.QuitClosure());
diff --git a/remoting/host/win/host_service.cc b/remoting/host/win/host_service.cc index 35b6eab..41bb7ecc 100644 --- a/remoting/host/win/host_service.cc +++ b/remoting/host/win/host_service.cc
@@ -16,6 +16,7 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/files/file_path.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" #include "base/strings/utf_string_conversions.h" @@ -205,7 +206,7 @@ // Launch the I/O thread. scoped_refptr<AutoThreadTaskRunner> io_task_runner = AutoThread::CreateWithType(kIoThreadName, task_runner, - base::MessagePump::Type::IO); + base::MessagePumpType::IO); if (!io_task_runner.get()) { LOG(FATAL) << "Failed to start the I/O thread"; return; @@ -237,8 +238,7 @@ } void HostService::RunAsServiceImpl() { - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); base::RunLoop run_loop; main_task_runner_ = main_task_executor.task_runner(); weak_ptr_ = weak_factory_.GetWeakPtr(); @@ -296,8 +296,7 @@ } int HostService::RunInConsole() { - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); base::RunLoop run_loop; main_task_runner_ = main_task_executor.task_runner(); weak_ptr_ = weak_factory_.GetWeakPtr();
diff --git a/remoting/protocol/ssl_hmac_channel_authenticator.cc b/remoting/protocol/ssl_hmac_channel_authenticator.cc index 9c4a3da..c4fa431 100644 --- a/remoting/protocol/ssl_hmac_channel_authenticator.cc +++ b/remoting/protocol/ssl_hmac_channel_authenticator.cc
@@ -294,7 +294,7 @@ socket_context_.ct_policy_enforcer = std::make_unique<net::DefaultCTPolicyEnforcer>(); socket_context_.client_context = std::make_unique<net::SSLClientContext>( - socket_context_.cert_verifier.get(), + nullptr /* default config */, socket_context_.cert_verifier.get(), socket_context_.transport_security_state.get(), socket_context_.ct_verifier.get(), socket_context_.ct_policy_enforcer.get(),
diff --git a/remoting/test/chromoting_test_driver.cc b/remoting/test/chromoting_test_driver.cc index 45fc2fa..2cffad07 100644 --- a/remoting/test/chromoting_test_driver.cc +++ b/remoting/test/chromoting_test_driver.cc
@@ -7,6 +7,7 @@ #include "base/feature_list.h" #include "base/files/file_path.h" #include "base/logging.h" +#include "base/message_loop/message_pump_type.h" #include "base/strings/stringprintf.h" #include "base/task/single_thread_task_executor.h" #include "base/task/thread_pool/thread_pool.h" @@ -151,7 +152,7 @@ int main(int argc, char* argv[]) { base::TestSuite test_suite(argc, argv); base::FeatureList::InitializeInstance(std::string(), std::string()); - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); if (!base::CommandLine::InitializedForCurrentProcess()) { if (!base::CommandLine::Init(argc, argv)) {
diff --git a/remoting/test/chromoting_test_driver_environment.cc b/remoting/test/chromoting_test_driver_environment.cc index f016586..d49aa6f 100644 --- a/remoting/test/chromoting_test_driver_environment.cc +++ b/remoting/test/chromoting_test_driver_environment.cc
@@ -9,10 +9,11 @@ #include "base/bind.h" #include "base/logging.h" -#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop_current.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/strings/stringprintf.h" +#include "base/task/single_thread_task_executor.h" #include "remoting/test/access_token_fetcher.h" #include "remoting/test/host_list_fetcher.h" #include "remoting/test/test_token_storage.h" @@ -49,7 +50,8 @@ } if (!base::MessageLoopCurrent::Get()) { - message_loop_.reset(new base::MessageLoopForIO); + executor_ = std::make_unique<base::SingleThreadTaskExecutor>( + base::MessagePumpType::IO); } // If a unit test has set |test_test_token_storage_| then we should use it @@ -199,7 +201,7 @@ // registered AtExitManager. The AtExitManager is torn down before the test // destructor is executed, so we tear down the MessageLoop here, while it is // still valid. - message_loop_.reset(); + executor_.reset(); } bool ChromotingTestDriverEnvironment::RetrieveAccessToken(
diff --git a/remoting/test/chromoting_test_driver_environment.h b/remoting/test/chromoting_test_driver_environment.h index 9c0ee9b..159ff3b 100644 --- a/remoting/test/chromoting_test_driver_environment.h +++ b/remoting/test/chromoting_test_driver_environment.h
@@ -16,7 +16,7 @@ #include "testing/gtest/include/gtest/gtest.h" namespace base { -class MessageLoopForIO; +class SingleThreadTaskExecutor; } namespace remoting { @@ -147,7 +147,7 @@ remoting::test::HostListFetcher* test_host_list_fetcher_ = nullptr; // Used for running network request tasks. - std::unique_ptr<base::MessageLoopForIO> message_loop_; + std::unique_ptr<base::SingleThreadTaskExecutor> executor_; DISALLOW_COPY_AND_ASSIGN(ChromotingTestDriverEnvironment); };
diff --git a/remoting/test/ftl_services_playground_main.cc b/remoting/test/ftl_services_playground_main.cc index ef23fff..e53dd550 100644 --- a/remoting/test/ftl_services_playground_main.cc +++ b/remoting/test/ftl_services_playground_main.cc
@@ -4,6 +4,7 @@ #include "base/at_exit.h" #include "base/command_line.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "base/task/thread_pool/thread_pool.h" @@ -14,7 +15,7 @@ base::AtExitManager exitManager; base::CommandLine::Init(argc, argv); - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); remoting::FtlServicesPlayground playground; if (playground.ShouldPrintHelp()) {
diff --git a/remoting/test/ftl_signaling_playground_main.cc b/remoting/test/ftl_signaling_playground_main.cc index 51330eea..12983ce1 100644 --- a/remoting/test/ftl_signaling_playground_main.cc +++ b/remoting/test/ftl_signaling_playground_main.cc
@@ -4,6 +4,7 @@ #include "base/at_exit.h" #include "base/command_line.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "base/task/thread_pool/thread_pool.h" @@ -14,7 +15,7 @@ base::AtExitManager exitManager; base::CommandLine::Init(argc, argv); - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); remoting::FtlSignalingPlayground playground; if (playground.ShouldPrintHelp()) {
diff --git a/remoting/test/it2me_cli_host_main.cc b/remoting/test/it2me_cli_host_main.cc index 7b3bc12c..1a6caa23 100644 --- a/remoting/test/it2me_cli_host_main.cc +++ b/remoting/test/it2me_cli_host_main.cc
@@ -4,6 +4,7 @@ #include "base/at_exit.h" #include "base/command_line.h" +#include "base/message_loop/message_pump_type.h" #include "base/task/single_thread_task_executor.h" #include "base/task/thread_pool/thread_pool.h" #include "build/build_config.h" @@ -30,7 +31,7 @@ base::GetLinuxDistro(); #endif // OS_LINUX - base::SingleThreadTaskExecutor io_task_executor(base::MessagePump::Type::IO); + base::SingleThreadTaskExecutor io_task_executor(base::MessagePumpType::IO); remoting::It2MeCliHost cli_host; base::ThreadPoolInstance::CreateAndStartWithDefaultParams("It2MeCliHost");
diff --git a/services/network/BUILD.gn b/services/network/BUILD.gn index cea11774..06eb3d3 100644 --- a/services/network/BUILD.gn +++ b/services/network/BUILD.gn
@@ -9,8 +9,6 @@ jumbo_component("network_service") { sources = [ - "cert_verifier_config_type_converter.cc", - "cert_verifier_config_type_converter.h", "chunked_data_pipe_upload_data_stream.cc", "chunked_data_pipe_upload_data_stream.h", "conditional_cache_deletion_helper.cc",
diff --git a/services/network/cert_verifier_config_type_converter.cc b/services/network/cert_verifier_config_type_converter.cc deleted file mode 100644 index bcbb045..0000000 --- a/services/network/cert_verifier_config_type_converter.cc +++ /dev/null
@@ -1,26 +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 "services/network/cert_verifier_config_type_converter.h" - -namespace mojo { - -net::CertVerifier::Config -TypeConverter<net::CertVerifier::Config, network::mojom::SSLConfigPtr>::Convert( - const network::mojom::SSLConfigPtr& mojo_config) { - DCHECK(mojo_config); - - net::CertVerifier::Config net_config; - net_config.enable_rev_checking = mojo_config->rev_checking_enabled; - net_config.require_rev_checking_local_anchors = - mojo_config->rev_checking_required_local_anchors; - net_config.enable_sha1_local_anchors = - mojo_config->sha1_local_anchors_enabled; - net_config.disable_symantec_enforcement = - mojo_config->symantec_enforcement_disabled; - - return net_config; -} - -} // namespace mojo
diff --git a/services/network/cert_verifier_config_type_converter.h b/services/network/cert_verifier_config_type_converter.h deleted file mode 100644 index 5a05579..0000000 --- a/services/network/cert_verifier_config_type_converter.h +++ /dev/null
@@ -1,24 +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 SERVICES_NETWORK_CERT_VERIFIER_CONFIG_TYPE_CONVERTER_H_ -#define SERVICES_NETWORK_CERT_VERIFIER_CONFIG_TYPE_CONVERTER_H_ - -#include "mojo/public/cpp/bindings/type_converter.h" -#include "net/cert/cert_verifier.h" -#include "services/network/public/mojom/ssl_config.mojom.h" - -namespace mojo { - -// Converts a network::mojom::SSLConfigPtr to a net::CertVerifier::Config. -// Tested in SSLConfigServiceMojo's unittests. -template <> -struct TypeConverter<net::CertVerifier::Config, network::mojom::SSLConfigPtr> { - static net::CertVerifier::Config Convert( - const network::mojom::SSLConfigPtr& mojo_config); -}; - -} // namespace mojo - -#endif // SERVICES_NETWORK_CERT_VERIFIER_CONFIG_TYPE_CONVERTER_H_
diff --git a/services/network/http_server_properties_pref_delegate.h b/services/network/http_server_properties_pref_delegate.h index d82df28..47fd481 100644 --- a/services/network/http_server_properties_pref_delegate.h +++ b/services/network/http_server_properties_pref_delegate.h
@@ -9,7 +9,6 @@ #include "base/macros.h" #include "components/prefs/pref_change_registrar.h" #include "net/http/http_server_properties.h" -#include "net/http/http_server_properties_manager.h" class PrefRegistrySimple; @@ -17,7 +16,7 @@ // Manages disk storage for a net::HttpServerPropertiesManager. class HttpServerPropertiesPrefDelegate - : public net::HttpServerPropertiesManager::PrefDelegate { + : public net::HttpServerProperties::PrefDelegate { public: // The created object must be destroyed before |pref_service|. explicit HttpServerPropertiesPrefDelegate(PrefService* pref_service); @@ -25,7 +24,7 @@ static void RegisterPrefs(PrefRegistrySimple* pref_registry); - // net::HttpServerPropertiesManager::PrefDelegate implementation. + // net::HttpServerProperties::PrefDelegate implementation. const base::DictionaryValue* GetServerProperties() const override; void SetServerProperties(const base::DictionaryValue& value, base::OnceClosure callback) override;
diff --git a/services/network/network_context.cc b/services/network/network_context.cc index 3622ba17..8cee3ac 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc
@@ -56,7 +56,6 @@ #include "net/http/http_cache.h" #include "net/http/http_network_session.h" #include "net/http/http_server_properties.h" -#include "net/http/http_server_properties_manager.h" #include "net/http/http_transaction_factory.h" #include "net/proxy_resolution/proxy_config.h" #include "net/traffic_annotation/network_traffic_annotation.h" @@ -1868,11 +1867,9 @@ NetworkQualitiesPrefDelegate::RegisterPrefs(pref_registry.get()); pref_service = pref_service_factory.Create(pref_registry.get()); - builder.SetHttpServerProperties( - std::make_unique<net::HttpServerPropertiesManager>( - std::make_unique<HttpServerPropertiesPrefDelegate>( - pref_service.get()), - net_log)); + builder.SetHttpServerProperties(std::make_unique<net::HttpServerProperties>( + std::make_unique<HttpServerPropertiesPrefDelegate>(pref_service.get()), + net_log)); network_qualities_pref_delegate_ = std::make_unique<NetworkQualitiesPrefDelegate>(
diff --git a/services/network/network_context_unittest.cc b/services/network/network_context_unittest.cc index dc44674..bb63bac 100644 --- a/services/network/network_context_unittest.cc +++ b/services/network/network_context_unittest.cc
@@ -330,8 +330,7 @@ DISALLOW_COPY_AND_ASSIGN(TestProxyLookupClient); }; -class NetworkContextTest : public testing::Test, - public net::SSLConfigService::Observer { +class NetworkContextTest : public testing::Test { public: NetworkContextTest() : scoped_task_environment_( @@ -372,8 +371,6 @@ return network_service_.get(); } - void OnSSLConfigChanged() override { ++ssl_config_changed_count_; } - // Looks up a value with the given name from the NetworkContext's // TransportSocketPool info dictionary. int GetSocketPoolInfo(NetworkContext* context, base::StringPiece name) { @@ -436,7 +433,6 @@ // Stores the NetworkContextPtr of the most recently created NetworkContext. // Not strictly needed, but seems best to mimic real-world usage. mojom::NetworkContextPtr network_context_ptr_; - int ssl_config_changed_count_ = 0; }; TEST_F(NetworkContextTest, DestroyContextWithLiveRequest) {
diff --git a/services/network/network_qualities_pref_delegate.cc b/services/network/network_qualities_pref_delegate.cc index 06e0658..042fd94 100644 --- a/services/network/network_qualities_pref_delegate.cc +++ b/services/network/network_qualities_pref_delegate.cc
@@ -14,6 +14,7 @@ #include "components/prefs/pref_registry.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" +#include "net/http/http_server_properties.h" #include "net/nqe/network_quality_estimator.h" namespace {
diff --git a/services/network/proxy_resolving_client_socket.cc b/services/network/proxy_resolving_client_socket.cc index 6972599..169b046 100644 --- a/services/network/proxy_resolving_client_socket.cc +++ b/services/network/proxy_resolving_client_socket.cc
@@ -25,6 +25,7 @@ #include "net/http/proxy_fallback.h" #include "net/log/net_log_source_type.h" #include "net/socket/socket_tag.h" +#include "net/ssl/ssl_config.h" #include "net/traffic_annotation/network_traffic_annotation.h" namespace network { @@ -32,12 +33,10 @@ ProxyResolvingClientSocket::ProxyResolvingClientSocket( net::HttpNetworkSession* network_session, const net::CommonConnectJobParams* common_connect_job_params, - const net::SSLConfig& ssl_config, const GURL& url, bool use_tls) : network_session_(network_session), common_connect_job_params_(common_connect_job_params), - ssl_config_(ssl_config), url_(url), use_tls_(use_tls), net_log_(net::NetLogWithSource::Make(network_session_->net_log(), @@ -288,9 +287,10 @@ // the consumer. // // TODO(mmenke): Investigate that. + net::SSLConfig ssl_config; connect_job_ = net::ConnectJob::CreateConnectJob( use_tls_, net::HostPortPair::FromURL(url_), proxy_info_.proxy_server(), - proxy_annotation_tag, &ssl_config_, &ssl_config_, true /* force_tunnel */, + proxy_annotation_tag, &ssl_config, &ssl_config, true /* force_tunnel */, net::PRIVACY_MODE_DISABLED, net::OnHostResolutionCallback(), net::MAXIMUM_PRIORITY, net::SocketTag(), net::NetworkIsolationKey(), common_connect_job_params_, this); @@ -352,10 +352,8 @@ if (!net::CanFalloverToNextProxy(proxy_info_.proxy_server(), error, &error)) return error; - if (proxy_info_.is_https() && ssl_config_.send_client_cert) { - network_session_->ssl_client_auth_cache()->Remove( - proxy_info_.proxy_server().host_port_pair()); - } + // TODO(davidben): When adding proxy client certificate support to this class, + // clear the SSLClientAuthCache entries on error. // There was nothing left to fall-back to, so fail the transaction // with the last connection error we got.
diff --git a/services/network/proxy_resolving_client_socket.h b/services/network/proxy_resolving_client_socket.h index 10e545c..dad61419 100644 --- a/services/network/proxy_resolving_client_socket.h +++ b/services/network/proxy_resolving_client_socket.h
@@ -23,7 +23,6 @@ #include "net/socket/connect_job.h" #include "net/socket/next_proto.h" #include "net/socket/stream_socket.h" -#include "net/ssl/ssl_config_service.h" #include "net/traffic_annotation/network_traffic_annotation.h" #include "url/gurl.h" @@ -55,7 +54,6 @@ ProxyResolvingClientSocket( net::HttpNetworkSession* network_session, const net::CommonConnectJobParams* common_connect_job_params, - const net::SSLConfig& ssl_config, const GURL& url, bool use_tls); ~ProxyResolvingClientSocket() override; @@ -131,7 +129,6 @@ std::unique_ptr<net::ConnectJob> connect_job_; std::unique_ptr<net::StreamSocket> socket_; - const net::SSLConfig ssl_config_; std::unique_ptr<net::ProxyResolutionService::Request> proxy_resolve_request_; net::ProxyInfo proxy_info_; const GURL url_;
diff --git a/services/network/proxy_resolving_client_socket_factory.cc b/services/network/proxy_resolving_client_socket_factory.cc index 91140e6..45de7ee 100644 --- a/services/network/proxy_resolving_client_socket_factory.cc +++ b/services/network/proxy_resolving_client_socket_factory.cc
@@ -86,13 +86,8 @@ ->GetSession() ->http_auth_cache(); network_session_->http_auth_cache()->UpdateAllFrom(*other_auth_cache); - net::SSLConfig ssl_config; - // Unconditionally get the |ssl_config| regardless of |use_tls|, because - // SSLConfig is used for the proxy even !|use_tls|. - request_context_->ssl_config_service()->GetSSLConfig(&ssl_config); return std::make_unique<ProxyResolvingClientSocket>( - network_session_.get(), common_connect_job_params_.get(), ssl_config, url, - use_tls); + network_session_.get(), common_connect_job_params_.get(), url, use_tls); } } // namespace network
diff --git a/services/network/public/mojom/ssl_config.mojom b/services/network/public/mojom/ssl_config.mojom index 84e56f99..9560ae1 100644 --- a/services/network/public/mojom/ssl_config.mojom +++ b/services/network/public/mojom/ssl_config.mojom
@@ -11,8 +11,8 @@ kTLS13, }; -// This contains the subset of net::SSLConfig members that are managed by the -// net::SSLConfigService. See net::SSLConfig for field descriptions. +// This is a combination of net::SSLContextConfig and +// net::CertVerifier::Config's fields. See those two classes for descriptions. struct SSLConfig { bool rev_checking_enabled = false; bool rev_checking_required_local_anchors = false;
diff --git a/services/network/resource_scheduler/resource_scheduler_unittest.cc b/services/network/resource_scheduler/resource_scheduler_unittest.cc index cabb707..e4bd367 100644 --- a/services/network/resource_scheduler/resource_scheduler_unittest.cc +++ b/services/network/resource_scheduler/resource_scheduler_unittest.cc
@@ -26,7 +26,6 @@ #include "net/base/host_port_pair.h" #include "net/base/load_timing_info.h" #include "net/base/request_priority.h" -#include "net/http/http_server_properties_impl.h" #include "net/nqe/network_quality_estimator_test_util.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" @@ -163,7 +162,6 @@ protected: ResourceSchedulerTest() : field_trial_list_(nullptr) { InitializeScheduler(); - context_.set_http_server_properties(&http_server_properties_); context_.set_network_quality_estimator(&network_quality_estimator_); } @@ -499,7 +497,6 @@ base::test::ScopedTaskEnvironment scoped_task_environment_; std::unique_ptr<ResourceScheduler> scheduler_; - net::HttpServerPropertiesImpl http_server_properties_; net::TestNetworkQualityEstimator network_quality_estimator_; net::TestURLRequestContext context_; ResourceSchedulerParamsManager resource_scheduler_params_manager_; @@ -548,7 +545,7 @@ TEST_F(ResourceSchedulerTest, MaxRequestsPerHostForSpdyWhenNotDelayable) { InitializeScheduler(); - http_server_properties_.SetSupportsSpdy( + context_.http_server_properties()->SetSupportsSpdy( url::SchemeHostPort("https", "spdyhost", 443), true); // Add more than max-per-host low-priority requests. @@ -1042,7 +1039,7 @@ } std::unique_ptr<TestRequest> low1(NewRequest("http://host/low", net::LOWEST)); EXPECT_FALSE(low1->started()); - http_server_properties_.SetSupportsSpdy( + context_.http_server_properties()->SetSupportsSpdy( url::SchemeHostPort("http", "spdyhost1", 8080), true); low1_spdy.reset(); base::RunLoop().RunUntilIdle(); @@ -1054,7 +1051,7 @@ NewRequest("http://spdyhost2:8080/low", net::IDLE)); // Reprioritize a request after we learn the server supports SPDY. EXPECT_TRUE(low2_spdy->started()); - http_server_properties_.SetSupportsSpdy( + context_.http_server_properties()->SetSupportsSpdy( url::SchemeHostPort("http", "spdyhost2", 8080), true); ChangeRequestPriority(low2_spdy.get(), net::LOWEST); base::RunLoop().RunUntilIdle(); @@ -1087,7 +1084,7 @@ } std::unique_ptr<TestRequest> low1(NewRequest("http://host/low", net::LOWEST)); EXPECT_FALSE(low1->started()); - http_server_properties_.SetSupportsSpdy( + context_.http_server_properties()->SetSupportsSpdy( url::SchemeHostPort("http", "spdyhost1", 8080), true); low1_spdy.reset(); base::RunLoop().RunUntilIdle(); @@ -1099,7 +1096,7 @@ NewRequest("http://spdyhost2:8080/low", net::IDLE)); // Reprioritize a request after we learn the server supports SPDY. EXPECT_TRUE(low2_spdy->started()); - http_server_properties_.SetSupportsSpdy( + context_.http_server_properties()->SetSupportsSpdy( url::SchemeHostPort("http", "spdyhost2", 8080), true); ChangeRequestPriority(low2_spdy.get(), net::LOWEST); base::RunLoop().RunUntilIdle(); @@ -1660,7 +1657,7 @@ net::EFFECTIVE_CONNECTION_TYPE_2G); InitializeScheduler(); - http_server_properties_.SetSupportsSpdy( + context_.http_server_properties()->SetSupportsSpdy( url::SchemeHostPort("https", "spdyhost", 443), true); // Should be in sync with resource_scheduler.cc for effective connection type @@ -1700,7 +1697,7 @@ net::EFFECTIVE_CONNECTION_TYPE_4G); InitializeScheduler(); - http_server_properties_.SetSupportsSpdy( + context_.http_server_properties()->SetSupportsSpdy( url::SchemeHostPort("https", "spdyhost", 443), true); // Should be in sync with resource_scheduler.cc for effective connection type
diff --git a/services/network/socket_factory.cc b/services/network/socket_factory.cc index e6c3bf9..b6c6406 100644 --- a/services/network/socket_factory.cc +++ b/services/network/socket_factory.cc
@@ -21,7 +21,6 @@ #include "net/ssl/ssl_config.h" #include "net/ssl/ssl_config_service.h" #include "net/url_request/url_request_context.h" -#include "services/network/ssl_config_type_converter.h" #include "services/network/tls_client_socket.h" #include "services/network/udp_socket.h"
diff --git a/services/network/ssl_config_service_mojo.cc b/services/network/ssl_config_service_mojo.cc index ee2b0ec..5c73907 100644 --- a/services/network/ssl_config_service_mojo.cc +++ b/services/network/ssl_config_service_mojo.cc
@@ -6,7 +6,6 @@ #include "base/strings/string_piece.h" #include "mojo/public/cpp/bindings/type_converter.h" -#include "services/network/cert_verifier_config_type_converter.h" #include "services/network/ssl_config_type_converter.h" namespace network { @@ -41,9 +40,8 @@ initial_config ? initial_config->client_cert_pooling_policy : std::vector<std::string>()) { if (initial_config) { - cert_verifier_config_ = - mojo::ConvertTo<net::CertVerifier::Config>(initial_config->Clone()); - ssl_config_ = mojo::ConvertTo<net::SSLConfig>(std::move(initial_config)); + cert_verifier_config_ = MojoSSLConfigToCertVerifierConfig(initial_config); + ssl_context_config_ = MojoSSLConfigToSSLContextConfig(initial_config); } if (ssl_config_client_request) @@ -70,21 +68,20 @@ client_cert_pooling_policy_ != ssl_config->client_cert_pooling_policy; client_cert_pooling_policy_ = ssl_config->client_cert_pooling_policy; - net::SSLConfig old_config = ssl_config_; - ssl_config_ = mojo::ConvertTo<net::SSLConfig>(ssl_config->Clone()); - ProcessConfigUpdate(old_config, ssl_config_, force_notification); + net::SSLContextConfig old_config = ssl_context_config_; + ssl_context_config_ = MojoSSLConfigToSSLContextConfig(ssl_config); + ProcessConfigUpdate(old_config, ssl_context_config_, force_notification); net::CertVerifier::Config old_cert_verifier_config = cert_verifier_config_; - cert_verifier_config_ = - mojo::ConvertTo<net::CertVerifier::Config>(std::move(ssl_config)); + cert_verifier_config_ = MojoSSLConfigToCertVerifierConfig(ssl_config); cert_verifier_config_.crl_set = old_cert_verifier_config.crl_set; if (cert_verifier_ && (old_cert_verifier_config != cert_verifier_config_)) { cert_verifier_->SetConfig(cert_verifier_config_); } } -void SSLConfigServiceMojo::GetSSLConfig(net::SSLConfig* ssl_config) { - *ssl_config = ssl_config_; +net::SSLContextConfig SSLConfigServiceMojo::GetSSLContextConfig() { + return ssl_context_config_; } bool SSLConfigServiceMojo::CanShareConnectionWithClientCerts(
diff --git a/services/network/ssl_config_service_mojo.h b/services/network/ssl_config_service_mojo.h index a8ab3ca2..2ee0f9e9 100644 --- a/services/network/ssl_config_service_mojo.h +++ b/services/network/ssl_config_service_mojo.h
@@ -8,7 +8,6 @@ #include "base/component_export.h" #include "mojo/public/cpp/bindings/binding.h" #include "net/cert/cert_verifier.h" -#include "net/ssl/ssl_config.h" #include "net/ssl/ssl_config_service.h" #include "services/network/crl_set_distributor.h" #include "services/network/public/mojom/ssl_config.mojom.h" @@ -40,7 +39,7 @@ void OnSSLConfigUpdated(const mojom::SSLConfigPtr ssl_config) override; // net::SSLConfigService implementation: - void GetSSLConfig(net::SSLConfig* ssl_config) override; + net::SSLContextConfig GetSSLContextConfig() override; bool CanShareConnectionWithClientCerts( const std::string& hostname) const override; @@ -50,7 +49,7 @@ private: mojo::Binding<mojom::SSLConfigClient> binding_; - net::SSLConfig ssl_config_; + net::SSLContextConfig ssl_context_config_; net::CertVerifier::Config cert_verifier_config_; net::CertVerifier* cert_verifier_;
diff --git a/services/network/ssl_config_service_mojo_unittest.cc b/services/network/ssl_config_service_mojo_unittest.cc index f8e0686..c1ca72ce 100644 --- a/services/network/ssl_config_service_mojo_unittest.cc +++ b/services/network/ssl_config_service_mojo_unittest.cc
@@ -50,17 +50,19 @@ } // net::SSLConfigService::Observer implementation: - void OnSSLConfigChanged() override { + void OnSSLContextConfigChanged() override { ++observed_changes_; - ssl_config_service_->GetSSLConfig(&ssl_config_during_change_); + ssl_context_config_during_change_ = + ssl_config_service_->GetSSLContextConfig(); if (run_loop_) run_loop_->Quit(); } - // Waits for a SSLConfig change. The first time it's called, waits for the - // first change, if one hasn't been observed already, the second time, waits - // for the second, etc. Must be called once for each change that happens, and - // fails it more than once change happens between calls, or during a call. + // Waits for a SSLContextConfig change. The first time it's called, waits for + // the first change, if one hasn't been observed already, the second time, + // waits for the second, etc. Must be called once for each change that + // happens, and fails if more than once change happens between calls, or + // during a call. void WaitForChange() { EXPECT_FALSE(run_loop_); ++changes_to_wait_for_; @@ -74,8 +76,8 @@ EXPECT_EQ(observed_changes_, changes_to_wait_for_); } - const net::SSLConfig& ssl_config_during_change() const { - return ssl_config_during_change_; + const net::SSLContextConfig& ssl_context_config_during_change() const { + return ssl_context_config_during_change_; } int observed_changes() const { return observed_changes_; } @@ -84,7 +86,7 @@ net::SSLConfigService* const ssl_config_service_; int observed_changes_ = 0; int changes_to_wait_for_ = 0; - net::SSLConfig ssl_config_during_change_; + net::SSLContextConfig ssl_context_config_during_change_; std::unique_ptr<base::RunLoop> run_loop_; }; @@ -162,12 +164,11 @@ std::move(network_context_params)); } - // Returns the current SSLConfig for |network_context_|. - net::SSLConfig GetSSLConfig() { - net::SSLConfig ssl_config; - network_context_->url_request_context()->ssl_config_service()->GetSSLConfig( - &ssl_config); - return ssl_config; + // Returns the current SSLContextConfig for |network_context_|. + net::SSLContextConfig GetSSLContextConfig() { + return network_context_->url_request_context() + ->ssl_config_service() + ->GetSSLContextConfig(); } // Runs two conversion tests for |mojo_config|. Uses it as a initial @@ -176,43 +177,43 @@ // back to |mojo_config|, to make sure it works as a new configuration. The // expected configuration must not be the default configuration. void RunConversionTests(const mojom::SSLConfig& mojo_config, - const net::SSLConfig& expected_net_config) { + const net::SSLContextConfig& expected_net_config) { // The expected configuration must not be the default configuration, or the // change test won't send an event. - EXPECT_FALSE(net::SSLConfigService::SSLConfigsAreEqualForTesting( - net::SSLConfig(), expected_net_config)); + EXPECT_FALSE(net::SSLConfigService::SSLContextConfigsAreEqualForTesting( + net::SSLContextConfig(), expected_net_config)); // Set up |mojo_config| as the initial configuration of a NetworkContext. mojom::NetworkContextParamsPtr network_context_params = mojom::NetworkContextParams::New(); network_context_params->initial_ssl_config = mojo_config.Clone(); SetUpNetworkContext(std::move(network_context_params)); - EXPECT_TRUE(net::SSLConfigService::SSLConfigsAreEqualForTesting( - GetSSLConfig(), expected_net_config)); + EXPECT_TRUE(net::SSLConfigService::SSLContextConfigsAreEqualForTesting( + GetSSLContextConfig(), expected_net_config)); // Sanity check. - EXPECT_FALSE(net::SSLConfigService::SSLConfigsAreEqualForTesting( - GetSSLConfig(), net::SSLConfig())); + EXPECT_FALSE(net::SSLConfigService::SSLContextConfigsAreEqualForTesting( + GetSSLContextConfig(), net::SSLContextConfig())); // Reset the configuration to the default ones, and check the results. TestSSLConfigServiceObserver observer( network_context_->url_request_context()->ssl_config_service()); ssl_config_client_->OnSSLConfigUpdated(mojom::SSLConfig::New()); observer.WaitForChange(); - EXPECT_TRUE(net::SSLConfigService::SSLConfigsAreEqualForTesting( - GetSSLConfig(), net::SSLConfig())); - EXPECT_TRUE(net::SSLConfigService::SSLConfigsAreEqualForTesting( - observer.ssl_config_during_change(), net::SSLConfig())); + EXPECT_TRUE(net::SSLConfigService::SSLContextConfigsAreEqualForTesting( + GetSSLContextConfig(), net::SSLContextConfig())); + EXPECT_TRUE(net::SSLConfigService::SSLContextConfigsAreEqualForTesting( + observer.ssl_context_config_during_change(), net::SSLContextConfig())); // Sanity check. - EXPECT_FALSE(net::SSLConfigService::SSLConfigsAreEqualForTesting( - GetSSLConfig(), expected_net_config)); + EXPECT_FALSE(net::SSLConfigService::SSLContextConfigsAreEqualForTesting( + GetSSLContextConfig(), expected_net_config)); // Set the configuration to |mojo_config| again, and check the results. ssl_config_client_->OnSSLConfigUpdated(mojo_config.Clone()); observer.WaitForChange(); - EXPECT_TRUE(net::SSLConfigService::SSLConfigsAreEqualForTesting( - GetSSLConfig(), expected_net_config)); - EXPECT_TRUE(net::SSLConfigService::SSLConfigsAreEqualForTesting( - observer.ssl_config_during_change(), expected_net_config)); + EXPECT_TRUE(net::SSLConfigService::SSLContextConfigsAreEqualForTesting( + GetSSLContextConfig(), expected_net_config)); + EXPECT_TRUE(net::SSLConfigService::SSLContextConfigsAreEqualForTesting( + observer.ssl_context_config_during_change(), expected_net_config)); } // Runs two conversion tests for |mojo_config|. Uses it as an initial @@ -270,12 +271,12 @@ // net::SSLConfig. TEST_F(NetworkServiceSSLConfigServiceTest, NoSSLConfig) { SetUpNetworkContext(mojom::NetworkContextParams::New()); - EXPECT_TRUE(net::SSLConfigService::SSLConfigsAreEqualForTesting( - GetSSLConfig(), net::SSLConfig())); + EXPECT_TRUE(net::SSLConfigService::SSLContextConfigsAreEqualForTesting( + GetSSLContextConfig(), net::SSLContextConfig())); // Make sure the default TLS version range is as expected. - EXPECT_EQ(net::kDefaultSSLVersionMin, GetSSLConfig().version_min); - EXPECT_EQ(net::kDefaultSSLVersionMax, GetSSLConfig().version_max); + EXPECT_EQ(net::kDefaultSSLVersionMin, GetSSLContextConfig().version_min); + EXPECT_EQ(net::kDefaultSSLVersionMax, GetSSLContextConfig().version_max); } // Check that passing in the default mojom::SSLConfig matches the default @@ -285,12 +286,12 @@ mojom::NetworkContextParams::New(); network_context_params->initial_ssl_config = mojom::SSLConfig::New(); SetUpNetworkContext(std::move(network_context_params)); - EXPECT_TRUE(net::SSLConfigService::SSLConfigsAreEqualForTesting( - GetSSLConfig(), net::SSLConfig())); + EXPECT_TRUE(net::SSLConfigService::SSLContextConfigsAreEqualForTesting( + GetSSLContextConfig(), net::SSLContextConfig())); // Make sure the default TLS version range is as expected. - EXPECT_EQ(net::kDefaultSSLVersionMin, GetSSLConfig().version_min); - EXPECT_EQ(net::kDefaultSSLVersionMax, GetSSLConfig().version_max); + EXPECT_EQ(net::kDefaultSSLVersionMin, GetSSLContextConfig().version_min); + EXPECT_EQ(net::kDefaultSSLVersionMax, GetSSLContextConfig().version_max); } // Check that passing in the default mojom::SSLConfig matches the default @@ -383,12 +384,12 @@ // The defaults will get plenty of testing anyways, when switching back to // the default values in RunConversionTests(). if (kVersionTable[min_index].net_ssl_version == - net::SSLConfig().version_min && + net::SSLContextConfig().version_min && kVersionTable[max_index].net_ssl_version == - net::SSLConfig().version_max) { + net::SSLContextConfig().version_max) { continue; } - net::SSLConfig expected_net_config; + net::SSLContextConfig expected_net_config; expected_net_config.version_min = kVersionTable[min_index].net_ssl_version; expected_net_config.version_max = @@ -404,7 +405,7 @@ } TEST_F(NetworkServiceSSLConfigServiceTest, InitialConfigDisableCipherSuite) { - net::SSLConfig expected_net_config; + net::SSLContextConfig expected_net_config; expected_net_config.disabled_cipher_suites.push_back(0x0004); mojom::SSLConfigPtr mojo_config = mojom::SSLConfig::New(); @@ -416,7 +417,7 @@ TEST_F(NetworkServiceSSLConfigServiceTest, InitialConfigDisableTwoCipherSuites) { - net::SSLConfig expected_net_config; + net::SSLContextConfig expected_net_config; expected_net_config.disabled_cipher_suites.push_back(0x0004); expected_net_config.disabled_cipher_suites.push_back(0x0005);
diff --git a/services/network/ssl_config_type_converter.cc b/services/network/ssl_config_type_converter.cc index bcc4abed..88e2b67 100644 --- a/services/network/ssl_config_type_converter.cc +++ b/services/network/ssl_config_type_converter.cc
@@ -4,6 +4,8 @@ #include "services/network/ssl_config_type_converter.h" +#include "base/logging.h" + namespace mojo { int MojoSSLVersionToNetSSLVersion(network::mojom::SSLVersion mojo_version) { @@ -21,12 +23,9 @@ return net::SSL_PROTOCOL_VERSION_TLS1_3; } -net::SSLConfig -TypeConverter<net::SSLConfig, network::mojom::SSLConfigPtr>::Convert( +net::SSLContextConfig MojoSSLConfigToSSLContextConfig( const network::mojom::SSLConfigPtr& mojo_config) { - DCHECK(mojo_config); - - net::SSLConfig net_config; + net::SSLContextConfig net_config; net_config.version_min = MojoSSLVersionToNetSSLVersion(mojo_config->version_min); @@ -40,4 +39,18 @@ return net_config; } +net::CertVerifier::Config MojoSSLConfigToCertVerifierConfig( + const network::mojom::SSLConfigPtr& mojo_config) { + net::CertVerifier::Config net_config; + net_config.enable_rev_checking = mojo_config->rev_checking_enabled; + net_config.require_rev_checking_local_anchors = + mojo_config->rev_checking_required_local_anchors; + net_config.enable_sha1_local_anchors = + mojo_config->sha1_local_anchors_enabled; + net_config.disable_symantec_enforcement = + mojo_config->symantec_enforcement_disabled; + + return net_config; +} + } // namespace mojo
diff --git a/services/network/ssl_config_type_converter.h b/services/network/ssl_config_type_converter.h index 5632749..7e57794 100644 --- a/services/network/ssl_config_type_converter.h +++ b/services/network/ssl_config_type_converter.h
@@ -5,21 +5,23 @@ #ifndef SERVICES_NETWORK_SSL_CONFIG_TYPE_CONVERTER_H_ #define SERVICES_NETWORK_SSL_CONFIG_TYPE_CONVERTER_H_ -#include "mojo/public/cpp/bindings/type_converter.h" -#include "net/ssl/ssl_config.h" +#include "net/cert/cert_verifier.h" +#include "net/ssl/ssl_config_service.h" #include "services/network/public/mojom/ssl_config.mojom.h" namespace mojo { int MojoSSLVersionToNetSSLVersion(network::mojom::SSLVersion mojo_version); -// Converts a net::SSLConfig to network::mojom::SSLConfigPtr. Tested in +// Converts a net::SSLContextConfig to network::mojom::SSLConfigPtr. Tested in // SSLConfigServiceMojo's unittests. -template <> -struct TypeConverter<net::SSLConfig, network::mojom::SSLConfigPtr> { - static net::SSLConfig Convert( - const network::mojom::SSLConfigPtr& mojo_config); -}; +net::SSLContextConfig MojoSSLConfigToSSLContextConfig( + const network::mojom::SSLConfigPtr& mojo_config); + +// Converts a network::mojom::SSLConfigPtr to a net::CertVerifier::Config. +// Tested in SSLConfigServiceMojo's unittests. +net::CertVerifier::Config MojoSSLConfigToCertVerifierConfig( + const network::mojom::SSLConfigPtr& mojo_config); } // namespace mojo
diff --git a/services/network/tls_socket_factory.cc b/services/network/tls_socket_factory.cc index 89efc4c..aa54f16 100644 --- a/services/network/tls_socket_factory.cc +++ b/services/network/tls_socket_factory.cc
@@ -47,7 +47,8 @@ TLSSocketFactory::TLSSocketFactory( net::URLRequestContext* url_request_context, const net::HttpNetworkSession::Context* http_context) - : ssl_client_context_(url_request_context->cert_verifier(), + : ssl_client_context_(url_request_context->ssl_config_service(), + url_request_context->cert_verifier(), url_request_context->transport_security_state(), url_request_context->cert_transparency_verifier(), url_request_context->ct_policy_enforcer(), @@ -105,15 +106,14 @@ TLSClientSocket* socket_raw = socket.get(); tls_socket_bindings_.AddBinding(std::move(socket), std::move(request)); - net::SSLConfig ssl_config; - ssl_config_service_->GetSSLConfig(&ssl_config); net::SSLClientContext* ssl_client_context = &ssl_client_context_; bool send_ssl_info = false; + net::SSLConfig ssl_config; if (socket_options) { - ssl_config.version_min = + ssl_config.version_min_override = mojo::MojoSSLVersionToNetSSLVersion(socket_options->version_min); - ssl_config.version_max = + ssl_config.version_max_override = mojo::MojoSSLVersionToNetSSLVersion(socket_options->version_max); send_ssl_info = socket_options->send_ssl_info; @@ -129,7 +129,7 @@ std::make_unique<net::DefaultCTPolicyEnforcer>(); no_verification_ssl_client_context_ = std::make_unique<net::SSLClientContext>( - no_verification_cert_verifier_.get(), + ssl_config_service_, no_verification_cert_verifier_.get(), no_verification_transport_security_state_.get(), no_verification_cert_transparency_verifier_.get(), no_verification_ct_policy_enforcer_.get(),
diff --git a/services/service_manager/embedder/main.cc b/services/service_manager/embedder/main.cc index 0d1fa74..e9fd263 100644 --- a/services/service_manager/embedder/main.cc +++ b/services/service_manager/embedder/main.cc
@@ -13,6 +13,7 @@ #include "base/debug/stack_trace.h" #include "base/i18n/icu_util.h" #include "base/logging.h" +#include "base/message_loop/message_pump_type.h" #include "base/optional.h" #include "base/process/launch.h" #include "base/process/memory.h" @@ -176,11 +177,11 @@ NonEmbedderProcessInit(); base::SingleThreadTaskExecutor main_thread_task_executor( - base::MessagePump::Type::UI); + base::MessagePumpType::UI); base::Thread ipc_thread("IPC thread"); ipc_thread.StartWithOptions( - base::Thread::Options(base::MessagePump::Type::IO, 0)); + base::Thread::Options(base::MessagePumpType::IO, 0)); mojo::core::ScopedIPCSupport ipc_support( ipc_thread.task_runner(), mojo::core::ScopedIPCSupport::ShutdownPolicy::FAST); @@ -217,7 +218,7 @@ service_manager::ServiceExecutableEnvironment environment; base::SingleThreadTaskExecutor main_thread_task_executor( - base::MessagePump::Type::UI); + base::MessagePumpType::UI); base::RunLoop run_loop; std::string service_name =
diff --git a/services/service_manager/tests/shutdown/shutdown_client_app.cc b/services/service_manager/tests/shutdown/shutdown_client_app.cc index b5f1670..f18003d5 100644 --- a/services/service_manager/tests/shutdown/shutdown_client_app.cc +++ b/services/service_manager/tests/shutdown/shutdown_client_app.cc
@@ -4,6 +4,7 @@ #include "base/bind.h" #include "base/macros.h" +#include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "mojo/public/cpp/bindings/binding_set.h" #include "services/service_manager/public/cpp/binder_registry.h"
diff --git a/services/tracing/public/cpp/perfetto/track_event_thread_local_event_sink.cc b/services/tracing/public/cpp/perfetto/track_event_thread_local_event_sink.cc index 58dca2e..c5460bb 100644 --- a/services/tracing/public/cpp/perfetto/track_event_thread_local_event_sink.cc +++ b/services/tracing/public/cpp/perfetto/track_event_thread_local_event_sink.cc
@@ -8,8 +8,11 @@ #include "base/strings/pattern.h" #include "base/strings/strcat.h" #include "base/trace_event/common/trace_event_common.h" +#include "base/trace_event/log_message.h" #include "base/trace_event/trace_buffer.h" +#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_log.h" +#include "base/trace_event/traced_value.h" #include "build/build_config.h" #include "services/tracing/public/cpp/perfetto/perfetto_traced_process.h" #include "services/tracing/public/cpp/perfetto/producer_client.h" @@ -18,6 +21,7 @@ #include "third_party/perfetto/protos/perfetto/trace/interned_data/interned_data.pbzero.h" #include "third_party/perfetto/protos/perfetto/trace/trace_packet.pbzero.h" #include "third_party/perfetto/protos/perfetto/trace/track_event/debug_annotation.pbzero.h" +#include "third_party/perfetto/protos/perfetto/trace/track_event/log_message.pbzero.h" #include "third_party/perfetto/protos/perfetto/trace/track_event/process_descriptor.pbzero.h" #include "third_party/perfetto/protos/perfetto/trace/track_event/source_location.pbzero.h" #include "third_party/perfetto/protos/perfetto/trace/track_event/task_execution.pbzero.h" @@ -168,6 +172,7 @@ interned_event_names_(1000, 100), interned_annotation_names_(1000, 100), interned_source_locations_(1000), + interned_log_message_bodies_(100), process_id_(TraceLog::GetInstance()->process_id()), thread_id_(static_cast<int>(base::PlatformThread::CurrentId())), privacy_filtering_enabled_(proto_writer_filtering_enabled) { @@ -238,6 +243,12 @@ InterningIndexEntry interned_annotation_names[kMaxSize] = { InterningIndexEntry{}}; InterningIndexEntry interned_source_location{}; + InterningIndexEntry interned_log_message_body{}; + + const char* src_file = nullptr; + const char* src_func = nullptr; + const char* log_message_body = nullptr; + int line_number = 0; if (copy_strings) { if (!is_java_event && privacy_filtering_enabled_) { @@ -256,25 +267,47 @@ // TODO(eseckler): Remove special handling of typed events here once we // support them in TRACE_EVENT macros. - if (flags & TRACE_EVENT_FLAG_TYPED_PROTO_ARGS) { - DCHECK_EQ(strcmp(category_name, kTaskExecutionEventCategory), 0); - DCHECK(strcmp(trace_event->name(), kTaskExecutionEventNames[0]) == 0 || - strcmp(trace_event->name(), kTaskExecutionEventNames[1]) == 0 || - strcmp(trace_event->name(), kTaskExecutionEventNames[2]) == 0); + if (flags & TRACE_EVENT_FLAG_TYPED_PROTO_ARGS) { if (trace_event->arg_size() == 2u) { + DCHECK_EQ(strcmp(category_name, kTaskExecutionEventCategory), 0); + DCHECK(strcmp(trace_event->name(), kTaskExecutionEventNames[0]) == 0 || + strcmp(trace_event->name(), kTaskExecutionEventNames[1]) == 0 || + strcmp(trace_event->name(), kTaskExecutionEventNames[2]) == 0); + // Double argument task execution event (src_file, src_func). DCHECK_EQ(trace_event->arg_type(0), TRACE_VALUE_TYPE_STRING); DCHECK_EQ(trace_event->arg_type(1), TRACE_VALUE_TYPE_STRING); - interned_source_location = interned_source_locations_.LookupOrAdd( - std::make_pair(trace_event->arg_value(0).as_string, - trace_event->arg_value(1).as_string)); + src_file = trace_event->arg_value(0).as_string; + src_func = trace_event->arg_value(1).as_string; } else { + // arg_size == 1 enforced by the maximum number of parameter == 2. DCHECK_EQ(trace_event->arg_size(), 1u); - DCHECK_EQ(trace_event->arg_type(0), TRACE_VALUE_TYPE_STRING); - interned_source_location = interned_source_locations_.LookupOrAdd( - std::make_pair(trace_event->arg_value(0).as_string, - static_cast<const char*>(nullptr))); - } + + if (trace_event->arg_type(0) == TRACE_VALUE_TYPE_STRING) { + // Single argument task execution event (src_file). + DCHECK_EQ(strcmp(category_name, kTaskExecutionEventCategory), 0); + DCHECK( + strcmp(trace_event->name(), kTaskExecutionEventNames[0]) == 0 || + strcmp(trace_event->name(), kTaskExecutionEventNames[1]) == 0 || + strcmp(trace_event->name(), kTaskExecutionEventNames[2]) == 0); + src_file = trace_event->arg_value(0).as_string; + } else { + DCHECK(trace_event->arg_type(0) == TRACE_VALUE_TYPE_CONVERTABLE); + DCHECK(strcmp(category_name, "log") == 0); + DCHECK(strcmp(trace_event->name(), "LogMessage") == 0); + const base::trace_event::LogMessage* value = + static_cast<base::trace_event::LogMessage*>( + trace_event->arg_value(0).as_convertable); + src_file = value->file(); + line_number = value->line_number(); + log_message_body = value->message().c_str(); + + interned_log_message_body = + interned_log_message_bodies_.LookupOrAdd(log_message_body); + } // else + } // else + interned_source_location = interned_source_locations_.LookupOrAdd( + std::make_tuple(src_file, src_func, line_number)); } else if (!privacy_filtering_enabled_) { for (size_t i = 0; i < trace_event->arg_size() && trace_event->arg_name(i); ++i) { @@ -340,7 +373,11 @@ // TODO(eseckler): Split comma-separated category strings. track_event->add_category_iids(interned_category.id); - if (interned_source_location.id) { + if (interned_log_message_body.id) { + auto* log_message = track_event->set_log_message(); + log_message->set_source_location_iid(interned_source_location.id); + log_message->set_body_iid(interned_log_message_body.id); + } else if (interned_source_location.id) { track_event->set_task_execution()->set_posted_from_iid( interned_source_location.id); } else if (!privacy_filtering_enabled_) { @@ -472,18 +509,31 @@ ? kPrivacyFiltered : trace_event->name()); } + if (interned_log_message_body.id && !interned_log_message_body.was_emitted) { + if (!interned_data) { + interned_data = trace_packet->set_interned_data(); + } + auto* log_message_entry = interned_data->add_log_message_body(); + log_message_entry->set_iid(interned_log_message_body.id); + log_message_entry->set_body(log_message_body); + } if (interned_source_location.id) { if (!interned_source_location.was_emitted) { if (!interned_data) { interned_data = trace_packet->set_interned_data(); } - auto* source_location_entry = interned_data->add_source_locations(); + perfetto::protos::pbzero::SourceLocation* source_location_entry = + interned_data->add_source_locations(); source_location_entry->set_iid(interned_source_location.id); - source_location_entry->set_file_name(trace_event->arg_value(0).as_string); - if (trace_event->arg_size() > 1) { - source_location_entry->set_function_name( - trace_event->arg_value(1).as_string); + source_location_entry->set_file_name(src_file); + + if (src_func) { + source_location_entry->set_function_name(src_func); + } + + if (line_number) { + source_location_entry->set_line_number(line_number); } } } else if (!privacy_filtering_enabled_) { @@ -506,6 +556,7 @@ interned_event_names_.Clear(); interned_annotation_names_.Clear(); interned_source_locations_.Clear(); + interned_log_message_bodies_.Clear(); } } @@ -626,6 +677,7 @@ interned_event_names_.ResetEmittedState(); interned_annotation_names_.ResetEmittedState(); interned_source_locations_.ResetEmittedState(); + interned_log_message_bodies_.ResetEmittedState(); // Emit a new thread descriptor in a separate packet, where we also set // the |incremental_state_cleared| flag.
diff --git a/services/tracing/public/cpp/perfetto/track_event_thread_local_event_sink.h b/services/tracing/public/cpp/perfetto/track_event_thread_local_event_sink.h index 75ce04d..c569967b 100644 --- a/services/tracing/public/cpp/perfetto/track_event_thread_local_event_sink.h +++ b/services/tracing/public/cpp/perfetto/track_event_thread_local_event_sink.h
@@ -72,8 +72,9 @@ InterningIndex<const char*> interned_event_categories_; InterningIndex<const char*, std::string> interned_event_names_; InterningIndex<const char*, std::string> interned_annotation_names_; - InterningIndex<std::pair<const char*, const char*>> + InterningIndex<std::tuple<const char*, const char*, int>> interned_source_locations_; + InterningIndex<const char*> interned_log_message_bodies_; static std::atomic<uint32_t> incremental_state_reset_id_;
diff --git a/skia/config/SkUserConfig.h b/skia/config/SkUserConfig.h index 94e9588a..232a157 100644 --- a/skia/config/SkUserConfig.h +++ b/skia/config/SkUserConfig.h
@@ -215,6 +215,10 @@ #define SK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS #endif +#ifndef SK_SUPPORT_LEGACY_BICUBIC_FILTERING +#define SK_SUPPORT_LEGACY_BICUBIC_FILTERING +#endif + // Max. verb count for paths rendered by the edge-AA tessellating path renderer. #define GR_AA_TESSELLATOR_MAX_VERB_COUNT 100
diff --git a/testing/buildbot/chrome.json b/testing/buildbot/chrome.json index 88492a2d..ac3d9c5 100644 --- a/testing/buildbot/chrome.json +++ b/testing/buildbot/chrome.json
@@ -1353,6 +1353,22 @@ "test": "gpu_unittests" }, { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-14.04", + "pool": "chrome.tests" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { "args": [ "--gtest_filter=-SadTabViewInteractiveUITest.ReloadMultipleSadTabs" ],
diff --git a/testing/buildbot/chromium.android.json b/testing/buildbot/chromium.android.json index 6cde7380..dab08e4 100644 --- a/testing/buildbot/chromium.android.json +++ b/testing/buildbot/chromium.android.json
@@ -2399,6 +2399,50 @@ "--bucket", "chromium-result-details", "--test-name", + "gwp_asan_unittests" + ], + "script": "//build/android/pylib/results/presentation/test_results_presentation.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "device_os": "KTU84P", + "device_os_type": "userdebug", + "device_type": "hammerhead", + "os": "Android" + } + ], + "output_links": [ + { + "link": [ + "https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices" + ], + "merge": { + "args": [ + "--bucket", + "chromium-result-details", + "--test-name", "ipc_tests" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" @@ -5089,6 +5133,51 @@ "--bucket", "chromium-result-details", "--test-name", + "gwp_asan_unittests" + ], + "script": "//build/android/pylib/results/presentation/test_results_presentation.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "device_os": "KTU84Z", + "device_os_type": "userdebug", + "device_type": "flo", + "os": "Android" + } + ], + "expiration": 10800, + "output_links": [ + { + "link": [ + "https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices" + ], + "merge": { + "args": [ + "--bucket", + "chromium-result-details", + "--test-name", "ipc_tests" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" @@ -8091,6 +8180,51 @@ "--bucket", "chromium-result-details", "--test-name", + "gwp_asan_unittests" + ], + "script": "//build/android/pylib/results/presentation/test_results_presentation.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "device_os": "LMY48I", + "device_os_type": "userdebug", + "device_type": "hammerhead", + "os": "Android" + } + ], + "expiration": 10800, + "output_links": [ + { + "link": [ + "https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices" + ], + "merge": { + "args": [ + "--bucket", + "chromium-result-details", + "--test-name", "ipc_tests" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" @@ -10949,6 +11083,51 @@ "--bucket", "chromium-result-details", "--test-name", + "gwp_asan_unittests" + ], + "script": "//build/android/pylib/results/presentation/test_results_presentation.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "device_os": "LMY49B", + "device_os_type": "userdebug", + "device_type": "flo", + "os": "Android" + } + ], + "expiration": 10800, + "output_links": [ + { + "link": [ + "https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices" + ], + "merge": { + "args": [ + "--bucket", + "chromium-result-details", + "--test-name", "ipc_tests" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" @@ -13960,6 +14139,50 @@ "--bucket", "chromium-result-details", "--test-name", + "gwp_asan_unittests" + ], + "script": "//build/android/pylib/results/presentation/test_results_presentation.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "device_os": "MMB29Q", + "device_os_type": "userdebug", + "device_type": "bullhead", + "os": "Android" + } + ], + "output_links": [ + { + "link": [ + "https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices" + ], + "merge": { + "args": [ + "--bucket", + "chromium-result-details", + "--test-name", "ipc_tests" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" @@ -16788,6 +17011,51 @@ "--bucket", "chromium-result-details", "--test-name", + "gwp_asan_unittests" + ], + "script": "//build/android/pylib/results/presentation/test_results_presentation.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "device_os": "MRA58Z", + "device_os_type": "userdebug", + "device_type": "flo", + "os": "Android" + } + ], + "expiration": 10800, + "output_links": [ + { + "link": [ + "https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices" + ], + "merge": { + "args": [ + "--bucket", + "chromium-result-details", + "--test-name", "ipc_tests" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" @@ -21646,6 +21914,50 @@ "--bucket", "chromium-result-details", "--test-name", + "gwp_asan_unittests" + ], + "script": "//build/android/pylib/results/presentation/test_results_presentation.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "device_os": "KTU84P", + "device_os_type": "userdebug", + "device_type": "hammerhead", + "os": "Android" + } + ], + "output_links": [ + { + "link": [ + "https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices" + ], + "merge": { + "args": [ + "--bucket", + "chromium-result-details", + "--test-name", "ipc_tests" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" @@ -24484,6 +24796,50 @@ "--bucket", "chromium-result-details", "--test-name", + "gwp_asan_unittests" + ], + "script": "//build/android/pylib/results/presentation/test_results_presentation.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "device_os": "MMB29Q", + "device_os_type": "userdebug", + "device_type": "bullhead", + "os": "Android" + } + ], + "output_links": [ + { + "link": [ + "https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices" + ], + "merge": { + "args": [ + "--bucket", + "chromium-result-details", + "--test-name", "ipc_tests" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py"
diff --git a/testing/buildbot/chromium.chromiumos.json b/testing/buildbot/chromium.chromiumos.json index fd403b6b..0890624 100644 --- a/testing/buildbot/chromium.chromiumos.json +++ b/testing/buildbot/chromium.chromiumos.json
@@ -1469,6 +1469,21 @@ { "os": "Ubuntu-16.04" } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } ], "shards": 3 }, @@ -2957,6 +2972,21 @@ { "os": "Ubuntu-16.04" } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } ], "shards": 3 },
diff --git a/testing/buildbot/chromium.clang.json b/testing/buildbot/chromium.clang.json index 2654c8b..e14a468 100644 --- a/testing/buildbot/chromium.clang.json +++ b/testing/buildbot/chromium.clang.json
@@ -12,7 +12,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -27,7 +27,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -42,7 +42,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -57,7 +57,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -72,7 +72,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -87,7 +87,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -102,7 +102,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -117,7 +117,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -132,7 +132,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -147,7 +147,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -163,7 +163,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -178,7 +178,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -193,7 +193,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -208,7 +208,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 10 @@ -229,7 +229,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -244,7 +244,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -262,7 +262,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -277,7 +277,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -292,7 +292,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -307,7 +307,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -322,7 +322,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -337,7 +337,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -352,7 +352,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -367,7 +367,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -382,7 +382,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 6 @@ -403,7 +403,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -418,7 +418,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -433,7 +433,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -448,7 +448,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -463,7 +463,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -478,7 +478,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -493,7 +493,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -508,7 +508,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -523,7 +523,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -538,7 +538,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -553,7 +553,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -568,7 +568,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -583,7 +583,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -598,7 +598,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -613,7 +613,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -650,7 +650,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -665,7 +665,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -680,6 +680,21 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { + "os": "Ubuntu-16.04" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { "os": "Ubuntu-14.04" } ] @@ -695,7 +710,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -710,7 +725,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 3 @@ -731,7 +746,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -746,7 +761,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -761,7 +776,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -776,7 +791,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -791,7 +806,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -806,7 +821,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -821,7 +836,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -836,7 +851,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -851,7 +866,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -866,7 +881,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -881,7 +896,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -896,7 +911,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -911,7 +926,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -926,7 +941,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -941,7 +956,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -956,7 +971,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -971,7 +986,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -986,7 +1001,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1001,7 +1016,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1016,7 +1031,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1031,7 +1046,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1046,7 +1061,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1061,7 +1076,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1076,7 +1091,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1091,7 +1106,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1106,7 +1121,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1121,7 +1136,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1136,7 +1151,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1151,7 +1166,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1166,7 +1181,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1181,7 +1196,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1196,7 +1211,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1211,7 +1226,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1226,7 +1241,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1241,7 +1256,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1256,7 +1271,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1271,7 +1286,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1286,7 +1301,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1301,7 +1316,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1316,7 +1331,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1331,7 +1346,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1346,7 +1361,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -2154,6 +2169,22 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-10-15063" + } + ] + }, "test": "headless_browsertests" }, { @@ -3696,6 +3727,22 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-10-15063" + } + ] + }, "test": "headless_unittests" }, { @@ -6170,6 +6217,50 @@ "--bucket", "chromium-result-details", "--test-name", + "gwp_asan_unittests" + ], + "script": "//build/android/pylib/results/presentation/test_results_presentation.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "device_os": "KTU84P", + "device_os_type": "userdebug", + "device_type": "hammerhead", + "os": "Android" + } + ], + "output_links": [ + { + "link": [ + "https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices" + ], + "merge": { + "args": [ + "--bucket", + "chromium-result-details", + "--test-name", "ipc_tests" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" @@ -9205,6 +9296,50 @@ "--bucket", "chromium-result-details", "--test-name", + "gwp_asan_unittests" + ], + "script": "//build/android/pylib/results/presentation/test_results_presentation.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "device_os": "MMB29Q", + "device_os_type": "userdebug", + "device_type": "bullhead", + "os": "Android" + } + ], + "output_links": [ + { + "link": [ + "https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices" + ], + "merge": { + "args": [ + "--bucket", + "chromium-result-details", + "--test-name", "ipc_tests" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" @@ -10448,7 +10583,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10463,7 +10598,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10478,7 +10613,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10493,7 +10628,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10508,7 +10643,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10523,7 +10658,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10538,7 +10673,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10553,7 +10688,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10568,7 +10703,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10583,7 +10718,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10599,7 +10734,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10614,7 +10749,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10629,7 +10764,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10644,7 +10779,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 10 @@ -10665,7 +10800,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10680,7 +10815,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10698,7 +10833,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10713,7 +10848,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10728,7 +10863,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10743,7 +10878,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10758,7 +10893,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10773,7 +10908,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10788,7 +10923,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10803,7 +10938,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10818,7 +10953,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 6 @@ -10839,7 +10974,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10859,7 +10994,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10874,7 +11009,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10889,7 +11024,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10904,7 +11039,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10919,7 +11054,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10934,7 +11069,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10949,7 +11084,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10964,7 +11099,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10979,7 +11114,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -10994,7 +11129,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11009,7 +11144,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11024,7 +11159,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11039,7 +11174,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11054,7 +11189,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11069,7 +11204,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11084,7 +11219,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11099,7 +11234,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11114,7 +11249,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11129,6 +11264,21 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { + "os": "Ubuntu-16.04" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { "os": "Ubuntu-14.04" } ] @@ -11144,7 +11294,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11159,7 +11309,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 3 @@ -11180,7 +11330,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11195,7 +11345,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11210,7 +11360,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11225,7 +11375,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11240,7 +11390,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11255,7 +11405,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11270,7 +11420,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11285,7 +11435,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11300,7 +11450,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11315,7 +11465,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11330,7 +11480,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11345,7 +11495,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11360,7 +11510,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11375,7 +11525,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11390,7 +11540,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11405,7 +11555,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11420,7 +11570,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11435,7 +11585,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11450,7 +11600,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11465,7 +11615,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11480,7 +11630,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11495,7 +11645,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11510,7 +11660,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11525,7 +11675,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11540,7 +11690,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11555,7 +11705,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11570,7 +11720,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11585,7 +11735,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11600,7 +11750,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11615,7 +11765,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11630,7 +11780,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11645,7 +11795,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11660,7 +11810,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11675,7 +11825,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11690,7 +11840,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11705,7 +11855,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11720,7 +11870,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11735,7 +11885,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11750,7 +11900,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11765,7 +11915,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11780,7 +11930,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11795,7 +11945,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11811,7 +11961,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11841,7 +11991,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11859,7 +12009,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11877,7 +12027,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11895,7 +12045,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11913,7 +12063,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11931,7 +12081,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11949,7 +12099,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11967,7 +12117,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -11985,7 +12135,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12003,7 +12153,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12022,7 +12172,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12040,7 +12190,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12058,7 +12208,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12076,7 +12226,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 10 @@ -12098,7 +12248,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12116,7 +12266,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12135,7 +12285,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12153,7 +12303,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12171,7 +12321,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12189,7 +12339,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12207,7 +12357,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12225,7 +12375,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12243,7 +12393,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12261,7 +12411,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12279,7 +12429,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 6 @@ -12301,7 +12451,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12322,7 +12472,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12340,7 +12490,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12358,7 +12508,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12376,7 +12526,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12394,7 +12544,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12412,7 +12562,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12430,7 +12580,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12448,7 +12598,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12466,7 +12616,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12484,7 +12634,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12502,7 +12652,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12520,7 +12670,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12538,7 +12688,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12556,7 +12706,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12574,7 +12724,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12592,7 +12742,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12610,7 +12760,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12628,6 +12778,24 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { + "os": "Ubuntu-16.04" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--test-launcher-print-test-stdio=always" + ], + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { "os": "Ubuntu-14.04" } ] @@ -12646,7 +12814,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12664,7 +12832,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 3 @@ -12686,7 +12854,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12704,7 +12872,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12722,7 +12890,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12740,7 +12908,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12758,7 +12926,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12776,7 +12944,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12794,7 +12962,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12812,7 +12980,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12830,7 +12998,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12848,7 +13016,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12866,7 +13034,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12884,7 +13052,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12902,7 +13070,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12920,7 +13088,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12938,7 +13106,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12956,7 +13124,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -12974,7 +13142,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 16 @@ -12993,7 +13161,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13011,7 +13179,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13029,7 +13197,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13047,7 +13215,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13065,7 +13233,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13083,7 +13251,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13101,7 +13269,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13119,7 +13287,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13137,7 +13305,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13155,7 +13323,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13173,7 +13341,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13191,7 +13359,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13209,7 +13377,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13227,7 +13395,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13245,7 +13413,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13263,7 +13431,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13281,7 +13449,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13299,7 +13467,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 2 @@ -13318,7 +13486,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13336,7 +13504,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13354,7 +13522,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13372,7 +13540,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13390,7 +13558,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13408,7 +13576,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13426,7 +13594,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13445,7 +13613,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13467,7 +13635,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13482,7 +13650,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13497,7 +13665,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13512,7 +13680,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13527,7 +13695,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13542,7 +13710,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13557,7 +13725,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13572,7 +13740,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13587,7 +13755,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13602,7 +13770,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13618,7 +13786,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13633,7 +13801,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13648,7 +13816,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13663,7 +13831,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 10 @@ -13684,7 +13852,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13699,7 +13867,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13717,7 +13885,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13732,7 +13900,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13747,7 +13915,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13762,7 +13930,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13777,7 +13945,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13792,7 +13960,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13807,7 +13975,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13822,7 +13990,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13837,7 +14005,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 6 @@ -13858,7 +14026,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13878,7 +14046,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13893,7 +14061,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13908,7 +14076,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13923,7 +14091,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13938,7 +14106,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13953,7 +14121,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13968,7 +14136,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13983,7 +14151,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -13998,7 +14166,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14013,7 +14181,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14028,7 +14196,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14043,7 +14211,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14058,7 +14226,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14073,7 +14241,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14088,7 +14256,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14103,7 +14271,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14118,7 +14286,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14133,7 +14301,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14148,6 +14316,21 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { + "os": "Ubuntu-16.04" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { "os": "Ubuntu-14.04" } ] @@ -14163,7 +14346,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14178,7 +14361,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 3 @@ -14199,7 +14382,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14214,7 +14397,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14229,7 +14412,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14244,7 +14427,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14259,7 +14442,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14274,7 +14457,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14289,7 +14472,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14304,7 +14487,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14319,7 +14502,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14334,7 +14517,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14349,7 +14532,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14364,7 +14547,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14379,7 +14562,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14394,7 +14577,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14409,7 +14592,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14424,7 +14607,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14439,7 +14622,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14454,7 +14637,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14469,7 +14652,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14484,7 +14667,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14499,7 +14682,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14514,7 +14697,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14529,7 +14712,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14544,7 +14727,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14559,7 +14742,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14574,7 +14757,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14589,7 +14772,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14604,7 +14787,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14619,7 +14802,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14634,7 +14817,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14649,7 +14832,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14664,7 +14847,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14679,7 +14862,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14694,7 +14877,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14709,7 +14892,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14724,7 +14907,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14739,7 +14922,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14754,7 +14937,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14769,7 +14952,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14784,7 +14967,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14799,7 +14982,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14815,7 +14998,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14834,7 +15017,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14849,7 +15032,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14864,7 +15047,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14879,7 +15062,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14894,7 +15077,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14909,7 +15092,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14924,7 +15107,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14939,7 +15122,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14954,7 +15137,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14969,7 +15152,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -14985,7 +15168,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15000,7 +15183,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15015,7 +15198,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15030,7 +15213,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 10 @@ -15051,7 +15234,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15066,7 +15249,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15084,7 +15267,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15099,7 +15282,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15114,7 +15297,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15129,7 +15312,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15144,7 +15327,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15159,7 +15342,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15174,7 +15357,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15189,7 +15372,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15204,7 +15387,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 6 @@ -15225,7 +15408,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15245,7 +15428,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15260,7 +15443,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15275,7 +15458,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15290,7 +15473,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15305,7 +15488,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15320,7 +15503,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15335,7 +15518,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15350,7 +15533,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15365,7 +15548,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15380,7 +15563,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15395,7 +15578,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15410,7 +15593,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15425,7 +15608,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15440,7 +15623,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15455,7 +15638,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15470,7 +15653,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15485,7 +15668,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15500,7 +15683,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15515,6 +15698,21 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { + "os": "Ubuntu-16.04" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { "os": "Ubuntu-14.04" } ] @@ -15530,7 +15728,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15545,7 +15743,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 3 @@ -15566,7 +15764,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15581,7 +15779,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15596,7 +15794,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15611,7 +15809,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15626,7 +15824,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15641,7 +15839,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15656,7 +15854,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15671,7 +15869,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15686,7 +15884,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15701,7 +15899,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15716,7 +15914,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15731,7 +15929,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15746,7 +15944,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15761,7 +15959,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15776,7 +15974,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15791,7 +15989,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15806,7 +16004,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15821,7 +16019,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15836,7 +16034,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15851,7 +16049,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15866,7 +16064,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15881,7 +16079,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15896,7 +16094,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15911,7 +16109,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15926,7 +16124,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15941,7 +16139,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15956,7 +16154,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15971,7 +16169,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -15986,7 +16184,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16001,7 +16199,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16016,7 +16214,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16031,7 +16229,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16046,7 +16244,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16061,7 +16259,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16076,7 +16274,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16091,7 +16289,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16106,7 +16304,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16121,7 +16319,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16136,7 +16334,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16151,7 +16349,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16166,7 +16364,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16181,7 +16379,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16197,7 +16395,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16219,7 +16417,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16234,7 +16432,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16249,7 +16447,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16264,7 +16462,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16279,7 +16477,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16294,7 +16492,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16309,7 +16507,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16324,7 +16522,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16339,7 +16537,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16354,7 +16552,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16370,7 +16568,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16385,7 +16583,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16400,7 +16598,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16420,7 +16618,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16435,7 +16633,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16453,7 +16651,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16468,7 +16666,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16483,7 +16681,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16498,7 +16696,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16513,7 +16711,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16528,7 +16726,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16543,7 +16741,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16558,7 +16756,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16573,7 +16771,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 6 @@ -16594,7 +16792,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16614,7 +16812,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16629,7 +16827,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16644,7 +16842,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16659,7 +16857,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16674,7 +16872,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16689,7 +16887,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16704,7 +16902,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16719,7 +16917,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16734,7 +16932,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16749,7 +16947,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16764,7 +16962,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16779,7 +16977,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16794,7 +16992,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16809,7 +17007,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16824,7 +17022,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16839,7 +17037,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16854,7 +17052,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16869,6 +17067,21 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { + "os": "Ubuntu-16.04" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { "os": "Ubuntu-14.04" } ] @@ -16884,7 +17097,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16899,7 +17112,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 6 @@ -16920,7 +17133,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16935,7 +17148,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16950,7 +17163,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16965,7 +17178,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16980,7 +17193,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -16995,7 +17208,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17010,7 +17223,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17025,7 +17238,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17040,7 +17253,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17055,7 +17268,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17070,7 +17283,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17085,7 +17298,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17100,7 +17313,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17115,7 +17328,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17130,7 +17343,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17145,7 +17358,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17160,7 +17373,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 4 @@ -17176,7 +17389,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17191,7 +17404,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17206,7 +17419,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17221,7 +17434,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17236,7 +17449,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17251,7 +17464,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17266,7 +17479,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17281,7 +17494,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17296,7 +17509,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17311,7 +17524,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17326,7 +17539,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17341,7 +17554,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17356,7 +17569,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17371,7 +17584,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 6 @@ -17387,7 +17600,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17402,7 +17615,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17417,7 +17630,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17432,7 +17645,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17447,7 +17660,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17462,7 +17675,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17477,7 +17690,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17492,7 +17705,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17507,7 +17720,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17522,7 +17735,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17537,7 +17750,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17553,7 +17766,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17572,7 +17785,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17587,7 +17800,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17602,7 +17815,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17617,7 +17830,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17632,7 +17845,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17647,7 +17860,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17662,7 +17875,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17677,7 +17890,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17692,7 +17905,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17707,7 +17920,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17723,7 +17936,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17738,7 +17951,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17753,7 +17966,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17768,7 +17981,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 10 @@ -17789,7 +18002,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17804,7 +18017,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17822,7 +18035,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17837,7 +18050,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17852,7 +18065,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17867,7 +18080,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17882,7 +18095,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17897,7 +18110,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17912,7 +18125,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17927,7 +18140,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17942,7 +18155,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 6 @@ -17963,7 +18176,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17983,7 +18196,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -17998,7 +18211,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18013,7 +18226,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18028,7 +18241,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18043,7 +18256,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18058,7 +18271,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18073,7 +18286,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18088,7 +18301,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18103,7 +18316,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18118,7 +18331,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18133,7 +18346,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18148,7 +18361,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18163,7 +18376,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18178,7 +18391,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18193,7 +18406,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18208,7 +18421,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18223,7 +18436,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18238,7 +18451,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18253,6 +18466,21 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { + "os": "Ubuntu-16.04" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { "os": "Ubuntu-14.04" } ] @@ -18268,7 +18496,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18283,7 +18511,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 3 @@ -18304,7 +18532,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18319,7 +18547,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18334,7 +18562,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18349,7 +18577,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18364,7 +18592,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18379,7 +18607,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18394,7 +18622,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18409,7 +18637,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18424,7 +18652,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18439,7 +18667,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18454,7 +18682,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18469,7 +18697,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18484,7 +18712,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18499,7 +18727,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18514,7 +18742,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18529,7 +18757,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18544,7 +18772,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18559,7 +18787,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18574,7 +18802,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18589,7 +18817,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18604,7 +18832,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18619,7 +18847,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18634,7 +18862,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18649,7 +18877,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18664,7 +18892,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18679,7 +18907,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18694,7 +18922,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18709,7 +18937,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18724,7 +18952,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18739,7 +18967,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18754,7 +18982,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18769,7 +18997,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18784,7 +19012,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18799,7 +19027,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18814,7 +19042,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18829,7 +19057,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18844,7 +19072,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18859,7 +19087,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18874,7 +19102,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18889,7 +19117,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18904,7 +19132,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18919,7 +19147,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18935,7 +19163,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18957,7 +19185,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18972,7 +19200,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -18987,7 +19215,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19002,7 +19230,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19017,7 +19245,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19032,7 +19260,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19047,7 +19275,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19062,7 +19290,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19077,7 +19305,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19092,7 +19320,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19108,7 +19336,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19123,7 +19351,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19138,7 +19366,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19153,7 +19381,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 10 @@ -19174,7 +19402,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19189,7 +19417,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19207,7 +19435,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19222,7 +19450,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19237,7 +19465,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19252,7 +19480,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19267,7 +19495,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19282,7 +19510,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19297,7 +19525,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19312,7 +19540,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19327,7 +19555,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 6 @@ -19348,7 +19576,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19368,7 +19596,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19383,7 +19611,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19398,7 +19626,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19413,7 +19641,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19428,7 +19656,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19443,7 +19671,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19458,7 +19686,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19473,7 +19701,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19488,7 +19716,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19503,7 +19731,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19518,7 +19746,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19533,7 +19761,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19548,7 +19776,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19563,7 +19791,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19578,7 +19806,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19593,7 +19821,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19608,7 +19836,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19623,7 +19851,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19638,6 +19866,21 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { + "os": "Ubuntu-16.04" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { "os": "Ubuntu-14.04" } ] @@ -19653,7 +19896,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19668,7 +19911,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 3 @@ -19689,7 +19932,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19704,7 +19947,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19719,7 +19962,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19734,7 +19977,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19749,7 +19992,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19764,7 +20007,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19779,7 +20022,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19794,7 +20037,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19809,7 +20052,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19824,7 +20067,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19839,7 +20082,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19854,7 +20097,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19869,7 +20112,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19884,7 +20127,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19899,7 +20142,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19914,7 +20157,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19929,7 +20172,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19944,7 +20187,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19959,7 +20202,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19974,7 +20217,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -19989,7 +20232,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20004,7 +20247,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20019,7 +20262,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20034,7 +20277,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20049,7 +20292,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20064,7 +20307,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20079,7 +20322,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20094,7 +20337,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20109,7 +20352,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20124,7 +20367,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20139,7 +20382,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20154,7 +20397,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20169,7 +20412,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20184,7 +20427,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20199,7 +20442,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20214,7 +20457,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20229,7 +20472,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20244,7 +20487,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20259,7 +20502,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20274,7 +20517,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20289,7 +20532,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20304,7 +20547,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20320,7 +20563,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -20758,6 +21001,16 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "headless_browsertests" }, { @@ -21878,6 +22131,19 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--test-launcher-print-test-stdio=always" + ], + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "headless_browsertests" }, { @@ -22793,6 +23059,16 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "headless_browsertests" }, { @@ -23874,6 +24150,16 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "headless_browsertests" }, { @@ -24895,6 +25181,16 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "headless_browsertests" }, { @@ -25916,6 +26212,16 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "headless_browsertests" }, { @@ -27231,6 +27537,22 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-10-15063" + } + ] + }, "test": "headless_browsertests" }, { @@ -28828,6 +29150,22 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-10-15063" + } + ] + }, "test": "headless_browsertests" }, { @@ -30425,6 +30763,22 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-10-15063" + } + ] + }, "test": "headless_browsertests" }, { @@ -31728,6 +32082,16 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "headless_browsertests" }, { @@ -32749,6 +33113,16 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "headless_browsertests" }, { @@ -33770,6 +34144,16 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "headless_browsertests" }, { @@ -34791,6 +35175,16 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "headless_browsertests" }, { @@ -35812,6 +36206,16 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "headless_browsertests" }, { @@ -37023,6 +37427,21 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ] + }, "test": "headless_browsertests" }, { @@ -38429,6 +38848,21 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Windows-10" + } + ] + }, "test": "headless_browsertests" }, {
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index 0163135..2967037 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -901,7 +901,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 15 @@ -921,7 +921,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 15 @@ -941,7 +941,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 15 @@ -961,7 +961,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -981,7 +981,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 2 @@ -1001,7 +1001,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 2 @@ -1021,7 +1021,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ] }, @@ -1048,7 +1048,7 @@ "can_use_on_swarming_builders": true, "dimension_sets": [ { - "os": "Ubuntu-14.04" + "os": "Ubuntu-16.04" } ], "shards": 12 @@ -1923,6 +1923,16 @@ "swarming": { "can_use_on_swarming_builders": false }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": false + }, "test": "headless_browsertests" }, { @@ -4383,6 +4393,51 @@ "--bucket", "chromium-result-details", "--test-name", + "gwp_asan_unittests" + ], + "script": "//build/android/pylib/results/presentation/test_results_presentation.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "device_os": "MMB29Q", + "device_os_type": "userdebug", + "device_type": "bullhead", + "os": "Android" + } + ], + "output_links": [ + { + "link": [ + "https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices" + ], + "isolate_coverage_data": true, + "merge": { + "args": [ + "--bucket", + "chromium-result-details", + "--test-name", "ipc_tests" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" @@ -8617,6 +8672,21 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ] + }, "test": "ipc_tests" }, { @@ -9370,6 +9440,24 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--enable-blink-features=HeapConcurrentMarking" + ], + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ] + }, "test": "ipc_tests" }, { @@ -10181,6 +10269,24 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--enable-blink-features=HeapUnifiedGarbageCollection" + ], + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ] + }, "test": "ipc_tests" }, { @@ -10924,6 +11030,21 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ] + }, "test": "ipc_tests" }, { @@ -12115,6 +12236,22 @@ { "os": "Ubuntu-16.04" } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "isolate_coverage_data": true, + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } ], "shards": 3 }, @@ -13714,6 +13851,22 @@ { "os": "Ubuntu-16.04" } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "isolate_coverage_data": true, + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } ], "shards": 3 }, @@ -15189,6 +15342,21 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-14.04" + } + ] + }, "test": "headless_browsertests" }, { @@ -16959,6 +17127,22 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "isolate_coverage_data": true, + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-14.04" + } + ] + }, "test": "headless_browsertests" }, { @@ -22574,6 +22758,23 @@ ], "expiration": 21600 }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:0a2e", + "os": "Mac-10.15" + } + ], + "expiration": 21600 + }, "test": "headless_browsertests" }, {
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json index e0f1e306..24e1a8e 100644 --- a/testing/buildbot/chromium.linux.json +++ b/testing/buildbot/chromium.linux.json
@@ -469,6 +469,21 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ] + }, "test": "ipc_tests" }, { @@ -1271,6 +1286,21 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ] + }, "test": "ipc_tests" }, { @@ -2919,6 +2949,22 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "isolate_coverage_data": true, + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ] + }, "test": "headless_browsertests" }, { @@ -4745,6 +4791,21 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-14.04" + } + ] + }, "test": "headless_browsertests" }, { @@ -6409,6 +6470,22 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "isolate_coverage_data": true, + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ] + }, "test": "headless_browsertests" }, { @@ -8294,6 +8371,21 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-14.04" + } + ] + }, "test": "headless_browsertests" }, {
diff --git a/testing/buildbot/chromium.mac.json b/testing/buildbot/chromium.mac.json index f60f24b..cd59b067 100644 --- a/testing/buildbot/chromium.mac.json +++ b/testing/buildbot/chromium.mac.json
@@ -687,6 +687,22 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "none", + "os": "Mac-10.10" + } + ] + }, "test": "headless_browsertests" }, { @@ -2208,6 +2224,22 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "none", + "os": "Mac-10.11" + } + ] + }, "test": "headless_browsertests" }, { @@ -3729,6 +3761,22 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "8086:0a2e", + "os": "Mac-10.12.6" + } + ] + }, "test": "headless_browsertests" }, { @@ -5295,6 +5343,22 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "none", + "os": "Mac-10.13.6" + } + ] + }, "test": "headless_browsertests" }, { @@ -6851,6 +6915,22 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "none", + "os": "Mac-10.13.6" + } + ] + }, "test": "headless_browsertests" }, { @@ -8376,6 +8456,22 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "gpu": "none", + "os": "Mac-10.13.6" + } + ] + }, "test": "headless_browsertests" }, {
diff --git a/testing/buildbot/chromium.memory.json b/testing/buildbot/chromium.memory.json index 9aa3ec6..229c469 100644 --- a/testing/buildbot/chromium.memory.json +++ b/testing/buildbot/chromium.memory.json
@@ -1755,6 +1755,50 @@ "--bucket", "chromium-result-details", "--test-name", + "gwp_asan_unittests" + ], + "script": "//build/android/pylib/results/presentation/test_results_presentation.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "device_os": "MMB29Q", + "device_os_type": "userdebug", + "device_type": "bullhead", + "os": "Android" + } + ], + "output_links": [ + { + "link": [ + "https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices" + ], + "merge": { + "args": [ + "--bucket", + "chromium-result-details", + "--test-name", "ipc_tests" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" @@ -3811,6 +3855,24 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--test-launcher-print-test-stdio=always" + ], + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ] + }, "test": "headless_browsertests" }, { @@ -5397,6 +5459,21 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ] + }, "test": "headless_browsertests" }, { @@ -6966,6 +7043,24 @@ { "os": "Ubuntu-16.04" } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--test-launcher-print-test-stdio=always" + ], + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } ], "shards": 3 }, @@ -8774,6 +8869,25 @@ "cpu": "x86-64", "os": "Ubuntu-16.04" } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--test-launcher-print-test-stdio=always" + ], + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-16.04" + } ], "shards": 5 }, @@ -10527,6 +10641,25 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--test-launcher-print-test-stdio=always" + ], + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Ubuntu-16.04" + } + ] + }, "test": "headless_browsertests" }, { @@ -12158,6 +12291,24 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--test-launcher-print-test-stdio=always" + ], + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ] + }, "test": "headless_browsertests" }, { @@ -13470,6 +13621,19 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--test-launcher-print-test-stdio=always" + ], + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "headless_browsertests" }, { @@ -15442,6 +15606,50 @@ "--bucket", "chromium-result-details", "--test-name", + "gwp_asan_unittests" + ], + "script": "//build/android/pylib/results/presentation/test_results_presentation.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "device_os": "KTU84P", + "device_os_type": "userdebug", + "device_type": "hammerhead", + "os": "Android" + } + ], + "output_links": [ + { + "link": [ + "https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices" + ], + "merge": { + "args": [ + "--bucket", + "chromium-result-details", + "--test-name", "ipc_tests" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py" @@ -17335,6 +17543,21 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Windows-10-15063" + } + ] + }, "test": "headless_browsertests" }, {
diff --git a/testing/buildbot/chromium.win.json b/testing/buildbot/chromium.win.json index f6fc2cd6..110915b 100644 --- a/testing/buildbot/chromium.win.json +++ b/testing/buildbot/chromium.win.json
@@ -523,6 +523,16 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "headless_browsertests" }, { @@ -2039,6 +2049,22 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-10-15063" + } + ] + }, "test": "headless_browsertests" }, { @@ -3832,6 +3858,22 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "cpu": "x86-64", + "os": "Windows-10-15063" + } + ] + }, "test": "headless_browsertests" }, { @@ -5446,6 +5488,16 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "headless_browsertests" }, { @@ -6675,6 +6727,16 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "gwp_asan_unittests" + }, + { + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "headless_browsertests" }, {
diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl index ecab2809..e9c158c 100644 --- a/testing/buildbot/gn_isolate_map.pyl +++ b/testing/buildbot/gn_isolate_map.pyl
@@ -1181,6 +1181,10 @@ "label": "//url:gurl_fuzzer", "type": "fuzzer", }, + "gwp_asan_unittests": { + "label": "//components/gwp_asan:gwp_asan_unittests", + "type": "console_test_launcher", + }, "h264_bitstream_parser_fuzzer": { "label": "//third_party/webrtc/test/fuzzers:h264_bitstream_parser_fuzzer", "type": "fuzzer",
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index 064b75b..7ae1e25 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -2191,6 +2191,7 @@ 'gin_unittests': {}, 'google_apis_unittests': {}, 'gpu_unittests': {}, + 'gwp_asan_unittests': {}, 'ipc_tests': {}, 'libjingle_xmpp_unittests': {}, 'jingle_unittests': {},
diff --git a/testing/buildbot/tryserver.chromium.android.json b/testing/buildbot/tryserver.chromium.android.json index 5cb4004a..d5393a1 100644 --- a/testing/buildbot/tryserver.chromium.android.json +++ b/testing/buildbot/tryserver.chromium.android.json
@@ -1558,6 +1558,51 @@ "--bucket", "chromium-result-details", "--test-name", + "gwp_asan_unittests" + ], + "script": "//build/android/pylib/results/presentation/test_results_presentation.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "cipd_packages": [ + { + "cipd_package": "infra/tools/luci/logdog/butler/${platform}", + "location": "bin", + "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" + } + ], + "dimension_sets": [ + { + "device_os": "KTU84P", + "device_os_type": "userdebug", + "device_type": "hammerhead", + "os": "Android" + } + ], + "output_links": [ + { + "link": [ + "https://luci-logdog.appspot.com/v/?s", + "=android%2Fswarming%2Flogcats%2F", + "${TASK_ID}%2F%2B%2Funified_logcats" + ], + "name": "shard #${SHARD_INDEX} logcats" + } + ] + }, + "test": "gwp_asan_unittests" + }, + { + "args": [ + "--gs-results-bucket=chromium-result-details", + "--recover-devices" + ], + "isolate_coverage_data": true, + "merge": { + "args": [ + "--bucket", + "chromium-result-details", + "--test-name", "ipc_tests" ], "script": "//build/android/pylib/results/presentation/test_results_presentation.py"
diff --git a/testing/buildbot/tryserver.chromium.linux.json b/testing/buildbot/tryserver.chromium.linux.json index 7c447629..6e065f1 100644 --- a/testing/buildbot/tryserver.chromium.linux.json +++ b/testing/buildbot/tryserver.chromium.linux.json
@@ -721,6 +721,22 @@ } ] }, + "test": "gwp_asan_unittests" + }, + { + "isolate_coverage_data": true, + "merge": { + "args": [], + "script": "//testing/merge_scripts/standard_gtest_merge.py" + }, + "swarming": { + "can_use_on_swarming_builders": true, + "dimension_sets": [ + { + "os": "Ubuntu-16.04" + } + ] + }, "test": "headless_browsertests" }, {
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index 5a12b065..b0a9473 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -711,7 +711,7 @@ 'machines': { 'CFI Linux ToT': { 'mixins': [ - 'linux-trusty', + 'linux-xenial', ], 'test_suites': { 'gtest_tests': 'chromium_linux_and_gl_gtests', @@ -807,7 +807,7 @@ }, 'ToTLinux': { 'mixins': [ - 'linux-trusty', + 'linux-xenial', ], 'test_suites': { 'gtest_tests': 'chromium_linux_gtests', @@ -820,7 +820,7 @@ }, 'ToTLinuxASan': { 'mixins': [ - 'linux-trusty', + 'linux-xenial', ], 'additional_compile_targets': [ 'all', @@ -834,7 +834,7 @@ }, 'ToTLinuxMSan': { 'mixins': [ - 'linux-trusty', + 'linux-xenial', ], 'additional_compile_targets': [ 'all', @@ -846,7 +846,7 @@ # Used on an internal builder. 'ToTLinuxOfficial': { 'mixins': [ - 'linux-trusty', + 'linux-xenial', ], 'test_suites': { 'gtest_tests': 'chromium_linux_gtests', @@ -854,7 +854,7 @@ }, 'ToTLinuxTSan': { 'mixins': [ - 'linux-trusty', + 'linux-xenial', ], 'additional_compile_targets': [ 'all', @@ -865,7 +865,7 @@ }, 'ToTLinuxThinLTO': { 'mixins': [ - 'linux-trusty', + 'linux-xenial', ], 'test_suites': { 'gtest_tests': 'chromium_linux_gtests', @@ -873,7 +873,7 @@ }, 'ToTLinuxUBSanVptr': { 'mixins': [ - 'linux-trusty', + 'linux-xenial', ], 'additional_compile_targets': [ 'all', @@ -1403,7 +1403,7 @@ }, 'Mojo Linux': { 'mixins': [ - 'linux-trusty', + 'linux-xenial', ], 'test_suites': { 'gtest_tests': 'mojo_linux_gtests',
diff --git a/testing/libfuzzer/README.md b/testing/libfuzzer/README.md index a93060d..86be8786 100644 --- a/testing/libfuzzer/README.md +++ b/testing/libfuzzer/README.md
@@ -24,12 +24,15 @@ ## Advanced Topics -* Improving fuzz target effectiveness: [Efficient Fuzzer Guide]. +* Improving fuzz target effectiveness: [Efficient Fuzzing Guide]. * Creating a fuzz target that expects a protobuf (instead of a byte steam) as input: [Guide to libprotobuf-mutator (LPM)]. - **Note**: you can also use LPM to fuzz code that needs multiple mutated + *** note + **Note:** you can also use LPM to fuzz code that needs multiple mutated inputs, or to generate inputs defined by a grammar. + *** + * Reproducing bugs found by libFuzzer/AFL and reported by ClusterFuzz: [Reproducing Bugs]. @@ -60,7 +63,7 @@ [ClusterFuzz]: https://clusterfuzz.com/ [ClusterFuzz Bugs]: https://bugs.chromium.org/p/chromium/issues/list?sort=-modified&colspec=ID%20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified&q=label%3AStability-LibFuzzer%2CStability-AFL%20label%3AClusterFuzz%20-status%3AWontFix%2CDuplicate&can=1 [ClusterFuzz Stats]: https://clusterfuzz.com/fuzzer-stats/by-fuzzer/fuzzer/libFuzzer/job/libfuzzer_chrome_asan -[Efficient Fuzzer Guide]: efficient_fuzzer.md +[Efficient Fuzzing Guide]: efficient_fuzzing.md [Fuzzing]: https://en.wikipedia.org/wiki/Fuzzing [Fuzzing on Chrome OS]: https://chromium.googlesource.com/chromiumos/docs/+/master/fuzzing.md [Getting Started Guide]: getting_started.md
diff --git a/testing/libfuzzer/efficient_fuzzer.md b/testing/libfuzzer/efficient_fuzzer.md deleted file mode 100644 index 09af434b9..0000000 --- a/testing/libfuzzer/efficient_fuzzer.md +++ /dev/null
@@ -1,303 +0,0 @@ -# Efficient Fuzzer Guide - -This document describes ways to determine efficiency of a fuzz target and ways -to improve it. - -## Overview - -Being a coverage-driven fuzzing engine, libFuzzer considers a certain input -*interesting* if it results in new code coverage, i.e. it reaches a code that -has not been reached before. The set of all interesting inputs is called -*corpus*. - -Items in corpus are constantly mutated in search of new interesting inputs. -Corpus can be shared across fuzzer runs and grows over time as new code is -reached. - -There are several metrics you should look at to determine effectiveness of your -fuzz target: - -* [Execution Speed](#Execution-Speed) -* [Code Coverage](#Code-Coverage) -* [Corpus Size](#Corpus-Size) - -You can collect these metrics manually or take them from [ClusterFuzz status] -pages after a fuzz target is checked in Chromium repository. - -The following things are extremely useful for improving fuzzing efficiency, so -we *strongly recommend* them for any fuzz target: - -* [Seed Corpus](#Seed-Corpus) -* [Fuzzer Dictionary](#Fuzzer-Dictionary) - -There are other ways that are useful in some cases, but not always applicable: -* [Custom Options](#Custom-Options) -* [Custom Build](#Custom-Build) - -## Execution Speed - -Fuzz target speed is calculated in executions per second. It is printed while a -fuzz target is running: - -``` -#19346 NEW cov: 2815 bits: 1082 indir: 43 units: 150 exec/s: 19346 L: 62 -``` - -Because libFuzzer performs randomized mutations, it is critical to have it run -as fast as possible to navigate through the large search space efficiently and -find interesting code paths. You should try to get to at least 1,000 exec/s from -your fuzz target locally before submitting it to the Chromium repository. - -### Initialization/Cleanup - -Try to keep `LLVMFuzzerTestOneInput` function as simple as possible. If your -fuzzing function is too complex, it can bring down fuzzer execution speed OR it -can target very specific usecases and fail to account for unexpected scenarios. - -Prefer to use static initialization and shared resources rather than performing -setup and teardown on every single input. Checkout example on -[startup initialization] in libFuzzer documentation. - -You can skip freeing static resources. However, all resources allocated within -`LLVMFuzzerTestOneInput` function should be de-allocated since this function is -called millions of times during a fuzzing session. Otherwise, we will hit OOMs -frequently and reduce overall fuzzing efficiency. - -### Memory Usage - -Avoid allocation of dynamic memory wherever possible. Memory instrumentation -works faster for stack-based and static objects, than for heap allocated ones. - -It is always a good idea to try different variants for your fuzz target locally, -and then submit the fastest implementation. - -## Code Coverage - -[Chrome libFuzzer coverage] provides a source-level coverage report for fuzz -targets from recent runs. Looking at the report might provide insight on how to -improve code coverage of a fuzz target. - -You can also generate source-level coverage report locally on your particular -fuzzer by running the [coverage script] stored in Chromium repository. The -script provides detailed instructions as well as a usage example. - -Note that code coverage of a fuzz target **depends heavily** on the corpus -provided when running the target, i.e. code coverage report generated by a fuzz -target launched without any corpus would not make much sense. To download the -corpus from ClusterFuzz, see [ClusterFuzz Corpus]. - -## Corpus Size - -After running for a while, a fuzz target would reach a plateau and may stop -discovering new interesting inputs. Corpus for a reasonably complex target -should contain hundreds (if not thousands) of items. - -Too small of a corpus size may indicate that fuzz target is hitting a code -barrier and is unable to get past it. Common cases of such issues include: -checksums, magic numbers, etc. However, it also could mean that it is impossible -for your fuzzer to reach a lot of code. The easiest way to diagnose this problem -is to generate and analyze a [coverage report](#Code-Coverage). To fix the -issue, you can: - -* Change the code (e.g. disable crc checks while fuzzing), see - [Custom Build](#Custom-Build). -* Prepare or improve [seed corpus](#Seed-Corpus). -* Prepare or improve [fuzzer dictionary](#Fuzzer-Dictionary). -* Add [custom options](#Custom-Options). - -## Seed Corpus - -Seed corpus is a set of *valid* and *interesting* inputs that serve as starting -points for a fuzz target. If one is not provided, a fuzzing engine would have to -guess these inputs from scratch, which can take an indefinite amount of time -depending on size of the inputs and complexity of the target format. - -Seed corpus works especially well for strictly defined file formats and data -transmission protocols. - -* For file format parsers, add valid files from your test suite. -* For protocol parsers, add valid raw streams from test suite into separate - files. - -Other examples include a graphics library seed corpus, which would be a variety -of small PNG/JPG/GIF files. - -If you are running a fuzz target locally, you can pass a corpus directory as an -argument: - -``` -./out/libfuzzer/my_fuzzer ~/tmp/my_fuzzer_corpus -``` - -The fuzzer would store all the interesting inputs it finds in that directory. - -While libFuzzer can start with an empty corpus, seed corpus is always useful and -in many cases is able to increase code coverage by an order of magnitude. - -ClusterFuzz uses seed corpus defined in Chromium source repository. You need to -add a `seed_corpus` attribute to your `fuzzer_test` definition in BUILD.gn file: - -``` -fuzzer_test("my_fuzzer") { - ... - seed_corpus = "test/fuzz/testcases" - ... -} -``` - -You may specify multiple seed corpus directories via `seed_corpuses` attribute: - -``` -fuzzer_test("my_fuzzer") { - ... - seed_corpuses = [ "test/fuzz/testcases", "test/unittest/data" ] - ... -} -``` - -All files found in these directories and their subdirectories will be archived -into a `<my_fuzzer>_seed_corpus.zip` output archive. - -If you can't store seed corpus in Chromium repository (e.g. it is too large, -cannot be open sourced, etc), you can upload the corpus to Google Cloud Storage -bucket used by ClusterFuzz: - -1) Go to [Corpus GCS Bucket]. -2) Open directory named `<my_fuzzer>`. If the directory does not exist, -please create it. -3) Upload corpus files into the directory. - -Alternative and faster way is to use [gsutil] command line tool: -```bash -gsutil -m rsync <path_to_corpus> gs://clusterfuzz-corpus/libfuzzer/<my_fuzzer> -``` - -*** note -**Requirements:** You must have an @google.com and you must be logged into that -account to write to this bucket (@chromium.org will not work). You can use the -`gcloud auth login` command to log into your account in `gsutil` if you -installed `gsutil` through `gcloud`. -*** -Note that if you upload the corpus to GCS, the `seed_corpus` attribute is not -needed in your `fuzzer_test` definition. - -### Corpus Minimization - -It's important to minimize seed corpus to a *small set of interesting inputs* -before uploading. The reason being that seed corpus is synced to all fuzzing -bots for every iteration, so it is important to keep it small both for fuzzing -efficiency and to prevent our bots from running out of disk space. - -The minimization can be done using `-merge=1` option of libFuzzer: - -```bash -# Create an empty directory. -mkdir seed_corpus_minimized - -# Run the fuzzer with -merge=1 flag. -./my_fuzzer -merge=1 ./seed_corpus_minimized ./seed_corpus -``` - -After running the command above, `seed_corpus_minimized` directory will contain -a minimized corpus that gives the same code coverage as the initial -`seed_corpus` directory. - -## Fuzzer Dictionary - -It is very useful to provide fuzz target with a set of *common words or values* -that you expect to find in the input. Adding a dictionary highly improves the -efficiency of finding new units and works especially well in certain usecases -(e.g. fuzzing file format decoders or text based protocols like XML). - -To add a dictionary, first create a dictionary file. This is a flat *ascii* text -file where tokens are listed one per line in the format of `name="value"`, where -`name` is optional and can be omitted, although it is a convenient way to -document the meaning of a particular token. The value must appear in quotes, -with hex escaping (\xNN) applied to all non-printable, high-bit, or otherwise -problematic characters (\\ and \" shorthands are recognized too). This syntax is -similar to the one used by [AFL] fuzzing engine (-x option). - -An example dictionary looks like: - -``` -# Lines starting with '#' and empty lines are ignored. - -# Adds "blah" word (w/o quotes) to the dictionary. -kw1="blah" -# Use \\ for backslash and \" for quotes. -kw2="\"ac\\dc\"" -# Use \xAB for hex values. -kw3="\xF7\xF8" -# Key name before '=' can be omitted: -"foo\x0Abar" -``` - -Make sure to test your dictionary by running your fuzz target locally: - -```bash -./out/libfuzzer/my_fuzzer -dict=<path_to_dict> <path_to_corpus> -``` - -If the dictionary is effective, you should see new units discovered in the -output. - -To submit a dictionary to Chromium repository: - -1) Add the dictionary file in the same directory as your fuzz target -2) Add `dict` attribute to `fuzzer_test` definition in BUILD.gn file: - -``` -fuzzer_test("my_fuzzer") { - ... - dict = "my_fuzzer.dict" -} -``` - -The dictionary will be used automatically by ClusterFuzz once it picks up a new -revision build. - -## Custom Options - -Custom options help to fine tune libFuzzer execution parameters and will also -override the default values used by ClusterFuzz. Please read [libFuzzer options] -page for detailed documentation on how these work. A more up-to-date list of -options can be obtained by using libFuzzer's `-help=1` option (i.e. `./my_fuzzer --help=1`). - -Add the options needed in `libfuzzer_options` attribute to your `fuzzer_test` -definition in BUILD.gn file: - -``` -fuzzer_test("my_fuzzer") { - ... - libfuzzer_options = [ - # Suppress stderr output (not recommended, as it may silence useful info). - "close_fd_mask=2", - ] -} -``` - -Please note that `dict` parameter should be provided -[separately](#Fuzzer-Dictionary). All other options can be passed using -`libfuzzer_options` property. - -## Custom Build - -If you need to change the code being tested by your fuzz target, you may use an -`#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION` macro in your target code. - -Note that patching target code is not a preferred way of improving corresponding -fuzz target, but in some cases that might be the only way possible, e.g. when -there is no intended API to disable checksum verification, or when target code -uses random generator that affects reproducibility of crashes. - -[AFL]: http://lcamtuf.coredump.cx/afl/ -[ClusterFuzz Corpus]: libFuzzer_integration.md#Corpus -[ClusterFuzz status]: libFuzzer_integration.md#Status-Links -[Corpus GCS Bucket]: https://console.cloud.google.com/storage/clusterfuzz-corpus/libfuzzer -[issue 638836]: https://bugs.chromium.org/p/chromium/issues/detail?id=638836 -[coverage script]: https://cs.chromium.org/chromium/src/tools/code_coverage/coverage.py -[gsutil]: https://cloud.google.com/storage/docs/gsutil -[libFuzzer options]: https://llvm.org/docs/LibFuzzer.html#options -[startup initialization]: https://llvm.org/docs/LibFuzzer.html#startup-initialization -[Chrome libFuzzer coverage]: https://chromium-coverage.appspot.com/reports/latest_fuzzers_only/linux/index.html
diff --git a/testing/libfuzzer/efficient_fuzzing.md b/testing/libfuzzer/efficient_fuzzing.md new file mode 100644 index 0000000..ed1f563 --- /dev/null +++ b/testing/libfuzzer/efficient_fuzzing.md
@@ -0,0 +1,297 @@ +# Efficient Fuzzing Guide + +Once you have a fuzz target running, you can analyze and tweak it to improve its +efficiency. This document describes techniques to minimize fuzzing time and +maximize your results. + +*** note +**Note:** If you haven’t created your first fuzz target yet, see the [Getting +Started Guide]. +*** + +The most direct way to gauge the effectiveness of your fuzz target is to collect +metrics. You can get them manually, or take them from a [ClusterFuzz status] +page after your fuzz target is checked into the Chromium repository. + +[TOC] + +## Key metrics of a fuzz target + +### Execution speed + +A fuzzing engine such as libFuzzer typically explores a large search space by +performing randomized mutations, so it needs to run as fast as possible to find +interesting code paths. + +Fuzz target speed is calculated in executions per second (`exec/s`). It is +printed while a fuzz target is running: + +``` +#11002 NEW cov: 1337 ft: 10934 corp: 707/409Kb lim: 1098 exec/s: 5333 rss: 27Mb L: 186/1098 +``` + +You should aim for at least 1,000 exec/s from your fuzz target locally before +submitting it to the Chromium repository. If you’re under 1,000, consider the +following improvements: + +* [Simplifying initialization/cleanup](#Simplifying-initialization-cleanup) +* [Minimizing memory usage](#Minimizing-memory-usage) + +#### Simplifying initialization/cleanup + +If your `LLVMFuzzerTestOneInput` function is too complex, it can decrease the +fuzzer’s execution speed. It can also cause the fuzzer to target specific +use-cases or fail to account for unexpected scenarios. + +Instead of performing setup and teardown on each input, use static +initialization and shared resources. Check out this [startup initialization] in +libFuzzer’s documentation for an example. + +*** note +**Note:** You can skip freeing static resources. However, all other resources +allocated within the `LLVMFuzzerTestOneInput` function should be de-allocated, +since the function gets called millions of times during a fuzzing session. If +you don’t, you’ll often run out of memory and reduce overall fuzzing efficiency. +*** + +#### Minimizing memory usage + +Avoid allocation of dynamic memory wherever possible. Memory instrumentation +works faster for stack-based and static objects than for heap-allocated ones. + +*** note +**Note:** It’s always a good idea to try different variants for your fuzz target +locally, then submit only the fastest implementation to the Chromium repository. +*** + +### Code coverage + +You can check the percentage of code covered by your fuzz target to gauge +fuzzing effectiveness: + +* Review aggregated Chrome coverage from recent runs by checking the [fuzzing + coverage] report. This report can provide insight on how to improve code + coverage. +* Generate a source-level coverage report for your fuzzer by running the + [coverage script] stored in the Chromium repository. The script provides + detailed instructions and a usage example. + +*** note +**Note:** The code coverage of a fuzz target depends heavily on the corpus. A +well-chosen corpus will produce much greater code coverage. On the other hand, +a coverage report generated by a fuzz target without a corpus won't cover much +code. If you don’t have a corpus to use, you can download the [corpus from +ClusterFuzz]. For more information on the corpus, see +[Corpus Size](#Corpus-Size). +*** + +### Corpus size + +A guided fuzzing engine such as libFuzzer considers an input (a.k.a. testcase +or corpus unit) *interesting* if the input results in new code coverage (i.e., +if the fuzzer reaches code that has not been reached before). The set of all +interesting inputs is called the *corpus*. A corpus is shared across fuzzer runs +and grows over time. + +If a fuzz target stops discovering new interesting inputs after running for a +while, it typically indicates that the fuzz target is hitting a code barrier +(also called a *coverage plateau*). The corpus for a reasonably complex target +should contain hundreds (if not thousands) of inputs. + +If a fuzz target reaches coverage plateau with a small corpus, the common causes +are checksums and magic numbers. Or, it may be impossible for your fuzzer to +reach a lot of code. The easiest way to diagnose the problem is to generate and +analyze a [coverage report](#code-coverage). Then, to fix the issue, try the +following: + +* Change the code (e.g., disable CRC checks while fuzzing) with a + [custom build](#Custom-build). +* Prepare or improve the [seed corpus](#Seed-corpus). +* Prepare or improve the [fuzzer dictionary](#Fuzzer-dictionary). + +## Ways to improve a fuzz target + +### Seed corpus + +You can give your fuzz target a starting point by creating a set of valid and +interesting inputs called a *seed corpus*. If you don’t provide a seed corpus, +the fuzzing engine has to guess inputs from scratch, which can take time +(depending on the size of the inputs and the complexity of the target format). +In many cases, providing a seed corpus can increase code coverage by an order of +magnitude. + +Seed corpuses work especially well for strictly defined file formats and data +transmission protocols: + +* For file format parsers, add valid files from your test suite. +* For protocol parsers, add valid raw streams from a test suite into separate + files. +* For graphics libraries, add a variety of small PNG/JPG/GIF files. + +#### Using a corpus locally + +If you’re running a fuzz target locally, you can easily designate a corpus by +passing a directory as an argument: + +``` +./out/libfuzzer/my_fuzzer ~/tmp/my_fuzzer_corpus +``` + +The fuzzer stores all the interesting inputs it finds in the directory. + +#### Creating a Chromium repository seed corpus + +When running fuzz targets at scale, ClusterFuzz looks for a seed corpus defined +in the Chromium source repository. You can define one in your `BUILD.gn` file by +adding a `seed_corpus` attribute to your `fuzzer_test` target definition: + +``` +fuzzer_test("my_fuzzer") { + ... + seed_corpus = "test/fuzz/testcases" + ... +} +``` + +If you want to specify multiple seed corpus directories, use the `seed_corpuses` +attribute instead: + +``` +fuzzer_test("my_fuzzer") { + ... + seed_corpuses = [ "test/fuzz/testcases", "test/unittest/data" ] + ... +} +``` + +All files found in these directories and their subdirectories are stored in a +`<my_fuzzer>_seed_corpus.zip` output archive. + +#### Uploading corpus files to GCS + +If you can't store your seed corpus in the Chromium repository (e.g., it’s too +large, can’t be open-sourced, etc.), you can upload the corpus to the Google +Cloud Storage (GCS) bucket used by ClusterFuzz. + +1) Open the [Corpus GCS Bucket] in your browser. +2) Search for the directory named `<my_fuzzer>`. If the directory does not + exist, create it. +3) In the `<my_fuzzer>` directory, upload your corpus files. + +*** note +**Note:** If you upload your corpus to GCS, you don’t need to add the +`seed_corpus` attribute to your `fuzzer_test` target definition. However, adding +seed corpus to the Chromium repository is the preferred way. +*** + +You can do the same thing by using the [gsutil] command line tool: + +```bash +gsutil -m rsync <path_to_corpus> gs://clusterfuzz-corpus/libfuzzer/<my_fuzzer> +``` + +*** note +**Note:** To write to this bucket using `gsutil`, you must be logged into your +@google.com account (@chromium.org will not work). You can use the `gcloud auth +login` command to log into your account in `gsutil` if you installed `gsutil` +through `gcloud`. +*** + +#### Minimizing a seed corpus + +Your seed corpus is synced to all fuzzing bots for every iteration, so it's +important to minimize it to a small set of interesting inputs before uploading. +Keeping the seed corpus small improves fuzzing efficiency and prevents our bots +from running out of disk space. + +You can minimize your seed corpus by using libFuzzer’s `-merge=1` option: + +```bash +# Create an empty directory. +mkdir seed_corpus_minimized + +# Run the fuzzer with -merge=1 flag. +./my_fuzzer -merge=1 ./seed_corpus_minimized ./seed_corpus +``` + +After running the command, the `seed_corpus_minimized` directory will contain a +minimized corpus that gives the same code coverage as your initial `seed_corpus` +directory. + +### Fuzzer dictionary + +You can help your fuzzer increase its coverage by providing a set of common +words or values that you expect to find in the input. Such a dictionary works +especially well for certain use-cases (e.g., fuzzing file format decoders or +text-based protocols like XML). + +Add a fuzzer dictionary: + +1) Create a flat ASCII text file that lists one input token per line in the + format `name="value"`. The value must appear in quotes with hex escaping + (`\xNN`) applied to all non-printable, high-bit, or otherwise problematic + characters (`\` and `"` shorthands are recognized, too). This syntax is + similar to the one used by the [AFL] fuzzing engine (`-x` option). + + *** note + **Note:** `name` can be omitted, but it is a convenient way to document the + meaning of each token. Here’s an example dictionary: + *** + + ``` + # Lines starting with '#' and empty lines are ignored. + + # Adds "blah" word (w/o quotes) to the dictionary. + kw1="blah" + # Use \\ for backslash and \" for quotes. + kw2="\"ac\\dc\"" + # Use \xAB for hex values. + kw3="\xF7\xF8" + # Key name before '=' can be omitted: + "foo\x0Abar" + ``` + +2) Test your dictionary by running your fuzz target locally: + + ```bash + ./out/libfuzzer/my_fuzzer -dict=<path_to_dict> <path_to_corpus> + ``` + + If the dictionary is effective, you should see `NEW` units discovered in the + output. + +3) Add the dictionary file in the same directory as your fuzz target, then add + the `dict` attribute to the `fuzzer_test` definition in your `BUILD.gn` file: + + ``` + fuzzer_test("my_fuzzer") { + ... + dict = "my_fuzzer.dict" + } + ``` + + The dictionary is submitted to the Chromium repository. Once ClusterFuzz + picks up a new revision build, the dictionary is used automatically. + +### Custom build + +If you need to change the code being tested by your fuzz target, you can use an +`#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION` macro in your target code. + +*** note +**Note:** Patching target code is not a preferred way of improving the +corresponding fuzz target, but in some cases it might be the only way to do it +(e.g., when there is no intended API to disable checksum verification, or when +the target code uses a random generator that affects the reproducibility of +crashes). +*** + +[AFL]: http://lcamtuf.coredump.cx/afl/ +[ClusterFuzz status]: libFuzzer_integration.md#Status-Links +[Corpus GCS Bucket]: https://console.cloud.google.com/storage/clusterfuzz-corpus/libfuzzer +[Getting Started Guide]: getting_started.md +[corpus from ClusterFuzz]: libFuzzer_integration.md#Corpus +[coverage script]: https://cs.chromium.org/chromium/src/tools/code_coverage/coverage.py +[fuzzing coverage]: https://chromium-coverage.appspot.com/reports/latest_fuzzers_only/linux/index.html +[gsutil]: https://cloud.google.com/storage/docs/gsutil +[startup initialization]: https://llvm.org/docs/LibFuzzer.html#startup-initialization
diff --git a/testing/libfuzzer/getting_started.md b/testing/libfuzzer/getting_started.md index a78c259..7e9c6193 100644 --- a/testing/libfuzzer/getting_started.md +++ b/testing/libfuzzer/getting_started.md
@@ -25,10 +25,12 @@ python tools\mb\mb.py gen -m chromium.fuzz -b "Libfuzzer Upload Windows ASan" out\libfuzzer ``` -**Note**: You can also invoke [AFL] by using the `use_afl` GN argument, but we +*** note +**Note:** You can also invoke [AFL] by using the `use_afl` GN argument, but we recommend libFuzzer for local development. Running libFuzzer locally doesn't require any special configuration and gives quick, meaningful output for speed, coverage, and other parameters. +*** It’s possible to run fuzz targets without sanitizers, but not recommended, as sanitizers help to detect errors which may not result in a crash otherwise. @@ -43,8 +45,10 @@ For more on builder and sanitizer configurations, see the [Integration Reference] page. +*** note **Hint**: Fuzz targets are built with minimal symbols by default. You can adjust the symbol level by setting the `symbol_level` attribute. +*** ### Creating your first fuzz target @@ -53,9 +57,11 @@ 1. In the same directory as the code you are going to fuzz (or next to the tests for that code), create a new `<my_fuzzer>.cc` file. - **Note**: Do not use the `testing/libfuzzer/fuzzers` directory. This + *** note + **Note:** Do not use the `testing/libfuzzer/fuzzers` directory. This directory was used for initial sample fuzz targets but is no longer recommended for landing new targets. + *** 2. In the new file, define a `LLVMFuzzerTestOneInput` function: @@ -79,11 +85,13 @@ } ``` -**Note**: Most of the targets are small. They may perform one or a few API calls +*** note +**Note:** Most of the targets are small. They may perform one or a few API calls using the data provided by the fuzzing engine as an argument. However, fuzz targets may be more complex if a certain initialization procedure needs to be performed. [quic_stream_factory_fuzzer.cc] is a good example of a complex fuzz target. +*** ### Running the fuzz target @@ -119,9 +127,11 @@ For more information about the output, see [libFuzzer's output documentation]. -**Note**: If you observe an `odr-violation` error in the log, please try setting +*** note +**Note:** If you observe an `odr-violation` error in the log, please try setting the following environment variable: `ASAN_OPTIONS=detect_odr_violation=0` and running the fuzz target again. +*** #### Symbolizing a stacktrace @@ -149,12 +159,14 @@ page after a day or two. If you want to better understand and optimize your fuzz target’s performance, -see the [Efficient Fuzzer Guide]. +see the [Efficient Fuzzing Guide]. -**Note**: It’s important to run fuzzers at scale, not just in your own +*** note +**Note:** It’s important to run fuzzers at scale, not just in your own environment, because local fuzzing will catch fewer issues. If you run fuzz targets at scale continuously, you’ll catch regressions and improve code coverage over time. +*** ## Optional improvements @@ -166,9 +178,11 @@ * **Create a seed corpus**. You can guide the fuzzing engine to generate more relevant inputs by adding the `seed_corpus = "src/fuzz-testcases/"` attribute to your fuzz target and adding example files to the appropriate directory. For - more, see the [Seed Corpus] section of the [Efficient Fuzzer Guide]. + more, see the [Seed Corpus] section of the [Efficient Fuzzing Guide]. - **Note**: make sure your corpus files are appropriately licensed. + *** note + **Note:** make sure your corpus files are appropriately licensed. + *** * **Create a mutation dictionary**. You can make mutations more effective by providing the fuzzer with a `dict = "protocol.dict"` GN attribute and a @@ -195,7 +209,7 @@ * **Generate a [code coverage report]**. See which code the fuzzer covered in recent runs, so you can gauge whether it hits the important code parts or not. - **Note**: Since the code coverage of a fuzz target depends heavily on the + **Note:** Since the code coverage of a fuzz target depends heavily on the corpus provided when running the target, we recommend running the fuzz target built with ASan locally for a little while (several minutes / hours) first. This will produce some corpus, which should be used for generating a code @@ -236,8 +250,10 @@ If you need to mutate multiple inputs of various types and length, see [Getting Started with libprotobuf-mutator in Chromium]. -**Note**: This method requires extra effort, but works with APIs and data +*** note +**Note:** This method requires extra effort, but works with APIs and data structures of any complexity. +*** #### Hash-based argument @@ -255,11 +271,13 @@ ``` -**Note**: The hash value derived from the data is a random value, rather than a +*** note +**Note:** The hash value derived from the data is a random value, rather than a meaningful one controlled by the fuzzing engine. A single bit mutation might lead to a new code coverage, but the next mutation would generate a new hash value and trigger another code path, without providing any real guidance to the fuzzing engine. +*** #### Bytes taken from (data, size) @@ -348,16 +366,16 @@ [AFL]: AFL_integration.md [AddressSanitizer]: http://clang.llvm.org/docs/AddressSanitizer.html [ClusterFuzz status]: libFuzzer_integration.md#Status-Links -[Efficient Fuzzer Guide]: efficient_fuzzer.md +[Efficient Fuzzing Guide]: efficient_fuzzing.md [FuzzedDataProvider]: https://cs.chromium.org/chromium/src/third_party/libFuzzer/src/utils/FuzzedDataProvider.h -[Fuzzer Dictionary]: efficient_fuzzer.md#Fuzzer-Dictionary +[Fuzzer Dictionary]: efficient_fuzzing.md#Fuzzer-dictionary [GN]: https://gn.googlesource.com/gn/+/master/README.md [Getting Started with libprotobuf-mutator in Chromium]: libprotobuf-mutator.md [Integration Reference]: reference.md [MemorySanitizer]: http://clang.llvm.org/docs/MemorySanitizer.html -[Seed Corpus]: efficient_fuzzer.md#Seed-Corpus +[Seed Corpus]: efficient_fuzzing.md#Seed-corpus [UndefinedBehaviorSanitizer]: http://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html -[code coverage report]: efficient_fuzzer.md#Code-Coverage +[code coverage report]: efficient_fuzzing.md#Code-coverage [crbug/598448]: https://bugs.chromium.org/p/chromium/issues/detail?id=598448 [google/fuzzing documentation page]: https://github.com/google/fuzzing/blob/master/docs/split-inputs.md#fuzzed-data-provider [libFuzzer's output documentation]: http://llvm.org/docs/LibFuzzer.html#output
diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc index 458c967d..a53cb1f 100644 --- a/third_party/blink/common/features.cc +++ b/third_party/blink/common/features.cc
@@ -4,8 +4,10 @@ #include "third_party/blink/public/common/features.h" +#include "base/feature_list.h" #include "build/build_config.h" #include "services/network/public/cpp/features.h" +#include "third_party/blink/public/common/forcedark/forcedark_switches.h" namespace blink { namespace features { @@ -276,6 +278,49 @@ const base::Feature kScrollbarInjectScrollGestures{ "ScrollbarInjectScrollGestures", base::FEATURE_ENABLED_BY_DEFAULT}; +// Automatically convert light-themed pages to use a Blink-generated dark theme +const base::Feature kForceWebContentsDarkMode{ + "WebContentsForceDark", base::FEATURE_DISABLED_BY_DEFAULT}; + +// Which algorithm should be used for color inversion? +const base::FeatureParam<ForceDarkInversionMethod>::Option + forcedark_inversion_method_options[] = { + {ForceDarkInversionMethod::kUseBlinkSettings, + "use_blink_settings_for_method"}, + {ForceDarkInversionMethod::kHslBased, "hsl_based"}, + {ForceDarkInversionMethod::kCielabBased, "cielab_based"}}; + +const base::FeatureParam<ForceDarkInversionMethod> + kForceDarkInversionMethodParam{&kForceWebContentsDarkMode, + "inversion_method", + ForceDarkInversionMethod::kUseBlinkSettings, + &forcedark_inversion_method_options}; + +// Should images be inverted? +const base::FeatureParam<ForceDarkImageBehavior>::Option + forcedark_image_behavior_options[] = { + {ForceDarkImageBehavior::kUseBlinkSettings, + "use_blink_settings_for_images"}, + {ForceDarkImageBehavior::kInvertNone, "none"}, + {ForceDarkImageBehavior::kInvertSelectively, "selective"}}; + +const base::FeatureParam<ForceDarkImageBehavior> kForceDarkImageBehaviorParam{ + &kForceWebContentsDarkMode, "image_behavior", + ForceDarkImageBehavior::kUseBlinkSettings, + &forcedark_image_behavior_options}; + +// Do not invert text lighter than this. +// Range: 0 (do not invert any text) to 256 (invert all text) +// Can also set to -1 to let Blink's internal settings control the value +const base::FeatureParam<int> kForceDarkTextLightnessThresholdParam{ + &kForceWebContentsDarkMode, "text_lightness_threshold", -1}; + +// Do not invert backgrounds darker than this. +// Range: 0 (invert all backgrounds) to 256 (invert no backgrounds) +// Can also set to -1 to let Blink's internal settings control the value +const base::FeatureParam<int> kForceDarkBackgroundLightnessThresholdParam{ + &kForceWebContentsDarkMode, "background_lightness_threshold", -1}; + bool IsPlzDedicatedWorkerEnabled() { // PlzDedicatedWorker depends on off-the-main-thread dedicated worker script // fetch and NetworkService.
diff --git a/third_party/blink/public/common/BUILD.gn b/third_party/blink/public/common/BUILD.gn index edfba94..0fd8de22 100644 --- a/third_party/blink/public/common/BUILD.gn +++ b/third_party/blink/public/common/BUILD.gn
@@ -52,6 +52,7 @@ "features.h", "fetch/fetch_api_request_headers_map.h", "fetch/fetch_api_request_headers_mojom_traits.h", + "forcedark/forcedark_switches.h", "frame/blocked_navigation_types.h", "frame/frame_owner_element_type.h", "frame/frame_policy.h", @@ -90,8 +91,8 @@ "messaging/transferable_message_mojom_traits.h", "mime_util/mime_util.h", "notifications/notification_constants.h", - "notifications/notification_resources.h", "notifications/notification_mojom_traits.h", + "notifications/notification_resources.h", "notifications/platform_notification_data.h", "oom_intervention/oom_intervention_types.h", "origin_policy/origin_policy.h",
diff --git a/third_party/blink/public/common/features.h b/third_party/blink/public/common/features.h index 8c8f818..ef7bf0f 100644 --- a/third_party/blink/public/common/features.h +++ b/third_party/blink/public/common/features.h
@@ -8,6 +8,7 @@ #include "base/feature_list.h" #include "base/metrics/field_trial_params.h" #include "third_party/blink/public/common/common_export.h" +#include "third_party/blink/public/common/forcedark/forcedark_switches.h" namespace blink { namespace features { @@ -86,6 +87,16 @@ BLINK_COMMON_EXPORT extern const base::Feature kLightweightNoStatePrefetch; +BLINK_COMMON_EXPORT extern const base::Feature kForceWebContentsDarkMode; +BLINK_COMMON_EXPORT extern const base::FeatureParam<ForceDarkInversionMethod> + kForceDarkInversionMethodParam; +BLINK_COMMON_EXPORT extern const base::FeatureParam<ForceDarkImageBehavior> + kForceDarkImageBehaviorParam; +BLINK_COMMON_EXPORT extern const base::FeatureParam<int> + kForceDarkTextLightnessThresholdParam; +BLINK_COMMON_EXPORT extern const base::FeatureParam<int> + kForceDarkBackgroundLightnessThresholdParam; + // Returns true when PlzDedicatedWorker is enabled. BLINK_COMMON_EXPORT bool IsPlzDedicatedWorkerEnabled();
diff --git a/third_party/blink/public/common/forcedark/forcedark_switches.h b/third_party/blink/public/common/forcedark/forcedark_switches.h new file mode 100644 index 0000000..806aea5 --- /dev/null +++ b/third_party/blink/public/common/forcedark/forcedark_switches.h
@@ -0,0 +1,41 @@ +// Copyright 2019 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 THIRD_PARTY_BLINK_PUBLIC_COMMON_FORCEDARK_FORCEDARK_SWITCHES_H_ +#define THIRD_PARTY_BLINK_PUBLIC_COMMON_FORCEDARK_FORCEDARK_SWITCHES_H_ + +namespace blink { + +// Specifies algorithm for modifying how colors are rendered in Force Dark. +enum class ForceDarkInversionMethod { + // Use the value provided via command line with --blink_settings or, if that + // flag is absent, get the value from the defaults in + // renderer/core/frame/settings.json5. + kUseBlinkSettings, + + // Modify colors by converting them to the HSL color space and inverting the + // lightness (i.e. the "L" in HSL). + kHslBased, + + // Modify colors by converting them to CIE L*a*b color space and inverting the + // L value. + kCielabBased +}; + +// Specifies algorithm for determining which images to invert in Force Dark. +enum class ForceDarkImageBehavior { + // Same as ForceDarkInversionMethod::kUseBlinkSettings above. + kUseBlinkSettings, + + // Do not invert any images. + kInvertNone, + + // Invert only some images. Images that act as icons or text should be + // inverted, but photos, avatars, etc. should not be. + kInvertSelectively +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_FORCEDARK_FORCEDARK_SWITCHES_H_
diff --git a/third_party/blink/public/mojom/web_feature/web_feature.mojom b/third_party/blink/public/mojom/web_feature/web_feature.mojom index 275a47f..66104ab 100644 --- a/third_party/blink/public/mojom/web_feature/web_feature.mojom +++ b/third_party/blink/public/mojom/web_feature/web_feature.mojom
@@ -2372,6 +2372,7 @@ kV8SpeechRecognition_Constructor = 2990, kV8SpeechRecognition_Grammars_AttributeGetter = 2991, kV8SpeechRecognition_Grammars_AttributeSetter = 2992, + kContactsManagerSelect = 2993, // Add new features immediately above this line. Don't change assigned // numbers of any item, and don't reuse removed slots.
diff --git a/third_party/blink/public/platform/web_data.h b/third_party/blink/public/platform/web_data.h index 8e9724f..912f7f3 100644 --- a/third_party/blink/public/platform/web_data.h +++ b/third_party/blink/public/platform/web_data.h
@@ -34,6 +34,7 @@ #include "third_party/blink/public/platform/web_common.h" #include "third_party/blink/public/platform/web_private_ptr.h" #include "third_party/blink/public/platform/web_vector.h" +#include "third_party/blink/renderer/platform/wtf/forward.h" #if INSIDE_BLINK #include "base/memory/scoped_refptr.h" @@ -41,8 +42,6 @@ namespace blink { -class SharedBuffer; - // A container for raw bytes. It is inexpensive to copy a WebData object. // // WARNING: It is not safe to pass a WebData across threads!!!
diff --git a/third_party/blink/public/web/web_navigation_params.h b/third_party/blink/public/web/web_navigation_params.h index e435ed3..ac8a052 100644 --- a/third_party/blink/public/web/web_navigation_params.h +++ b/third_party/blink/public/web/web_navigation_params.h
@@ -47,7 +47,6 @@ namespace blink { class KURL; -class SharedBuffer; class WebDocumentLoader; // This structure holds all information collected by Blink when
diff --git a/third_party/blink/renderer/bindings/core/v8/script_streamer.cc b/third_party/blink/renderer/bindings/core/v8/script_streamer.cc index dc5e6f7..277ec2b 100644 --- a/third_party/blink/renderer/bindings/core/v8/script_streamer.cc +++ b/third_party/blink/renderer/bindings/core/v8/script_streamer.cc
@@ -27,9 +27,9 @@ #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h" #include "third_party/blink/renderer/platform/scheduler/public/worker_pool.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" #include "third_party/blink/renderer/platform/wtf/deque.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/text_encoding_registry.h" namespace blink {
diff --git a/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.cc b/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.cc index 1a12b1e..87e2bf2 100644 --- a/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.cc +++ b/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.cc
@@ -66,9 +66,9 @@ #include "third_party/blink/renderer/platform/blob/blob_data.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" #include "third_party/blink/renderer/platform/wtf/dtoa/utils.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" #include "third_party/blink/renderer/platform/wtf/text/string_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/string_hash.h"
diff --git a/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h b/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h index 990461a..d1edfe7 100644 --- a/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h +++ b/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h
@@ -56,7 +56,6 @@ class ExecutionContext; class MessagePort; class ScriptValue; -class SharedBuffer; class StaticBitmapImage; class Transferables; class UnpackedSerializedScriptValue;
diff --git a/third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.cc b/third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.cc index 751033f..bbd2c2f 100644 --- a/third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.cc +++ b/third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.cc
@@ -49,8 +49,8 @@ #include "third_party/blink/renderer/modules/indexeddb/idb_key_range.h" #include "third_party/blink/renderer/modules/indexeddb/idb_tracing.h" #include "third_party/blink/renderer/modules/indexeddb/idb_value.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/math_extras.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/vector.h" namespace blink {
diff --git a/third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules_test.cc b/third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules_test.cc index c603dc9..76eae52 100644 --- a/third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules_test.cc +++ b/third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules_test.cc
@@ -41,7 +41,7 @@ #include "third_party/blink/renderer/modules/indexeddb/idb_key_path.h" #include "third_party/blink/renderer/modules/indexeddb/idb_value.h" #include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/string_view.h" namespace blink {
diff --git a/third_party/blink/renderer/core/accessibility/apply_dark_mode.cc b/third_party/blink/renderer/core/accessibility/apply_dark_mode.cc index b2e6f372..fc649a9 100644 --- a/third_party/blink/renderer/core/accessibility/apply_dark_mode.cc +++ b/third_party/blink/renderer/core/accessibility/apply_dark_mode.cc
@@ -4,6 +4,9 @@ #include "third_party/blink/renderer/core/accessibility/apply_dark_mode.h" +#include "base/metrics/field_trial_params.h" +#include "third_party/blink/public/common/features.h" +#include "third_party/blink/public/common/forcedark/forcedark_switches.h" #include "third_party/blink/renderer/core/css/properties/css_property.h" #include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/platform/graphics/color.h" @@ -29,6 +32,45 @@ return true; } +DarkMode GetMode(const Settings& frame_settings) { + switch (features::kForceDarkInversionMethodParam.Get()) { + case ForceDarkInversionMethod::kUseBlinkSettings: + return frame_settings.GetDarkMode(); + case ForceDarkInversionMethod::kCielabBased: + return DarkMode::kInvertLightnessLAB; + case ForceDarkInversionMethod::kHslBased: + return DarkMode::kInvertLightness; + } +} + +DarkModeImagePolicy GetImagePolicy(const Settings& frame_settings) { + switch (features::kForceDarkImageBehaviorParam.Get()) { + case ForceDarkImageBehavior::kUseBlinkSettings: + return frame_settings.GetDarkModeImagePolicy(); + case ForceDarkImageBehavior::kInvertNone: + return DarkModeImagePolicy::kFilterNone; + case ForceDarkImageBehavior::kInvertSelectively: + return DarkModeImagePolicy::kFilterSmart; + } +} + +int GetTextBrightnessThreshold(const Settings& frame_settings) { + const int flag_value = base::GetFieldTrialParamByFeatureAsInt( + features::kForceWebContentsDarkMode, + features::kForceDarkTextLightnessThresholdParam.name, -1); + return flag_value >= 0 ? flag_value + : frame_settings.GetDarkModeTextBrightnessThreshold(); +} + +int GetBackgroundBrightnessThreshold(const Settings& frame_settings) { + const int flag_value = base::GetFieldTrialParamByFeatureAsInt( + features::kForceWebContentsDarkMode, + features::kForceDarkBackgroundLightnessThresholdParam.name, -1); + return flag_value >= 0 + ? flag_value + : frame_settings.GetDarkModeBackgroundBrightnessThreshold(); +} + } // namespace DarkModeSettings BuildDarkModeSettings(const Settings& frame_settings, @@ -49,16 +91,16 @@ dark_mode_settings.image_policy = DarkModeImagePolicy::kFilterNone; return dark_mode_settings; } - dark_mode_settings.mode = frame_settings.GetDarkMode(); + + dark_mode_settings.mode = GetMode(frame_settings); + dark_mode_settings.image_policy = GetImagePolicy(frame_settings); + dark_mode_settings.text_brightness_threshold = + GetTextBrightnessThreshold(frame_settings); + dark_mode_settings.background_brightness_threshold = + GetBackgroundBrightnessThreshold(frame_settings); + dark_mode_settings.grayscale = frame_settings.GetDarkModeGrayscale(); dark_mode_settings.contrast = frame_settings.GetDarkModeContrast(); - dark_mode_settings.image_policy = frame_settings.GetDarkModeImagePolicy(); - dark_mode_settings.classifier_type = - frame_settings.GetDarkModeClassifierType(); - dark_mode_settings.text_brightness_threshold = - frame_settings.GetDarkModeTextBrightnessThreshold(); - dark_mode_settings.background_brightness_threshold = - frame_settings.GetDarkModeBackgroundBrightnessThreshold(); dark_mode_settings.image_grayscale_percent = frame_settings.GetDarkModeImageGrayscale(); return dark_mode_settings;
diff --git a/third_party/blink/renderer/core/clipboard/data_object.h b/third_party/blink/renderer/core/clipboard/data_object.h index 326391df..f1fdcd3 100644 --- a/third_party/blink/renderer/core/clipboard/data_object.h +++ b/third_party/blink/renderer/core/clipboard/data_object.h
@@ -43,7 +43,6 @@ namespace blink { class KURL; -class SharedBuffer; class WebDragData; enum class PasteMode;
diff --git a/third_party/blink/renderer/core/clipboard/data_object_item.h b/third_party/blink/renderer/core/clipboard/data_object_item.h index e75fe30..82a11c42 100644 --- a/third_party/blink/renderer/core/clipboard/data_object_item.h +++ b/third_party/blink/renderer/core/clipboard/data_object_item.h
@@ -34,9 +34,9 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/fileapi/file.h" #include "third_party/blink/renderer/platform/heap/handle.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/wtf/forward.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/core/css/binary_data_font_face_source.cc b/third_party/blink/renderer/core/css/binary_data_font_face_source.cc index c2316dc..f73ca24 100644 --- a/third_party/blink/renderer/core/css/binary_data_font_face_source.cc +++ b/third_party/blink/renderer/core/css/binary_data_font_face_source.cc
@@ -7,7 +7,7 @@ #include "third_party/blink/renderer/platform/fonts/font_custom_platform_data.h" #include "third_party/blink/renderer/platform/fonts/font_description.h" #include "third_party/blink/renderer/platform/fonts/simple_font_data.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/core/css/binary_data_font_face_source.h b/third_party/blink/renderer/core/css/binary_data_font_face_source.h index 2365ece..ce16140 100644 --- a/third_party/blink/renderer/core/css/binary_data_font_face_source.h +++ b/third_party/blink/renderer/core/css/binary_data_font_face_source.h
@@ -11,7 +11,6 @@ namespace blink { class FontCustomPlatformData; -class SharedBuffer; class BinaryDataFontFaceSource final : public CSSFontFaceSource { public:
diff --git a/third_party/blink/renderer/core/css/font_face.cc b/third_party/blink/renderer/core/css/font_face.cc index bf483a2..ca0ea54 100644 --- a/third_party/blink/renderer/core/css/font_face.cc +++ b/third_party/blink/renderer/core/css/font_face.cc
@@ -66,7 +66,7 @@ #include "third_party/blink/renderer/platform/instrumentation/histogram.h" #include "third_party/blink/renderer/platform/instrumentation/use_counter.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/core/css/style_environment_variables_test.cc b/third_party/blink/renderer/core/css/style_environment_variables_test.cc index 0299110..21d1608 100644 --- a/third_party/blink/renderer/core/css/style_environment_variables_test.cc +++ b/third_party/blink/renderer/core/css/style_environment_variables_test.cc
@@ -12,8 +12,8 @@ #include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/core/testing/page_test_base.h" #include "third_party/blink/renderer/platform/instrumentation/use_counter.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc index 1086d29..1e2d641 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc
@@ -3552,6 +3552,8 @@ KURL new_url = entered_document->Url(); new_url.SetFragmentIdentifier(String()); SetURL(new_url); + if (Loader()) + Loader()->UpdateUrlForDocumentOpen(new_url); SetSecurityOrigin(entered_document->GetMutableSecurityOrigin()); SetReferrerPolicy(entered_document->GetReferrerPolicy()); @@ -7374,6 +7376,8 @@ if (!frame_) return nullptr; + // TODO(dcheng): remove this check. frame_ is guaranteed to be non-null only + // if frame_->GetDocument() == this. if (frame_->GetDocument() != this) return nullptr;
diff --git a/third_party/blink/renderer/core/dom/document.h b/third_party/blink/renderer/core/dom/document.h index b08a7e36..d6acfc4 100644 --- a/third_party/blink/renderer/core/dom/document.h +++ b/third_party/blink/renderer/core/dom/document.h
@@ -1581,6 +1581,10 @@ } bool ToggleDuringParsing() { return toggle_during_parsing_; } + bool HasPendingJavaScriptUrlsForTest() { + return !pending_javascript_urls_.IsEmpty(); + } + protected: void ClearXMLVersion() { xml_version_ = String(); }
diff --git a/third_party/blink/renderer/core/exported/web_frame_serializer.cc b/third_party/blink/renderer/core/exported/web_frame_serializer.cc index 5373264..60747a2 100644 --- a/third_party/blink/renderer/core/exported/web_frame_serializer.cc +++ b/third_party/blink/renderer/core/exported/web_frame_serializer.cc
@@ -71,12 +71,12 @@ #include "third_party/blink/renderer/platform/mhtml/mhtml_archive.h" #include "third_party/blink/renderer/platform/mhtml/mhtml_parser.h" #include "third_party/blink/renderer/platform/mhtml/serialized_resource.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" #include "third_party/blink/renderer/platform/wtf/deque.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/string_concatenate.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
diff --git a/third_party/blink/renderer/core/exported/web_frame_serializer_test_helper.cc b/third_party/blink/renderer/core/exported/web_frame_serializer_test_helper.cc index b97e6b77..b219167 100644 --- a/third_party/blink/renderer/core/exported/web_frame_serializer_test_helper.cc +++ b/third_party/blink/renderer/core/exported/web_frame_serializer_test_helper.cc
@@ -12,7 +12,7 @@ #include "third_party/blink/renderer/core/frame/web_local_frame_impl.h" #include "third_party/blink/renderer/platform/mhtml/mhtml_archive.h" #include "third_party/blink/renderer/platform/mhtml/mhtml_parser.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" namespace blink {
diff --git a/third_party/blink/renderer/core/exported/web_navigation_params.cc b/third_party/blink/renderer/core/exported/web_navigation_params.cc index 1aa1941..5d01aa3e 100644 --- a/third_party/blink/renderer/core/exported/web_navigation_params.cc +++ b/third_party/blink/renderer/core/exported/web_navigation_params.cc
@@ -8,7 +8,7 @@ #include "third_party/blink/renderer/platform/loader/static_data_navigation_body_loader.h" #include "third_party/blink/renderer/platform/network/encoded_form_data.h" #include "third_party/blink/renderer/platform/network/http_names.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/core/exported/worker_shadow_page.cc b/third_party/blink/renderer/core/exported/worker_shadow_page.cc index 2abc8a8..580609e4a 100644 --- a/third_party/blink/renderer/core/exported/worker_shadow_page.cc +++ b/third_party/blink/renderer/core/exported/worker_shadow_page.cc
@@ -9,7 +9,7 @@ #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/core/exported/web_view_impl.h" #include "third_party/blink/renderer/core/loader/frame_load_request.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/core/frame/csp/content_security_policy_fuzzer.cc b/third_party/blink/renderer/core/frame/csp/content_security_policy_fuzzer.cc index c296c95..1f962e2 100644 --- a/third_party/blink/renderer/core/frame/csp/content_security_policy_fuzzer.cc +++ b/third_party/blink/renderer/core/frame/csp/content_security_policy_fuzzer.cc
@@ -7,8 +7,8 @@ #include "third_party/blink/renderer/core/testing/dummy_page_holder.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/thread_state.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/blink_fuzzer_test_support.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" namespace blink {
diff --git a/third_party/blink/renderer/core/frame/frame_serializer.h b/third_party/blink/renderer/core/frame/frame_serializer.h index ea240648..b77fefd 100644 --- a/third_party/blink/renderer/core/frame/frame_serializer.h +++ b/third_party/blink/renderer/core/frame/frame_serializer.h
@@ -51,7 +51,6 @@ class FontResource; class ImageResourceContent; class LocalFrame; -class SharedBuffer; class CSSPropertyValueSet; struct SerializedResource;
diff --git a/third_party/blink/renderer/core/frame/local_frame.h b/third_party/blink/renderer/core/frame/local_frame.h index d431f42..3b22665 100644 --- a/third_party/blink/renderer/core/frame/local_frame.h +++ b/third_party/blink/renderer/core/frame/local_frame.h
@@ -99,7 +99,6 @@ class PluginData; class ResourceRequest; class ScriptController; -class SharedBuffer; class SmoothScrollSequencer; class SpellChecker; class TextSuggestionController;
diff --git a/third_party/blink/renderer/core/frame/local_frame_view.cc b/third_party/blink/renderer/core/frame/local_frame_view.cc index 4ecbcc2..c3aed55d 100644 --- a/third_party/blink/renderer/core/frame/local_frame_view.cc +++ b/third_party/blink/renderer/core/frame/local_frame_view.cc
@@ -3356,12 +3356,14 @@ } void LocalFrameView::AddResizerArea(LayoutBox& resizer_box) { + DCHECK(!RuntimeEnabledFeatures::PaintNonFastScrollableRegionsEnabled()); if (!resizer_areas_) resizer_areas_ = std::make_unique<ResizerAreaSet>(); resizer_areas_->insert(&resizer_box); } void LocalFrameView::RemoveResizerArea(LayoutBox& resizer_box) { + DCHECK(!RuntimeEnabledFeatures::PaintNonFastScrollableRegionsEnabled()); if (!resizer_areas_) return;
diff --git a/third_party/blink/renderer/core/frame/local_frame_view.h b/third_party/blink/renderer/core/frame/local_frame_view.h index a879e10..1558182 100644 --- a/third_party/blink/renderer/core/frame/local_frame_view.h +++ b/third_party/blink/renderer/core/frame/local_frame_view.h
@@ -464,10 +464,15 @@ // the bottom right of the object. We keep track of these resizer areas for // checking if touches (implemented using Scroll gesture) are targeting the // resizer. + // TODO(pdr): The resizers do not need to be tracked with + // PaintNonFastScrollableRegions and can be removed once that ships. typedef HashSet<LayoutBox*> ResizerAreaSet; void AddResizerArea(LayoutBox&); void RemoveResizerArea(LayoutBox&); - const ResizerAreaSet* ResizerAreas() const { return resizer_areas_.get(); } + const ResizerAreaSet* ResizerAreas() const { + DCHECK(!RuntimeEnabledFeatures::PaintNonFastScrollableRegionsEnabled()); + return resizer_areas_.get(); + } void ScheduleAnimation();
diff --git a/third_party/blink/renderer/core/frame/mhtml_archive_test.cc b/third_party/blink/renderer/core/frame/mhtml_archive_test.cc index 36b1833..2ad126c 100644 --- a/third_party/blink/renderer/core/frame/mhtml_archive_test.cc +++ b/third_party/blink/renderer/core/frame/mhtml_archive_test.cc
@@ -34,13 +34,13 @@ #include "third_party/blink/renderer/platform/mhtml/mhtml_archive.h" #include "third_party/blink/renderer/platform/mhtml/mhtml_parser.h" #include "third_party/blink/renderer/platform/mhtml/serialized_resource.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/testing_platform_support.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" #include "third_party/blink/renderer/platform/testing/url_test_helpers.h" #include "third_party/blink/renderer/platform/text/date_components.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/weborigin/scheme_registry.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" using blink::mojom::MHTMLLoadResult;
diff --git a/third_party/blink/renderer/core/html/forms/internal_popup_menu_test.cc b/third_party/blink/renderer/core/html/forms/internal_popup_menu_test.cc index 6cc74c5..adccf2c 100644 --- a/third_party/blink/renderer/core/html/forms/internal_popup_menu_test.cc +++ b/third_party/blink/renderer/core/html/forms/internal_popup_menu_test.cc
@@ -12,7 +12,7 @@ #include "third_party/blink/renderer/core/loader/empty_clients.h" #include "third_party/blink/renderer/core/testing/dummy_page_holder.h" #include "third_party/blink/renderer/platform/heap/heap.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/core/html/parser/html_document_parser.cc b/third_party/blink/renderer/core/html/parser/html_document_parser.cc index 7c259b8..c08c2fe 100644 --- a/third_party/blink/renderer/core/html/parser/html_document_parser.cc +++ b/third_party/blink/renderer/core/html/parser/html_document_parser.cc
@@ -65,8 +65,8 @@ #include "third_party/blink/renderer/platform/scheduler/public/cooperative_scheduling_manager.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/core/imagebitmap/image_bitmap_factories.cc b/third_party/blink/renderer/core/imagebitmap/image_bitmap_factories.cc index 2e70bf27..b07ff45 100644 --- a/third_party/blink/renderer/core/imagebitmap/image_bitmap_factories.cc +++ b/third_party/blink/renderer/core/imagebitmap/image_bitmap_factories.cc
@@ -55,8 +55,8 @@ #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/scheduler/public/worker_pool.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "v8/include/v8.h" namespace blink {
diff --git a/third_party/blink/renderer/core/inspector/dev_tools_host.cc b/third_party/blink/renderer/core/inspector/dev_tools_host.cc index 01da92a..34743949 100644 --- a/third_party/blink/renderer/core/inspector/dev_tools_host.cc +++ b/third_party/blink/renderer/core/inspector/dev_tools_host.cc
@@ -55,7 +55,7 @@ #include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_request.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_response.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" namespace blink {
diff --git a/third_party/blink/renderer/core/inspector/inspector_page_agent.h b/third_party/blink/renderer/core/inspector/inspector_page_agent.h index 7b17903..e357fae 100644 --- a/third_party/blink/renderer/core/inspector/inspector_page_agent.h +++ b/third_party/blink/renderer/core/inspector/inspector_page_agent.h
@@ -56,7 +56,6 @@ class InspectorResourceContentLoader; class LocalFrame; class ScriptSourceCode; -class SharedBuffer; enum class ResourceType : uint8_t; using blink::protocol::Maybe;
diff --git a/third_party/blink/renderer/core/inspector/network_resources_data.cc b/third_party/blink/renderer/core/inspector/network_resources_data.cc index a6aee756d..9b854a6 100644 --- a/third_party/blink/renderer/core/inspector/network_resources_data.cc +++ b/third_party/blink/renderer/core/inspector/network_resources_data.cc
@@ -33,7 +33,7 @@ #include "third_party/blink/renderer/platform/loader/fetch/resource.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_response.h" #include "third_party/blink/renderer/platform/network/encoded_form_data.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/core/inspector/network_resources_data.h b/third_party/blink/renderer/core/inspector/network_resources_data.h index c4945a2..25aad34 100644 --- a/third_party/blink/renderer/core/inspector/network_resources_data.h +++ b/third_party/blink/renderer/core/inspector/network_resources_data.h
@@ -46,7 +46,6 @@ class ExecutionContext; class Resource; class ResourceResponse; -class SharedBuffer; class TextResourceDecoder; class XHRReplayData final : public GarbageCollectedFinalized<XHRReplayData> {
diff --git a/third_party/blink/renderer/core/inspector/v8_inspector_string.h b/third_party/blink/renderer/core/inspector/v8_inspector_string.h index bbd05c2..c6950d9 100644 --- a/third_party/blink/renderer/core/inspector/v8_inspector_string.h +++ b/third_party/blink/renderer/core/inspector/v8_inspector_string.h
@@ -9,11 +9,11 @@ #include "third_party/blink/public/platform/web_vector.h" #include "third_party/blink/renderer/core/core_export.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" #include "third_party/blink/renderer/platform/wtf/decimal.h" #include "third_party/blink/renderer/platform/wtf/ref_counted.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "third_party/blink/renderer/platform/wtf/text/string_hash.h" #include "third_party/blink/renderer/platform/wtf/text/string_to_number.h"
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc index 89ac05d..110a93f8 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_block_layout_algorithm.cc
@@ -2096,7 +2096,8 @@ // The child broke, and we're not at the start of a fragmentainer, and we're // supposed to avoid breaking inside the child. - DCHECK(IsFirstFragment(ConstraintSpace(), physical_fragment)); + DCHECK(!physical_fragment.IsBox() || + To<NGPhysicalBoxFragment>(physical_fragment).IsFirstForNode()); return SoftBreak; }
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc index d3e1124..c3b60ee 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc
@@ -467,7 +467,8 @@ } } - CopyFragmentDataToLayoutBox(constraint_space, *layout_result); + CopyFragmentDataToLayoutBox(constraint_space, *layout_result, + To<NGBlockBreakToken>(break_token)); } MinMaxSize NGBlockNode::ComputeMinMaxSize( @@ -683,7 +684,8 @@ void NGBlockNode::CopyFragmentDataToLayoutBox( const NGConstraintSpace& constraint_space, - const NGLayoutResult& layout_result) { + const NGLayoutResult& layout_result, + const NGBlockBreakToken* previous_break_token) { if (UNLIKELY(constraint_space.IsIntermediateLayout())) return; @@ -700,18 +702,16 @@ // expected to remain the same throughout all subsequent fragments, since // legacy layout doesn't support non-uniform fragmentainer widths. LayoutUnit intrinsic_content_logical_height; - if (LIKELY(IsFirstFragment(constraint_space, physical_fragment))) { + if (LIKELY(physical_fragment.IsFirstForNode())) { box_->SetSize(LayoutSize(physical_fragment.Size().width, physical_fragment.Size().height)); } else { DCHECK_EQ(box_->LogicalWidth(), fragment_logical_size.inline_size) << "Variable fragment inline size not supported"; - box_->SetLogicalHeight( - PreviouslyUsedBlockSpace(constraint_space, physical_fragment) + - fragment_logical_size.block_size); - // TODO(layout-ng): We should store this on the break token instead of - // relying on previously-stored data. Our relayout in NGBlockNode::Layout - // will otherwise lead to wrong data. + LayoutUnit logical_height = fragment_logical_size.block_size; + if (previous_break_token) + logical_height += previous_break_token->UsedBlockSize(); + box_->SetLogicalHeight(logical_height); intrinsic_content_logical_height = box_->IntrinsicContentLogicalHeight(); } @@ -721,8 +721,11 @@ NGBoxStrut scrollbars = ComputeScrollbars(constraint_space, *this); NGBoxStrut padding = fragment.Padding(); NGBoxStrut border_scrollbar_padding = borders + scrollbars + padding; + const auto* break_token = + To<NGBlockBreakToken>(physical_fragment.BreakToken()); + bool is_last_fragment = !break_token || break_token->IsFinished(); - if (LIKELY(IsLastFragment(physical_fragment))) + if (LIKELY(is_last_fragment)) intrinsic_content_logical_height -= border_scrollbar_padding.BlockSum(); box_->SetIntrinsicContentLogicalHeight(intrinsic_content_logical_height); @@ -739,7 +742,7 @@ auto* block_flow = DynamicTo<LayoutBlockFlow>(box_); LayoutMultiColumnFlowThread* flow_thread = GetFlowThread(block_flow); if (UNLIKELY(flow_thread)) { - PlaceChildrenInFlowThread(constraint_space, physical_fragment); + PlaceChildrenInFlowThread(physical_fragment); } else { PhysicalOffset offset_from_start; if (UNLIKELY(constraint_space.HasBlockFragmentation())) { @@ -750,20 +753,17 @@ // sliced and translated into columns. // TODO(mstensho): writing modes - offset_from_start.top = - PreviouslyUsedBlockSpace(constraint_space, physical_fragment); + if (previous_break_token) + offset_from_start.top = previous_break_token->UsedBlockSize(); } - PlaceChildrenInLayoutBox(constraint_space, physical_fragment, - offset_from_start); + PlaceChildrenInLayoutBox(physical_fragment, offset_from_start); } LayoutBlock* block = DynamicTo<LayoutBlock>(box_); - if (LIKELY(block && IsLastFragment(physical_fragment))) { + if (LIKELY(block && is_last_fragment)) { LayoutUnit intrinsic_block_size = layout_result.IntrinsicBlockSize(); - if (UNLIKELY(constraint_space.HasBlockFragmentation())) { - intrinsic_block_size += - PreviouslyUsedBlockSpace(constraint_space, physical_fragment); - } + if (UNLIKELY(previous_break_token)) + intrinsic_block_size += previous_break_token->UsedBlockSize(); #if DCHECK_IS_ON() block->CheckPositionedObjectsNeedLayout(); @@ -798,7 +798,6 @@ } void NGBlockNode::PlaceChildrenInLayoutBox( - const NGConstraintSpace& constraint_space, const NGPhysicalBoxFragment& physical_fragment, const PhysicalOffset& offset_from_start) { LayoutBox* rendered_legend = nullptr; @@ -809,7 +808,7 @@ continue; const auto& box_fragment = *To<NGPhysicalBoxFragment>(child_fragment.get()); - if (IsFirstFragment(constraint_space, box_fragment)) { + if (box_fragment.IsFirstForNode()) { if (box_fragment.IsRenderedLegend()) rendered_legend = ToLayoutBox(box_fragment.GetMutableLayoutObject()); CopyChildFragmentPosition(box_fragment, child_fragment.Offset(), @@ -835,7 +834,6 @@ } void NGBlockNode::PlaceChildrenInFlowThread( - const NGConstraintSpace& constraint_space, const NGPhysicalBoxFragment& physical_fragment) { LayoutUnit flowthread_offset; for (const auto& child : physical_fragment.Children()) { @@ -848,9 +846,9 @@ // Position each child node in the first column that they occur, relatively // to the block-start of the flow thread. const auto* column = To<NGPhysicalBoxFragment>(child.get()); - PlaceChildrenInLayoutBox(constraint_space, *column, offset); - const auto* token = To<NGBlockBreakToken>(column->BreakToken()); - flowthread_offset = token->UsedBlockSize(); + PlaceChildrenInLayoutBox(*column, offset); + if (const auto* token = To<NGBlockBreakToken>(column->BreakToken())) + flowthread_offset = token->UsedBlockSize(); } }
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_node.h b/third_party/blink/renderer/core/layout/ng/ng_block_node.h index 06999d98..98872756 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_node.h +++ b/third_party/blink/renderer/core/layout/ng/ng_block_node.h
@@ -15,6 +15,7 @@ class LayoutBox; class NGBaselineRequest; +class NGBlockBreakToken; class NGBreakToken; class NGConstraintSpace; class NGBoxFragmentBuilder; @@ -159,18 +160,18 @@ // After we run the layout algorithm, this function copies back the geometry // data to the layout box. - void CopyFragmentDataToLayoutBox(const NGConstraintSpace&, - const NGLayoutResult&); + void CopyFragmentDataToLayoutBox( + const NGConstraintSpace&, + const NGLayoutResult&, + const NGBlockBreakToken* previous_break_token); void CopyFragmentDataToLayoutBoxForInlineChildren( const NGPhysicalContainerFragment& container, LayoutUnit initial_container_width, bool initial_container_is_flipped, PhysicalOffset offset = {}); - void PlaceChildrenInLayoutBox(const NGConstraintSpace&, - const NGPhysicalBoxFragment&, + void PlaceChildrenInLayoutBox(const NGPhysicalBoxFragment&, const PhysicalOffset& offset_from_start); - void PlaceChildrenInFlowThread(const NGConstraintSpace&, - const NGPhysicalBoxFragment&); + void PlaceChildrenInFlowThread(const NGPhysicalBoxFragment&); void CopyChildFragmentPosition( const NGPhysicalFragment& fragment, const PhysicalOffset fragment_offset,
diff --git a/third_party/blink/renderer/core/layout/ng/ng_fragmentation_utils.cc b/third_party/blink/renderer/core/layout/ng/ng_fragmentation_utils.cc index 9fd9dd4..6e8d97a 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_fragmentation_utils.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_fragmentation_utils.cc
@@ -12,22 +12,6 @@ namespace blink { -// Return the total amount of block space spent on a node by fragments -// preceding this one (but not including this one). -LayoutUnit PreviouslyUsedBlockSpace(const NGConstraintSpace& constraint_space, - const NGPhysicalFragment& fragment) { - if (!fragment.IsBox()) - return LayoutUnit(); - const NGPhysicalBoxFragment& box_fragment = - To<NGPhysicalBoxFragment>(fragment); - const auto* break_token = To<NGBlockBreakToken>(box_fragment.BreakToken()); - if (!break_token) - return LayoutUnit(); - NGBoxFragment logical_fragment(constraint_space.GetWritingMode(), - constraint_space.Direction(), box_fragment); - return break_token->UsedBlockSize() - logical_fragment.BlockSize(); -} - // At a class A break point [1], the break value with the highest precedence // wins. If the two values have the same precedence (e.g. "left" and "right"), // the value specified on a latter object wins.
diff --git a/third_party/blink/renderer/core/layout/ng/ng_fragmentation_utils.h b/third_party/blink/renderer/core/layout/ng/ng_fragmentation_utils.h index 0656d92..3812d1f4 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_fragmentation_utils.h +++ b/third_party/blink/renderer/core/layout/ng/ng_fragmentation_utils.h
@@ -15,32 +15,6 @@ class NGConstraintSpace; -// Return the total amount of block space spent on a node by fragments -// preceding this one (but not including this one). -LayoutUnit PreviouslyUsedBlockSpace(const NGConstraintSpace&, - const NGPhysicalFragment&); - -// Return true if the specified fragment is the first generated fragment of -// some node. -inline bool IsFirstFragment(const NGConstraintSpace& constraint_space, - const NGPhysicalFragment& fragment) { - // TODO(mstensho): Figure out how to behave for non-box fragments here. How - // can we tell whether it's the first one? Looking for previously used block - // space certainly isn't the answer. - if (!fragment.IsBox()) - return true; - return PreviouslyUsedBlockSpace(constraint_space, fragment) <= LayoutUnit(); -} - -// Return true if the specified fragment is the final fragment of some node. -inline bool IsLastFragment(const NGPhysicalFragment& fragment) { - if (!fragment.IsContainer()) - return false; - const auto* break_token = - To<NGPhysicalContainerFragment>(fragment).BreakToken(); - return !break_token || break_token->IsFinished(); -} - // Join two adjacent break values specified on break-before and/or break- // after. avoid* values win over auto values, and forced break values win over // avoid* values. |first_value| is specified on an element earlier in the flow
diff --git a/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.cc b/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.cc index 3b0ec892..3e6824ca 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.cc
@@ -95,6 +95,9 @@ has_padding_ = !padding.IsZero(); if (has_padding_) *const_cast<NGPhysicalBoxStrut*>(ComputePaddingAddress()) = padding; + // used_block_size_ is only updated if we're in block fragmentation. Otherwise + // it will always be 0. + is_first_for_node_ = builder->used_block_size_ <= builder->size_.block_size; is_fieldset_container_ = builder->is_fieldset_container_; is_legacy_layout_root_ = builder->is_legacy_layout_root_; border_edge_ = builder->border_edges_.ToPhysical(builder->GetWritingMode());
diff --git a/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h b/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h index 02e7b97..5ab1d63 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h +++ b/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h
@@ -87,6 +87,9 @@ unsigned BorderEdges() const { return border_edge_; } NGPixelSnappedPhysicalBoxStrut BorderWidths() const; + // Return true if this is the first fragment generated from a node. + bool IsFirstForNode() const { return is_first_for_node_; } + #if DCHECK_IS_ON() void CheckSameForSimplifiedLayout(const NGPhysicalBoxFragment&, bool check_same_block_size) const;
diff --git a/third_party/blink/renderer/core/layout/ng/ng_physical_fragment.h b/third_party/blink/renderer/core/layout/ng/ng_physical_fragment.h index bd957be6..9311bed 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_physical_fragment.h +++ b/third_party/blink/renderer/core/layout/ng/ng_physical_fragment.h
@@ -314,6 +314,7 @@ unsigned border_edge_ : 4; // NGBorderEdges::Physical unsigned has_borders_ : 1; unsigned has_padding_ : 1; + unsigned is_first_for_node_ : 1; // The following are only used by NGPhysicalBoxFragment but are initialized // for all types to allow methods using them to be inlined.
diff --git a/third_party/blink/renderer/core/loader/document_loader.h b/third_party/blink/renderer/core/loader/document_loader.h index 2bc49cd..ad1eac2 100644 --- a/third_party/blink/renderer/core/loader/document_loader.h +++ b/third_party/blink/renderer/core/loader/document_loader.h
@@ -63,9 +63,9 @@ #include "third_party/blink/renderer/platform/loader/fetch/resource_response.h" #include "third_party/blink/renderer/platform/loader/fetch/source_keyed_cached_metadata_handler.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/referrer.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include <memory> @@ -293,6 +293,11 @@ bool IsBrowserInitiated() const { return is_browser_initiated_; } + // TODO(dcheng, japhet): Some day, Document::Url() will always match + // DocumentLoader::Url(), and one of them will be removed. Today is not that + // day though. + void UpdateUrlForDocumentOpen(const KURL& url) { url_ = url; } + protected: Vector<KURL> redirect_chain_;
diff --git a/third_party/blink/renderer/core/loader/document_loader_test.cc b/third_party/blink/renderer/core/loader/document_loader_test.cc index 7304331..a255c57c 100644 --- a/third_party/blink/renderer/core/loader/document_loader_test.cc +++ b/third_party/blink/renderer/core/loader/document_loader_test.cc
@@ -15,6 +15,8 @@ #include "third_party/blink/renderer/core/frame/web_local_frame_impl.h" #include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/testing/scoped_fake_plugin_registry.h" +#include "third_party/blink/renderer/core/testing/sim/sim_request.h" +#include "third_party/blink/renderer/core/testing/sim/sim_test.h" #include "third_party/blink/renderer/platform/loader/static_data_navigation_body_loader.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" #include "third_party/blink/renderer/platform/testing/url_test_helpers.h" @@ -219,4 +221,35 @@ ->GetMixedAutoUpgradeOptOut()); } +class DocumentLoaderSimTest : public SimTest {}; + +TEST_F(DocumentLoaderSimTest, DocumentOpenUpdatesUrl) { + SimRequest main_resource("https://example.com", "text/html"); + LoadURL("https://example.com"); + main_resource.Write("<iframe src='javascript:42;'></iframe>"); + + auto* child_frame = To<WebLocalFrameImpl>(MainFrame().FirstChild()); + auto* child_document = child_frame->GetFrame()->GetDocument(); + EXPECT_TRUE(child_document->HasPendingJavaScriptUrlsForTest()); + + main_resource.Write( + "<script>" + "window[0].document.open();" + "window[0].document.write('hello');" + "window[0].document.close();" + "</script>"); + + main_resource.Finish(); + + // document.open() should have cancelled the pending JavaScript URLs. + EXPECT_FALSE(child_document->HasPendingJavaScriptUrlsForTest()); + + // Per https://whatwg.org/C/dynamic-markup-insertion.html#document-open-steps, + // the URL associated with the Document should match the URL of the entry + // Document. + EXPECT_EQ(KURL("https://example.com"), child_document->Url()); + // Similarly, the URL of the DocumentLoader should also match. + EXPECT_EQ(KURL("https://example.com"), child_document->Loader()->Url()); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/loader/resource/document_resource.cc b/third_party/blink/renderer/core/loader/resource/document_resource.cc index 1ad946d..15bbee3 100644 --- a/third_party/blink/renderer/core/loader/resource/document_resource.cc +++ b/third_party/blink/renderer/core/loader/resource/document_resource.cc
@@ -28,7 +28,7 @@ #include "third_party/blink/renderer/platform/loader/fetch/fetch_parameters.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h" #include "third_party/blink/renderer/platform/loader/fetch/text_resource_decoder_options.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" namespace blink {
diff --git a/third_party/blink/renderer/core/loader/resource/font_resource.cc b/third_party/blink/renderer/core/loader/resource/font_resource.cc index da71a4969..24d02ddd4b 100644 --- a/third_party/blink/renderer/core/loader/resource/font_resource.cc +++ b/third_party/blink/renderer/core/loader/resource/font_resource.cc
@@ -34,8 +34,8 @@ #include "third_party/blink/renderer/platform/loader/fetch/resource_client_walker.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_loader.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/functional.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/core/loader/resource/image_resource.cc b/third_party/blink/renderer/core/loader/resource/image_resource.cc index 5f71264..31f7817 100644 --- a/third_party/blink/renderer/core/loader/resource/image_resource.cc +++ b/third_party/blink/renderer/core/loader/resource/image_resource.cc
@@ -47,10 +47,10 @@ #include "third_party/blink/renderer/platform/network/http_parsers.h" #include "third_party/blink/renderer/platform/network/network_utils.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/weborigin/security_violation_reporting_policy.h" #include "third_party/blink/renderer/platform/wtf/functional.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" #include "v8/include/v8.h"
diff --git a/third_party/blink/renderer/core/loader/resource/image_resource_content.cc b/third_party/blink/renderer/core/loader/resource/image_resource_content.cc index 04b8d7d..dc6f000 100644 --- a/third_party/blink/renderer/core/loader/resource/image_resource_content.cc +++ b/third_party/blink/renderer/core/loader/resource/image_resource_content.cc
@@ -18,7 +18,7 @@ #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/network/http_parsers.h" #include "third_party/blink/renderer/platform/network/mime/mime_type_registry.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" #include "third_party/blink/renderer/platform/wtf/vector.h" #include "v8/include/v8.h"
diff --git a/third_party/blink/renderer/core/loader/resource/image_resource_test.cc b/third_party/blink/renderer/core/loader/resource/image_resource_test.cc index f3de598c..d08be31 100644 --- a/third_party/blink/renderer/core/loader/resource/image_resource_test.cc +++ b/third_party/blink/renderer/core/loader/resource/image_resource_test.cc
@@ -62,11 +62,11 @@ #include "third_party/blink/renderer/platform/network/http_names.h" #include "third_party/blink/renderer/platform/scheduler/test/fake_frame_scheduler.h" #include "third_party/blink/renderer/platform/scheduler/test/fake_task_runner.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" #include "third_party/blink/renderer/platform/testing/scoped_mocked_url.h" #include "third_party/blink/renderer/platform/testing/testing_platform_support_with_mock_scheduler.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/base64.h" namespace blink {
diff --git a/third_party/blink/renderer/core/loader/resource/script_resource.cc b/third_party/blink/renderer/core/loader/resource/script_resource.cc index dec020f..b362933 100644 --- a/third_party/blink/renderer/core/loader/resource/script_resource.cc +++ b/third_party/blink/renderer/core/loader/resource/script_resource.cc
@@ -47,8 +47,8 @@ #include "third_party/blink/renderer/platform/loader/subresource_integrity.h" #include "third_party/blink/renderer/platform/network/mime/mime_type_registry.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/functional.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/core/loader/resource/text_resource.cc b/third_party/blink/renderer/core/loader/resource/text_resource.cc index f63a0ab2..8da9c848 100644 --- a/third_party/blink/renderer/core/loader/resource/text_resource.cc +++ b/third_party/blink/renderer/core/loader/resource/text_resource.cc
@@ -6,7 +6,7 @@ #include "third_party/blink/renderer/core/html/parser/text_resource_decoder.h" #include "third_party/blink/renderer/platform/loader/fetch/text_resource_decoder_options.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" namespace blink {
diff --git a/third_party/blink/renderer/core/loader/text_track_loader.cc b/third_party/blink/renderer/core/loader/text_track_loader.cc index 0c16de8..c90e386 100644 --- a/third_party/blink/renderer/core/loader/text_track_loader.cc +++ b/third_party/blink/renderer/core/loader/text_track_loader.cc
@@ -35,8 +35,8 @@ #include "third_party/blink/renderer/platform/loader/fetch/raw_resource.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/core/loader/threadable_loader.cc b/third_party/blink/renderer/core/loader/threadable_loader.cc index b8d1f4b..3794fc7 100644 --- a/third_party/blink/renderer/core/loader/threadable_loader.cc +++ b/third_party/blink/renderer/core/loader/threadable_loader.cc
@@ -67,11 +67,11 @@ #include "third_party/blink/renderer/platform/loader/fetch/resource_loader.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_request.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/scheme_registry.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/weborigin/security_policy.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/core/messaging/blink_transferable_message_mojom_traits_test.cc b/third_party/blink/renderer/core/messaging/blink_transferable_message_mojom_traits_test.cc index c70aa78..30af6e2 100644 --- a/third_party/blink/renderer/core/messaging/blink_transferable_message_mojom_traits_test.cc +++ b/third_party/blink/renderer/core/messaging/blink_transferable_message_mojom_traits_test.cc
@@ -155,7 +155,7 @@ // The original bitmap's height and width will be 0 after it is transferred. size_t original_bitmap_height = original_bitmap->height(); size_t original_bitmap_width = original_bitmap->width(); - scoped_refptr<blink::SharedBuffer> original_bitmap_data = + scoped_refptr<SharedBuffer> original_bitmap_data = original_bitmap->BitmapImage()->Data(); v8::Local<v8::Value> wrapper = ToV8(original_bitmap, scope.GetScriptState()); Transferables transferables;
diff --git a/third_party/blink/renderer/core/mojo/tests/js_to_cpp_test.cc b/third_party/blink/renderer/core/mojo/tests/js_to_cpp_test.cc index 92b556a..b924f4ae 100644 --- a/third_party/blink/renderer/core/mojo/tests/js_to_cpp_test.cc +++ b/third_party/blink/renderer/core/mojo/tests/js_to_cpp_test.cc
@@ -16,8 +16,8 @@ #include "third_party/blink/renderer/core/mojo/mojo_handle.h" #include "third_party/blink/renderer/core/mojo/tests/JsToCpp.mojom-blink.h" #include "third_party/blink/renderer/core/page/page.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink { namespace {
diff --git a/third_party/blink/renderer/core/page/drag_controller.cc b/third_party/blink/renderer/core/page/drag_controller.cc index 84fc4750..ac8e3581 100644 --- a/third_party/blink/renderer/core/page/drag_controller.cc +++ b/third_party/blink/renderer/core/page/drag_controller.cc
@@ -91,9 +91,9 @@ #include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_request.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #if defined(OS_WIN) #include <windows.h>
diff --git a/third_party/blink/renderer/core/page/page_popup_client.h b/third_party/blink/renderer/core/page/page_popup_client.h index 98ee6143..f18a61e9 100644 --- a/third_party/blink/renderer/core/page/page_popup_client.h +++ b/third_party/blink/renderer/core/page/page_popup_client.h
@@ -33,7 +33,7 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/geometry/int_rect.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/string_utf8_adaptor.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
diff --git a/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator_test.cc b/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator_test.cc index 1e4799a9..866e4233 100644 --- a/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator_test.cc +++ b/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator_test.cc
@@ -1907,11 +1907,6 @@ TEST_P(PaintNonFastScrollableRegionsScrollingCoordinatorTest, NonCompositedResizerNonFastScrollableRegion) { - // TODO(pdr): Paint non-fast scrollable regions for resizers - // (crbug.com/864567). - if (RuntimeEnabledFeatures::PaintNonFastScrollableRegionsEnabled()) - return; - GetWebView()->GetPage()->GetSettings().SetPreferCompositingToLCDTextEnabled( false); LoadHTML(R"HTML( @@ -1925,6 +1920,7 @@ } </style> <div id="container"> + <div id="offset" style="height: 35px;"></div> <div id="scroller"></div> </div> )HTML"); @@ -1940,15 +1936,11 @@ // when the container moves and not when the viewport scrolls. auto region = container_graphics_layer->CcLayer()->non_fast_scrollable_region(); - EXPECT_EQ(region.bounds(), gfx::Rect(66, 66, 14, 14)); + EXPECT_EQ(region.bounds(), gfx::Rect(66, 101, 14, 14)); } TEST_P(PaintNonFastScrollableRegionsScrollingCoordinatorTest, CompositedResizerNonFastScrollableRegion) { - // TODO(pdr): Paint non-fast scrollable regions for resizers - // (crbug.com/864567). - if (RuntimeEnabledFeatures::PaintNonFastScrollableRegionsEnabled()) - return; LoadHTML(R"HTML( <style> #container { will-change: transform; } @@ -1961,6 +1953,7 @@ } </style> <div id="container"> + <div id="offset" style="height: 35px;"></div> <div id="scroller"></div> </div> )HTML");
diff --git a/third_party/blink/renderer/core/paint/block_painter.cc b/third_party/blink/renderer/core/paint/block_painter.cc index 88f8ef5..9943803 100644 --- a/third_party/blink/renderer/core/paint/block_painter.cc +++ b/third_party/blink/renderer/core/paint/block_painter.cc
@@ -27,6 +27,10 @@ if (!ShouldPaint(paint_state)) return; + DCHECK( + !layout_block_.PaintBlockedByDisplayLock(DisplayLockContext::kChildren) || + paint_info.DescendantPaintingBlocked()); + auto paint_offset = paint_state.PaintOffset(); auto& local_paint_info = paint_state.MutablePaintInfo(); PaintPhase original_phase = local_paint_info.phase; @@ -110,7 +114,7 @@ } void BlockPainter::PaintChildren(const PaintInfo& paint_info) { - if (layout_block_.PaintBlockedByDisplayLock(DisplayLockContext::kChildren)) + if (paint_info.DescendantPaintingBlocked()) return; // We may use legacy paint to paint the anonymous fieldset child. The layout @@ -156,7 +160,7 @@ void BlockPainter::PaintChildrenAtomically(const OrderIterator& order_iterator, const PaintInfo& paint_info) { - if (layout_block_.PaintBlockedByDisplayLock(DisplayLockContext::kChildren)) + if (paint_info.DescendantPaintingBlocked()) return; for (const LayoutBox* child = order_iterator.First(); child; child = order_iterator.Next()) { @@ -166,7 +170,7 @@ void BlockPainter::PaintAllChildPhasesAtomically(const LayoutBox& child, const PaintInfo& paint_info) { - if (layout_block_.PaintBlockedByDisplayLock(DisplayLockContext::kChildren)) + if (paint_info.DescendantPaintingBlocked()) return; if (!child.HasSelfPaintingLayer() && !child.IsFloating()) ObjectPainter(child).PaintAllPhasesAtomically(paint_info); @@ -222,7 +226,7 @@ if (paint_phase != PaintPhase::kSelfOutlineOnly && paint_phase != PaintPhase::kSelfBlockBackgroundOnly && paint_phase != PaintPhase::kMask && - !layout_block_.PaintBlockedByDisplayLock(DisplayLockContext::kChildren)) { + !paint_info.DescendantPaintingBlocked()) { // Actually paint the contents. if (layout_block_.IsLayoutBlockFlow()) { // All floating descendants will be LayoutBlockFlow objects, and will get
diff --git a/third_party/blink/renderer/core/paint/box_painter.cc b/third_party/blink/renderer/core/paint/box_painter.cc index 7c625b0..645f5be 100644 --- a/third_party/blink/renderer/core/paint/box_painter.cc +++ b/third_party/blink/renderer/core/paint/box_painter.cc
@@ -41,7 +41,7 @@ } void BoxPainter::PaintChildren(const PaintInfo& paint_info) { - if (layout_box_.PaintBlockedByDisplayLock(DisplayLockContext::kChildren)) + if (paint_info.DescendantPaintingBlocked()) return; PaintInfo child_info(paint_info);
diff --git a/third_party/blink/renderer/core/paint/frame_set_painter.cc b/third_party/blink/renderer/core/paint/frame_set_painter.cc index e36e0c2..c9dd8dc 100644 --- a/third_party/blink/renderer/core/paint/frame_set_painter.cc +++ b/third_party/blink/renderer/core/paint/frame_set_painter.cc
@@ -127,10 +127,8 @@ } void FrameSetPainter::PaintChildren(const PaintInfo& paint_info) { - if (layout_frame_set_.PaintBlockedByDisplayLock( - DisplayLockContext::kChildren)) { + if (paint_info.DescendantPaintingBlocked()) return; - } // Paint only those children that fit in the grid. // Remaining frames are "hidden".
diff --git a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc index f10650c..21551923 100644 --- a/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc +++ b/third_party/blink/renderer/core/paint/ng/ng_box_fragment_painter.cc
@@ -276,8 +276,7 @@ if (paint_phase != PaintPhase::kSelfOutlineOnly && !physical_box_fragment.Children().empty() && - !box_fragment_.GetLayoutObject()->PaintBlockedByDisplayLock( - DisplayLockContext::kChildren)) { + !paint_info.DescendantPaintingBlocked()) { if (physical_box_fragment.ChildrenInline()) { DCHECK(paint_fragment_); if (paint_phase != PaintPhase::kFloat) {
diff --git a/third_party/blink/renderer/core/paint/paint_info.h b/third_party/blink/renderer/core/paint/paint_info.h index ef8d43a4..06aeff5 100644 --- a/third_party/blink/renderer/core/paint/paint_info.h +++ b/third_party/blink/renderer/core/paint/paint_info.h
@@ -70,7 +70,8 @@ fragment_logical_top_in_flow_thread), paint_flags_(paint_flags), global_paint_flags_(global_paint_flags), - is_painting_scrolling_background_(false) {} + is_painting_scrolling_background_(false), + descendant_painting_blocked_(false) {} PaintInfo(GraphicsContext& new_context, const PaintInfo& copy_other_fields_from) @@ -82,7 +83,8 @@ copy_other_fields_from.fragment_logical_top_in_flow_thread_), paint_flags_(copy_other_fields_from.paint_flags_), global_paint_flags_(copy_other_fields_from.global_paint_flags_), - is_painting_scrolling_background_(false) { + is_painting_scrolling_background_(false), + descendant_painting_blocked_(false) { // We should never pass is_painting_scrolling_background_ other PaintInfo. DCHECK(!copy_other_fields_from.is_painting_scrolling_background_); } @@ -176,6 +178,13 @@ is_painting_scrolling_background_ = b; } + bool DescendantPaintingBlocked() const { + return descendant_painting_blocked_; + } + void SetDescendantPaintingBlocked(bool blocked) { + descendant_painting_blocked_ = blocked; + } + // FIXME: Introduce setters/getters at some point. Requires a lot of changes // throughout paint/. GraphicsContext& context; @@ -195,7 +204,10 @@ const GlobalPaintFlags global_paint_flags_; // For CAP only. - bool is_painting_scrolling_background_; + bool is_painting_scrolling_background_ : 1; + + // Used by display-locking. + bool descendant_painting_blocked_ : 1; }; Image::ImageDecodingMode GetImageDecodingMode(Node*);
diff --git a/third_party/blink/renderer/core/paint/paint_layer_painter.cc b/third_party/blink/renderer/core/paint/paint_layer_painter.cc index 3341c7874..0c26d37 100644 --- a/third_party/blink/renderer/core/paint/paint_layer_painter.cc +++ b/third_party/blink/renderer/core/paint/paint_layer_painter.cc
@@ -783,6 +783,10 @@ fragment.fragment_data ? fragment.fragment_data->LogicalTopInFlowThread() : LayoutUnit()); + if (UNLIKELY(paint_layer_.GetLayoutObject().PaintBlockedByDisplayLock( + DisplayLockContext::kChildren))) { + paint_info.SetDescendantPaintingBlocked(true); + } paint_layer_.GetLayoutObject().Paint(paint_info); }
diff --git a/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc b/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc index b75eb409..e2f49a6 100644 --- a/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc +++ b/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc
@@ -145,7 +145,8 @@ GetScrollAnimator().SetCurrentOffset(scroll_offset_); element->SetSavedLayerScrollOffset(ScrollOffset()); } - UpdateResizerAreaSet(); + if (!RuntimeEnabledFeatures::PaintNonFastScrollableRegionsEnabled()) + UpdateResizerAreaSet(); } PaintLayerScrollableArea::~PaintLayerScrollableArea() { @@ -184,9 +185,11 @@ element->SetSavedLayerScrollOffset(scroll_offset_); } - if (LocalFrame* frame = GetLayoutBox()->GetFrame()) { - if (LocalFrameView* frame_view = frame->View()) - frame_view->RemoveResizerArea(*GetLayoutBox()); + if (!RuntimeEnabledFeatures::PaintNonFastScrollableRegionsEnabled()) { + if (LocalFrame* frame = GetLayoutBox()->GetFrame()) { + if (LocalFrameView* frame_view = frame->View()) + frame_view->RemoveResizerArea(*GetLayoutBox()); + } } // Note: it is not safe to call ScrollAnchor::clear if the document is being @@ -1221,7 +1224,8 @@ VerticalScrollbar()->StyleChanged(); UpdateScrollCornerStyle(); - UpdateResizerAreaSet(); + if (!RuntimeEnabledFeatures::PaintNonFastScrollableRegionsEnabled()) + UpdateResizerAreaSet(); UpdateResizerStyle(old_style); }
diff --git a/third_party/blink/renderer/core/paint/scrollable_area_painter.cc b/third_party/blink/renderer/core/paint/scrollable_area_painter.cc index 6bb2c7e7..d4361da 100644 --- a/third_party/blink/renderer/core/paint/scrollable_area_painter.cc +++ b/third_party/blink/renderer/core/paint/scrollable_area_painter.cc
@@ -18,6 +18,7 @@ #include "third_party/blink/renderer/platform/graphics/graphics_layer.h" #include "third_party/blink/renderer/platform/graphics/paint/drawing_recorder.h" #include "third_party/blink/renderer/platform/graphics/paint/scoped_paint_chunk_properties.h" +#include "third_party/blink/renderer/platform/graphics/paint/scroll_hit_test_display_item.h" namespace blink { @@ -35,6 +36,18 @@ return; abs_rect.MoveBy(paint_offset); + const auto& client = DisplayItemClientForCorner(); + if (RuntimeEnabledFeatures::PaintNonFastScrollableRegionsEnabled()) { + IntRect touch_rect = scrollable_area_->ResizerCornerRect( + GetScrollableArea().GetLayoutBox()->PixelSnappedBorderBoxRect( + scrollable_area_->Layer()->SubpixelAccumulation()), + kResizerForTouch); + touch_rect.MoveBy(paint_offset); + ScrollHitTestDisplayItem::Record(context, client, + DisplayItem::kResizerScrollHitTest, + nullptr, touch_rect); + } + if (const auto* resizer = GetScrollableArea().Resizer()) { if (!cull_rect.Intersects(abs_rect)) return; @@ -44,7 +57,6 @@ return; } - const auto& client = DisplayItemClientForCorner(); if (DrawingRecorder::UseCachedDrawingIfPossible(context, client, DisplayItem::kResizer)) return;
diff --git a/third_party/blink/renderer/core/paint/table_painter.cc b/third_party/blink/renderer/core/paint/table_painter.cc index a136ca85..2333050 100644 --- a/third_party/blink/renderer/core/paint/table_painter.cc +++ b/third_party/blink/renderer/core/paint/table_painter.cc
@@ -30,7 +30,8 @@ return; } - if (paint_phase != PaintPhase::kSelfOutlineOnly) { + if (paint_phase != PaintPhase::kSelfOutlineOnly && + !paint_info.DescendantPaintingBlocked()) { PaintInfo paint_info_for_descendants = paint_info.ForDescendants(); for (LayoutObject* child = layout_table_.FirstChild(); child;
diff --git a/third_party/blink/renderer/core/svg/graphics/svg_image_test.cc b/third_party/blink/renderer/core/svg/graphics/svg_image_test.cc index 078ece6..9978206 100644 --- a/third_party/blink/renderer/core/svg/graphics/svg_image_test.cc +++ b/third_party/blink/renderer/core/svg/graphics/svg_image_test.cc
@@ -21,9 +21,9 @@ #include "third_party/blink/renderer/platform/geometry/float_rect.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_canvas.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_flags.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" #include "third_party/blink/renderer/platform/timer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/utils/SkNullCanvas.h"
diff --git a/third_party/blink/renderer/core/testing/page_test_base.cc b/third_party/blink/renderer/core/testing/page_test_base.cc index 55577cb8..8a4a4d8 100644 --- a/third_party/blink/renderer/core/testing/page_test_base.cc +++ b/third_party/blink/renderer/core/testing/page_test_base.cc
@@ -14,8 +14,8 @@ #include "third_party/blink/renderer/core/frame/local_frame_view.h" #include "third_party/blink/renderer/core/frame/settings.h" #include "third_party/blink/renderer/core/html/html_element.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.cc b/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.cc index dd38aed..e40002e 100644 --- a/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.cc +++ b/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.cc
@@ -7,7 +7,7 @@ #include "base/memory/scoped_refptr.h" #include "third_party/blink/renderer/platform/bindings/dom_data_store.h" #include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/vector.h" namespace blink {
diff --git a/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h b/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h index 6d579076..e4b0699b 100644 --- a/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h +++ b/third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h
@@ -13,8 +13,6 @@ namespace blink { -class SharedBuffer; - class CORE_EXPORT DOMArrayBuffer final : public DOMArrayBufferBase { DEFINE_WRAPPERTYPEINFO();
diff --git a/third_party/blink/renderer/core/xml/parser/shared_buffer_reader.cc b/third_party/blink/renderer/core/xml/parser/shared_buffer_reader.cc index e9e9477..cbe28221 100644 --- a/third_party/blink/renderer/core/xml/parser/shared_buffer_reader.cc +++ b/third_party/blink/renderer/core/xml/parser/shared_buffer_reader.cc
@@ -31,7 +31,7 @@ #include "third_party/blink/renderer/core/xml/parser/shared_buffer_reader.h" #include "base/memory/scoped_refptr.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include <algorithm> #include <cstring>
diff --git a/third_party/blink/renderer/core/xml/parser/shared_buffer_reader.h b/third_party/blink/renderer/core/xml/parser/shared_buffer_reader.h index 02218b2..8339b75 100644 --- a/third_party/blink/renderer/core/xml/parser/shared_buffer_reader.h +++ b/third_party/blink/renderer/core/xml/parser/shared_buffer_reader.h
@@ -38,8 +38,6 @@ namespace blink { -class SharedBuffer; - // Allows transfer of data in multiple chunks from a SharedBuffer to a provided // buffer. class CORE_EXPORT SharedBufferReader {
diff --git a/third_party/blink/renderer/core/xml/parser/shared_buffer_reader_test.cc b/third_party/blink/renderer/core/xml/parser/shared_buffer_reader_test.cc index 3a9c3bfe..353867f 100644 --- a/third_party/blink/renderer/core/xml/parser/shared_buffer_reader_test.cc +++ b/third_party/blink/renderer/core/xml/parser/shared_buffer_reader_test.cc
@@ -33,7 +33,7 @@ #include <algorithm> #include <cstdlib> #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc b/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc index bff4f12d..f7aae421 100644 --- a/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc +++ b/third_party/blink/renderer/core/xml/parser/xml_document_parser.cc
@@ -73,8 +73,8 @@ #include "third_party/blink/renderer/platform/loader/fetch/resource_request.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_response.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/utf8.h" #include "third_party/blink/renderer/platform/wtf/threading.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
diff --git a/third_party/blink/renderer/core/xml/xslt_processor_libxslt.cc b/third_party/blink/renderer/core/xml/xslt_processor_libxslt.cc index 357492e..16bd924 100644 --- a/third_party/blink/renderer/core/xml/xslt_processor_libxslt.cc +++ b/third_party/blink/renderer/core/xml/xslt_processor_libxslt.cc
@@ -46,10 +46,10 @@ #include "third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_request.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_response.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/wtf/allocator/partitions.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/string_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/utf8.h"
diff --git a/third_party/blink/renderer/core/xmlhttprequest/xml_http_request.cc b/third_party/blink/renderer/core/xmlhttprequest/xml_http_request.cc index 49fb860f4..1a9ba17 100644 --- a/third_party/blink/renderer/core/xmlhttprequest/xml_http_request.cc +++ b/third_party/blink/renderer/core/xmlhttprequest/xml_http_request.cc
@@ -86,11 +86,11 @@ #include "third_party/blink/renderer/platform/network/network_log.h" #include "third_party/blink/renderer/platform/network/parsed_content_type.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/weborigin/security_policy.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
diff --git a/third_party/blink/renderer/core/xmlhttprequest/xml_http_request.h b/third_party/blink/renderer/core/xmlhttprequest/xml_http_request.h index 54f9ce9..e7c52a8 100644 --- a/third_party/blink/renderer/core/xmlhttprequest/xml_http_request.h +++ b/third_party/blink/renderer/core/xmlhttprequest/xml_http_request.h
@@ -61,7 +61,6 @@ class ExecutionContext; class FormData; class ScriptState; -class SharedBuffer; class TextResourceDecoder; class ThreadableLoader; class URLSearchParams;
diff --git a/third_party/blink/renderer/modules/accessibility/testing/accessibility_selection_test.cc b/third_party/blink/renderer/modules/accessibility/testing/accessibility_selection_test.cc index b632fed77..63ed142 100644 --- a/third_party/blink/renderer/modules/accessibility/testing/accessibility_selection_test.cc +++ b/third_party/blink/renderer/modules/accessibility/testing/accessibility_selection_test.cc
@@ -21,8 +21,8 @@ #include "third_party/blink/renderer/modules/accessibility/ax_position.h" #include "third_party/blink/renderer/modules/accessibility/ax_selection.h" #include "third_party/blink/renderer/platform/heap/handle.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
diff --git a/third_party/blink/renderer/modules/cache_storage/inspector_cache_storage_agent.cc b/third_party/blink/renderer/modules/cache_storage/inspector_cache_storage_agent.cc index 78011ec..133151d 100644 --- a/third_party/blink/renderer/modules/cache_storage/inspector_cache_storage_agent.cc +++ b/third_party/blink/renderer/modules/cache_storage/inspector_cache_storage_agent.cc
@@ -29,13 +29,12 @@ #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/network/http_header_map.h" #include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/ref_counted.h" - +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/vector.h" using blink::protocol::Array;
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_test.cc b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_test.cc index 8598911..2f1d4ae6 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_test.cc +++ b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_test.cc
@@ -37,9 +37,9 @@ #include "third_party/blink/renderer/platform/graphics/test/fake_web_graphics_context_3d_provider.h" #include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/loader/fetch/memory_cache.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkSurface.h" #include "third_party/skia/include/third_party/skcms/skcms.h"
diff --git a/third_party/blink/renderer/modules/contacts_picker/contacts_manager.idl b/third_party/blink/renderer/modules/contacts_picker/contacts_manager.idl index 23d943b..fb3cdd5 100644 --- a/third_party/blink/renderer/modules/contacts_picker/contacts_manager.idl +++ b/third_party/blink/renderer/modules/contacts_picker/contacts_manager.idl
@@ -9,5 +9,5 @@ SecureContext, RuntimeEnabled=ContactsManager ] interface ContactsManager { - [CallWith=ScriptState] Promise<sequence<ContactInfo>> select(sequence<ContactProperty> properties, optional ContactsSelectOptions options); + [CallWith=ScriptState, MeasureAs=ContactsManagerSelect] Promise<sequence<ContactInfo>> select(sequence<ContactProperty> properties, optional ContactsSelectOptions options); };
diff --git a/third_party/blink/renderer/modules/encryptedmedia/media_key_status_map.cc b/third_party/blink/renderer/modules/encryptedmedia/media_key_status_map.cc index bd6825d..11569cd 100644 --- a/third_party/blink/renderer/modules/encryptedmedia/media_key_status_map.cc +++ b/third_party/blink/renderer/modules/encryptedmedia/media_key_status_map.cc
@@ -8,7 +8,7 @@ #include "third_party/blink/renderer/bindings/core/v8/array_buffer_or_array_buffer_view.h" #include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h" #include "third_party/blink/renderer/core/typed_arrays/dom_array_piece.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include <algorithm>
diff --git a/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.cc b/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.cc index b08a408..10bd9be 100644 --- a/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.cc +++ b/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.cc
@@ -67,11 +67,11 @@ #include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher_properties.h" #include "third_party/blink/renderer/platform/network/network_utils.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/weborigin/security_policy.h" #include "third_party/blink/renderer/platform/wtf/functional.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/vector.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_key.h b/third_party/blink/renderer/modules/indexeddb/idb_key.h index 819974c..73dc8eba 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_key.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_key.h
@@ -34,9 +34,9 @@ #include "base/memory/scoped_refptr.h" #include "third_party/blink/public/mojom/indexeddb/indexeddb.mojom-shared.h" #include "third_party/blink/renderer/modules/modules_export.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/forward.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_object_store.cc b/third_party/blink/renderer/modules/indexeddb/idb_object_store.cc index 097736b..92794d0 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_object_store.cc +++ b/third_party/blink/renderer/modules/indexeddb/idb_object_store.cc
@@ -49,7 +49,7 @@ #include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/instrumentation/histogram.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "v8/include/v8.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_request.cc b/third_party/blink/renderer/modules/indexeddb/idb_request.cc index f49f72f..35c4912 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_request.cc +++ b/third_party/blink/renderer/modules/indexeddb/idb_request.cc
@@ -53,8 +53,8 @@ #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/heap.h" #include "third_party/blink/renderer/platform/instrumentation/histogram.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/functional.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_request_test.cc b/third_party/blink/renderer/modules/indexeddb/idb_request_test.cc index c982a6e7..53e97f43 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_request_test.cc +++ b/third_party/blink/renderer/modules/indexeddb/idb_request_test.cc
@@ -57,9 +57,9 @@ #include "third_party/blink/renderer/modules/indexeddb/web_idb_callbacks.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/heap/heap.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/testing_platform_support.h" #include "third_party/blink/renderer/platform/wtf/dtoa/utils.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/vector.h" #include "v8/include/v8.h"
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_test_helper.cc b/third_party/blink/renderer/modules/indexeddb/idb_test_helper.cc index 9345b90..9c88961 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_test_helper.cc +++ b/third_party/blink/renderer/modules/indexeddb/idb_test_helper.cc
@@ -12,7 +12,7 @@ #include "third_party/blink/renderer/modules/indexeddb/idb_key_path.h" #include "third_party/blink/renderer/modules/indexeddb/idb_value_wrapping.h" #include "third_party/blink/renderer/platform/blob/blob_data.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/vector.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_transaction_test.cc b/third_party/blink/renderer/modules/indexeddb/idb_transaction_test.cc index 170b823..a599928 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_transaction_test.cc +++ b/third_party/blink/renderer/modules/indexeddb/idb_transaction_test.cc
@@ -53,8 +53,8 @@ #include "third_party/blink/renderer/modules/indexeddb/mock_web_idb_database.h" #include "third_party/blink/renderer/modules/indexeddb/mock_web_idb_transaction.h" #include "third_party/blink/renderer/platform/heap/heap.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/testing_platform_support.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "v8/include/v8.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_value.h b/third_party/blink/renderer/modules/indexeddb/idb_value.h index c70e8c2..e8f39091 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_value.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_value.h
@@ -12,7 +12,7 @@ #include "third_party/blink/renderer/modules/indexeddb/idb_key.h" #include "third_party/blink/renderer/modules/indexeddb/idb_key_path.h" #include "third_party/blink/renderer/modules/modules_export.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_value_wrapping.h b/third_party/blink/renderer/modules/indexeddb/idb_value_wrapping.h index 990e9b5f..28a88bcd 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_value_wrapping.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_value_wrapping.h
@@ -11,8 +11,8 @@ #include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h" #include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/string_view.h" #include "third_party/blink/renderer/platform/wtf/vector.h" #include "v8/include/v8.h" @@ -26,7 +26,6 @@ class ScriptState; class ScriptValue; class SerializedScriptValue; -class SharedBuffer; const base::Feature kIndexedDBLargeValueWrapping{ "IndexedDBLargeValueWrapping", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/third_party/blink/renderer/modules/indexeddb/indexed_db_blink_mojom_traits.cc b/third_party/blink/renderer/modules/indexeddb/indexed_db_blink_mojom_traits.cc index df898d69..60ba099 100644 --- a/third_party/blink/renderer/modules/indexeddb/indexed_db_blink_mojom_traits.cc +++ b/third_party/blink/renderer/modules/indexeddb/indexed_db_blink_mojom_traits.cc
@@ -122,7 +122,7 @@ case blink::mojom::IDBKeyDataDataView::Tag::BINARY: { ArrayDataView<uint8_t> bytes; data.GetBinaryDataView(&bytes); - *out = blink::IDBKey::CreateBinary(blink::SharedBuffer::Create( + *out = blink::IDBKey::CreateBinary(SharedBuffer::Create( reinterpret_cast<const char*>(bytes.data()), bytes.size())); return true; } @@ -229,11 +229,11 @@ if (value_bits.IsEmpty()) { *out = std::make_unique<blink::IDBValue>( - scoped_refptr<blink::SharedBuffer>(), Vector<blink::WebBlobInfo>()); + scoped_refptr<SharedBuffer>(), Vector<blink::WebBlobInfo>()); return true; } - scoped_refptr<blink::SharedBuffer> value_buffer = blink::SharedBuffer::Create( + scoped_refptr<SharedBuffer> value_buffer = SharedBuffer::Create( reinterpret_cast<const char*>(value_bits.data()), value_bits.size()); Vector<blink::mojom::blink::IDBBlobInfoPtr> blob_or_file_info;
diff --git a/third_party/blink/renderer/modules/indexeddb/web_idb_callbacks_impl.cc b/third_party/blink/renderer/modules/indexeddb/web_idb_callbacks_impl.cc index ee2025c8..0f91c58 100644 --- a/third_party/blink/renderer/modules/indexeddb/web_idb_callbacks_impl.cc +++ b/third_party/blink/renderer/modules/indexeddb/web_idb_callbacks_impl.cc
@@ -46,7 +46,7 @@ #include "third_party/blink/renderer/modules/indexeddb/web_idb_database.h" #include "third_party/blink/renderer/modules/indexeddb/web_idb_database_impl.h" #include "third_party/blink/renderer/platform/heap/heap.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc index 2cd97c9..a03d424 100644 --- a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc +++ b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc
@@ -63,9 +63,9 @@ #include "third_party/blink/renderer/platform/loader/fetch/unique_identifier.h" #include "third_party/blink/renderer/platform/network/network_log.h" #include "third_party/blink/renderer/platform/scheduler/public/frame_scheduler.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/wtf/functional.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.h b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.h index d0d232e..e81deb4a 100644 --- a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.h +++ b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.h
@@ -54,7 +54,6 @@ class BaseFetchContext; enum class FileErrorCode; -class SharedBuffer; class WebSocketChannelClient; class WebSocketHandshakeThrottle;
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn index 2ad37fa..5c535ec 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn
@@ -1235,8 +1235,6 @@ "prerender.h", "prerender_client.h", "resolution_units.h", - "shared_buffer.cc", - "shared_buffer.h", "speech/platform_speech_synthesis_utterance.cc", "speech/platform_speech_synthesis_utterance.h", "speech/platform_speech_synthesis_voice.cc", @@ -1767,7 +1765,6 @@ "mojo/interface_invalidator_test.cc", "mojo/kurl_security_origin_test.cc", "mojo/string16_mojom_traits_test.cc", - "shared_buffer_test.cc", "text/bidi_resolver_test.cc", "text/bidi_test_harness.h", "text/capitalize_test.cc",
diff --git a/third_party/blink/renderer/platform/audio/DEPS b/third_party/blink/renderer/platform/audio/DEPS index 2c01b94a..5a71480 100644 --- a/third_party/blink/renderer/platform/audio/DEPS +++ b/third_party/blink/renderer/platform/audio/DEPS
@@ -16,7 +16,7 @@ "+third_party/blink/renderer/platform/instrumentation", "+third_party/blink/renderer/platform/platform_export.h", "+third_party/blink/renderer/platform/scheduler/public", - "+third_party/blink/renderer/platform/shared_buffer.h", + "+third_party/blink/renderer/platform/wtf/shared_buffer.h", "+third_party/blink/renderer/platform/testing", "+third_party/blink/renderer/platform/waitable_event.h", "+third_party/blink/renderer/platform/web_task_runner.h",
diff --git a/third_party/blink/renderer/platform/audio/audio_bus.cc b/third_party/blink/renderer/platform/audio/audio_bus.cc index a6334db..b2d8e6978 100644 --- a/third_party/blink/renderer/platform/audio/audio_bus.cc +++ b/third_party/blink/renderer/platform/audio/audio_bus.cc
@@ -40,7 +40,7 @@ #include "third_party/blink/renderer/platform/audio/denormal_disabler.h" #include "third_party/blink/renderer/platform/audio/sinc_resampler.h" #include "third_party/blink/renderer/platform/audio/vector_math.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/exported/web_data.cc b/third_party/blink/renderer/platform/exported/web_data.cc index ca8b8055..c58ae51 100644 --- a/third_party/blink/renderer/platform/exported/web_data.cc +++ b/third_party/blink/renderer/platform/exported/web_data.cc
@@ -30,7 +30,7 @@ #include "third_party/blink/public/platform/web_data.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include <vector>
diff --git a/third_party/blink/renderer/platform/exported/web_http_body.cc b/third_party/blink/renderer/platform/exported/web_http_body.cc index 9888991..e0fec84 100644 --- a/third_party/blink/renderer/platform/exported/web_http_body.cc +++ b/third_party/blink/renderer/platform/exported/web_http_body.cc
@@ -37,7 +37,7 @@ #include "third_party/blink/renderer/platform/network/encoded_form_data.h" #include "third_party/blink/renderer/platform/network/form_data_encoder.h" #include "third_party/blink/renderer/platform/network/wrapped_data_pipe_getter.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/exported/web_image.cc b/third_party/blink/renderer/platform/exported/web_image.cc index 923da0d..cdedc8ea 100644 --- a/third_party/blink/renderer/platform/exported/web_image.cc +++ b/third_party/blink/renderer/platform/exported/web_image.cc
@@ -37,7 +37,7 @@ #include "third_party/blink/public/platform/web_size.h" #include "third_party/blink/renderer/platform/graphics/image.h" #include "third_party/blink/renderer/platform/image-decoders/image_decoder.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/skia/include/core/SkImage.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/exported/web_image_test.cc b/third_party/blink/renderer/platform/exported/web_image_test.cc index 89b8a8a4..cc718b0 100644 --- a/third_party/blink/renderer/platform/exported/web_image_test.cc +++ b/third_party/blink/renderer/platform/exported/web_image_test.cc
@@ -33,8 +33,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/platform/web_data.h" #include "third_party/blink/public/platform/web_size.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/fonts/DEPS b/third_party/blink/renderer/platform/fonts/DEPS index 58a9a1c..5035247 100644 --- a/third_party/blink/renderer/platform/fonts/DEPS +++ b/third_party/blink/renderer/platform/fonts/DEPS
@@ -18,7 +18,7 @@ "+third_party/blink/renderer/platform/resolution_units.h", "+third_party/blink/renderer/platform/runtime_enabled_features.h", "+third_party/blink/renderer/platform/scheduler/public", - "+third_party/blink/renderer/platform/shared_buffer.h", + "+third_party/blink/renderer/platform/wtf/shared_buffer.h", "+third_party/blink/renderer/platform/testing", "+third_party/blink/renderer/platform/text", "+third_party/blink/renderer/platform/web_test_support.h",
diff --git a/third_party/blink/renderer/platform/fonts/font_custom_platform_data.cc b/third_party/blink/renderer/platform/fonts/font_custom_platform_data.cc index 225e850..bfd0dfa 100644 --- a/third_party/blink/renderer/platform/fonts/font_custom_platform_data.cc +++ b/third_party/blink/renderer/platform/fonts/font_custom_platform_data.cc
@@ -39,7 +39,7 @@ #include "third_party/blink/renderer/platform/fonts/opentype/font_settings.h" #include "third_party/blink/renderer/platform/fonts/web_font_decoder.h" #include "third_party/blink/renderer/platform/fonts/web_font_typeface_factory.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/skia/include/core/SkStream.h" #include "third_party/skia/include/core/SkTypeface.h"
diff --git a/third_party/blink/renderer/platform/fonts/font_custom_platform_data.h b/third_party/blink/renderer/platform/fonts/font_custom_platform_data.h index 002e284..342e438 100644 --- a/third_party/blink/renderer/platform/fonts/font_custom_platform_data.h +++ b/third_party/blink/renderer/platform/fonts/font_custom_platform_data.h
@@ -48,7 +48,6 @@ namespace blink { class FontPlatformData; -class SharedBuffer; class FontVariationSettings; class PLATFORM_EXPORT FontCustomPlatformData
diff --git a/third_party/blink/renderer/platform/fonts/web_font_decoder.cc b/third_party/blink/renderer/platform/fonts/web_font_decoder.cc index 27c4215e..2f5ed9f8 100644 --- a/third_party/blink/renderer/platform/fonts/web_font_decoder.cc +++ b/third_party/blink/renderer/platform/fonts/web_font_decoder.cc
@@ -36,7 +36,7 @@ #include "third_party/blink/renderer/platform/fonts/web_font_typeface_factory.h" #include "third_party/blink/renderer/platform/instrumentation/histogram.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" #include "third_party/ots/include/ots-memory-stream.h"
diff --git a/third_party/blink/renderer/platform/fonts/web_font_decoder.h b/third_party/blink/renderer/platform/fonts/web_font_decoder.h index 5488789..e8c1996f 100644 --- a/third_party/blink/renderer/platform/fonts/web_font_decoder.h +++ b/third_party/blink/renderer/platform/fonts/web_font_decoder.h
@@ -39,8 +39,6 @@ namespace blink { -class SharedBuffer; - class WebFontDecoder final { STACK_ALLOCATED();
diff --git a/third_party/blink/renderer/platform/graphics/DEPS b/third_party/blink/renderer/platform/graphics/DEPS index 55f6849..708bf59 100644 --- a/third_party/blink/renderer/platform/graphics/DEPS +++ b/third_party/blink/renderer/platform/graphics/DEPS
@@ -43,7 +43,7 @@ "+third_party/blink/renderer/platform/runtime_enabled_features.h", "+third_party/blink/renderer/platform/scheduler", "+third_party/blink/renderer/platform/scroll", - "+third_party/blink/renderer/platform/shared_buffer.h", + "+third_party/blink/renderer/platform/wtf/shared_buffer.h", "+third_party/blink/renderer/platform/testing", "+third_party/blink/renderer/platform/text", "+third_party/blink/renderer/platform/timer.h",
diff --git a/third_party/blink/renderer/platform/graphics/bitmap_image_test.cc b/third_party/blink/renderer/platform/graphics/bitmap_image_test.cc index 85d9c44..29043f7c 100644 --- a/third_party/blink/renderer/platform/graphics/bitmap_image_test.cc +++ b/third_party/blink/renderer/platform/graphics/bitmap_image_test.cc
@@ -42,11 +42,11 @@ #include "third_party/blink/renderer/platform/graphics/image_observer.h" #include "third_party/blink/renderer/platform/graphics/test/mock_image_decoder.h" #include "third_party/blink/renderer/platform/scheduler/test/fake_task_runner.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/histogram_tester.h" #include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" #include "third_party/blink/renderer/platform/testing/testing_platform_support_with_mock_scheduler.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkImage.h"
diff --git a/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc b/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc index 0ba6beb1..bc4365f0 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc
@@ -630,6 +630,7 @@ const auto& last_display_item = paint_artifact.GetDisplayItemList()[chunk_it->begin_index]; bool item_for_scrolling = last_display_item.IsScrollHitTest() && + !last_display_item.IsResizerScrollHitTest() && !last_display_item.IsPluginScrollHitTest(); bool requires_own_layer = last_display_item.IsForeignLayer() || // TODO(pdr): This should require a direct
diff --git a/third_party/blink/renderer/platform/graphics/dark_mode_image_classifier_test.cc b/third_party/blink/renderer/platform/graphics/dark_mode_image_classifier_test.cc index ecf036c..3b3166f 100644 --- a/third_party/blink/renderer/platform/graphics/dark_mode_image_classifier_test.cc +++ b/third_party/blink/renderer/platform/graphics/dark_mode_image_classifier_test.cc
@@ -8,9 +8,9 @@ #include "third_party/blink/renderer/platform/graphics/bitmap_image.h" #include "third_party/blink/renderer/platform/graphics/dark_mode_generic_classifier.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_image.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/testing_platform_support_with_mock_scheduler.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink { namespace {
diff --git a/third_party/blink/renderer/platform/graphics/decoding_image_generator.cc b/third_party/blink/renderer/platform/graphics/decoding_image_generator.cc index ccfdf138..5b7f7c3 100644 --- a/third_party/blink/renderer/platform/graphics/decoding_image_generator.cc +++ b/third_party/blink/renderer/platform/graphics/decoding_image_generator.cc
@@ -33,7 +33,7 @@ #include "third_party/blink/renderer/platform/image-decoders/image_decoder.h" #include "third_party/blink/renderer/platform/image-decoders/segment_reader.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/skia/include/core/SkData.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/graphics/deferred_image_decoder.cc b/third_party/blink/renderer/platform/graphics/deferred_image_decoder.cc index 2d5efed65..107449b 100644 --- a/third_party/blink/renderer/platform/graphics/deferred_image_decoder.cc +++ b/third_party/blink/renderer/platform/graphics/deferred_image_decoder.cc
@@ -37,7 +37,7 @@ #include "third_party/blink/renderer/platform/image-decoders/segment_reader.h" #include "third_party/blink/renderer/platform/instrumentation/histogram.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/skia/include/core/SkImage.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/graphics/deferred_image_decoder.h b/third_party/blink/renderer/platform/graphics/deferred_image_decoder.h index 59eca65..8f590958 100644 --- a/third_party/blink/renderer/platform/graphics/deferred_image_decoder.h +++ b/third_party/blink/renderer/platform/graphics/deferred_image_decoder.h
@@ -43,7 +43,6 @@ namespace blink { class ImageFrameGenerator; -class SharedBuffer; struct DeferredFrameData; class PLATFORM_EXPORT DeferredImageDecoder final {
diff --git a/third_party/blink/renderer/platform/graphics/deferred_image_decoder_test.cc b/third_party/blink/renderer/platform/graphics/deferred_image_decoder_test.cc index f5a96073..eb53eebe 100644 --- a/third_party/blink/renderer/platform/graphics/deferred_image_decoder_test.cc +++ b/third_party/blink/renderer/platform/graphics/deferred_image_decoder_test.cc
@@ -40,8 +40,8 @@ #include "third_party/blink/renderer/platform/graphics/test/mock_image_decoder.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkPixmap.h" #include "third_party/skia/include/core/SkSurface.h"
diff --git a/third_party/blink/renderer/platform/graphics/deferred_image_decoder_test_wo_platform.cc b/third_party/blink/renderer/platform/graphics/deferred_image_decoder_test_wo_platform.cc index 4a99e04..4d8522a 100644 --- a/third_party/blink/renderer/platform/graphics/deferred_image_decoder_test_wo_platform.cc +++ b/third_party/blink/renderer/platform/graphics/deferred_image_decoder_test_wo_platform.cc
@@ -8,7 +8,7 @@ #include "base/memory/scoped_refptr.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/image-decoders/image_decoder_test_helpers.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkSurface.h"
diff --git a/third_party/blink/renderer/platform/graphics/image.cc b/third_party/blink/renderer/platform/graphics/image.cc index bf405bd..c98bef5d 100644 --- a/third_party/blink/renderer/platform/graphics/image.cc +++ b/third_party/blink/renderer/platform/graphics/image.cc
@@ -48,8 +48,8 @@ #include "third_party/blink/renderer/platform/graphics/scoped_interpolation_quality.h" #include "third_party/blink/renderer/platform/instrumentation/histogram.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/skia/include/core/SkCanvas.h"
diff --git a/third_party/blink/renderer/platform/graphics/image.h b/third_party/blink/renderer/platform/graphics/image.h index d867f3b..61c3447 100644 --- a/third_party/blink/renderer/platform/graphics/image.h +++ b/third_party/blink/renderer/platform/graphics/image.h
@@ -40,8 +40,8 @@ #include "third_party/blink/renderer/platform/graphics/paint/paint_record.h" #include "third_party/blink/renderer/platform/heap/persistent.h" #include "third_party/blink/renderer/platform/platform_export.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/forward.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h" #include "third_party/skia/include/core/SkRefCnt.h"
diff --git a/third_party/blink/renderer/platform/graphics/image_frame_generator_test.cc b/third_party/blink/renderer/platform/graphics/image_frame_generator_test.cc index 03a2df5..1b88db4 100644 --- a/third_party/blink/renderer/platform/graphics/image_frame_generator_test.cc +++ b/third_party/blink/renderer/platform/graphics/image_frame_generator_test.cc
@@ -35,9 +35,9 @@ #include "third_party/blink/renderer/platform/image-decoders/segment_reader.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/testing_platform_support.h" #include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/vector.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/graphics/paint/display_item.cc b/third_party/blink/renderer/platform/graphics/paint/display_item.cc index adeeb9f..6063758d 100644 --- a/third_party/blink/renderer/platform/graphics/paint/display_item.cc +++ b/third_party/blink/renderer/platform/graphics/paint/display_item.cc
@@ -150,6 +150,7 @@ switch (type) { DEBUG_STRING_CASE(HitTest); DEBUG_STRING_CASE(ScrollHitTest); + DEBUG_STRING_CASE(ResizerScrollHitTest); DEBUG_STRING_CASE(PluginScrollHitTest); DEBUG_STRING_CASE(LayerChunkBackground); DEBUG_STRING_CASE(LayerChunkNegativeZOrderChildren);
diff --git a/third_party/blink/renderer/platform/graphics/paint/display_item.h b/third_party/blink/renderer/platform/graphics/paint/display_item.h index f33960d0..9448ce6 100644 --- a/third_party/blink/renderer/platform/graphics/paint/display_item.h +++ b/third_party/blink/renderer/platform/graphics/paint/display_item.h
@@ -130,6 +130,8 @@ // Used both for specifying the paint-order scroll location, and for non- // composited scroll hit testing (see: scroll_hit_test_display_item.h). kScrollHitTest, + // Used to prevent composited scrolling on the resize handle. + kResizerScrollHitTest, // Used to prevent composited scrolling on plugins with wheel handlers. kPluginScrollHitTest, @@ -247,8 +249,10 @@ bool IsHitTest() const { return type_ == kHitTest; } bool IsScrollHitTest() const { - return type_ == kScrollHitTest || IsPluginScrollHitTest(); + return type_ == kScrollHitTest || IsResizerScrollHitTest() || + IsPluginScrollHitTest(); } + bool IsResizerScrollHitTest() const { return type_ == kResizerScrollHitTest; } bool IsPluginScrollHitTest() const { return type_ == kPluginScrollHitTest; } bool IsCacheable() const { return is_cacheable_; }
diff --git a/third_party/blink/renderer/platform/graphics/paint/scroll_hit_test_display_item.cc b/third_party/blink/renderer/platform/graphics/paint/scroll_hit_test_display_item.cc index c64717b..6e1f2445 100644 --- a/third_party/blink/renderer/platform/graphics/paint/scroll_hit_test_display_item.cc +++ b/third_party/blink/renderer/platform/graphics/paint/scroll_hit_test_display_item.cc
@@ -20,9 +20,10 @@ scroll_container_bounds_(scroll_container_bounds) { DCHECK(RuntimeEnabledFeatures::PaintNonFastScrollableRegionsEnabled()); #if DCHECK_IS_ON() - if (type == DisplayItem::Type::kPluginScrollHitTest) { - // Plugin scroll hit tests are only used to prevent composited scrolling - // and should not have a scroll offset node. + if (type == DisplayItem::Type::kResizerScrollHitTest || + type == DisplayItem::Type::kPluginScrollHitTest) { + // Resizer and plugin scroll hit tests are only used to prevent composited + // scrolling and should not have a scroll offset node. DCHECK(!scroll_offset_node); } else if (type == DisplayItem::Type::kScrollHitTest) { DCHECK(scroll_offset_node);
diff --git a/third_party/blink/renderer/platform/image-decoders/DEPS b/third_party/blink/renderer/platform/image-decoders/DEPS index 8577019..c40be9e 100644 --- a/third_party/blink/renderer/platform/image-decoders/DEPS +++ b/third_party/blink/renderer/platform/image-decoders/DEPS
@@ -14,7 +14,7 @@ "+third_party/blink/renderer/platform/network/mime/mime_type_registry.h", "+third_party/blink/renderer/platform/platform_export.h", "+third_party/blink/renderer/platform/runtime_enabled_features.h", - "+third_party/blink/renderer/platform/shared_buffer.h", + "+third_party/blink/renderer/platform/wtf/shared_buffer.h", "+third_party/blink/renderer/platform/testing", "+third_party/blink/renderer/platform/wtf", ]
diff --git a/third_party/blink/renderer/platform/image-decoders/bmp/bmp_image_decoder_test.cc b/third_party/blink/renderer/platform/image-decoders/bmp/bmp_image_decoder_test.cc index de17f19..4732f9f 100644 --- a/third_party/blink/renderer/platform/image-decoders/bmp/bmp_image_decoder_test.cc +++ b/third_party/blink/renderer/platform/image-decoders/bmp/bmp_image_decoder_test.cc
@@ -8,7 +8,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/image-decoders/image_decoder_base_test.h" #include "third_party/blink/renderer/platform/image-decoders/image_decoder_test_helpers.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/image-decoders/gif/gif_image_decoder_test.cc b/third_party/blink/renderer/platform/image-decoders/gif/gif_image_decoder_test.cc index 5e80c87..942bd0b 100644 --- a/third_party/blink/renderer/platform/image-decoders/gif/gif_image_decoder_test.cc +++ b/third_party/blink/renderer/platform/image-decoders/gif/gif_image_decoder_test.cc
@@ -35,7 +35,7 @@ #include "third_party/blink/public/platform/web_data.h" #include "third_party/blink/public/platform/web_size.h" #include "third_party/blink/renderer/platform/image-decoders/image_decoder_test_helpers.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/vector.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/image-decoders/image_decoder.h b/third_party/blink/renderer/platform/image-decoders/image_decoder.h index f865487..df788ae 100644 --- a/third_party/blink/renderer/platform/image-decoders/image_decoder.h +++ b/third_party/blink/renderer/platform/image-decoders/image_decoder.h
@@ -37,8 +37,8 @@ #include "third_party/blink/renderer/platform/image-decoders/image_frame.h" #include "third_party/blink/renderer/platform/image-decoders/segment_reader.h" #include "third_party/blink/renderer/platform/platform_export.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
diff --git a/third_party/blink/renderer/platform/image-decoders/image_decoder_test_helpers.cc b/third_party/blink/renderer/platform/image-decoders/image_decoder_test_helpers.cc index 94a82ce..780cb96 100644 --- a/third_party/blink/renderer/platform/image-decoders/image_decoder_test_helpers.cc +++ b/third_party/blink/renderer/platform/image-decoders/image_decoder_test_helpers.cc
@@ -7,8 +7,8 @@ #include <memory> #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/image-decoders/image_frame.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "third_party/blink/renderer/platform/wtf/text/string_hasher.h"
diff --git a/third_party/blink/renderer/platform/image-decoders/image_decoder_test_helpers.h b/third_party/blink/renderer/platform/image-decoders/image_decoder_test_helpers.h index c231462..3450fd1 100644 --- a/third_party/blink/renderer/platform/image-decoders/image_decoder_test_helpers.h +++ b/third_party/blink/renderer/platform/image-decoders/image_decoder_test_helpers.h
@@ -7,7 +7,7 @@ #include <memory> #include "third_party/blink/renderer/platform/image-decoders/image_decoder.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/string_view.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
diff --git a/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder_test.cc b/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder_test.cc index d4bf881..d708722 100644 --- a/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder_test.cc +++ b/third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder_test.cc
@@ -40,8 +40,8 @@ #include "third_party/blink/renderer/platform/graphics/bitmap_image_metrics.h" #include "third_party/blink/renderer/platform/image-decoders/image_animation.h" #include "third_party/blink/renderer/platform/image-decoders/image_decoder_test_helpers.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/histogram_tester.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/image-decoders/segment_reader.cc b/third_party/blink/renderer/platform/image-decoders/segment_reader.cc index 5913a86..1b5131f 100644 --- a/third_party/blink/renderer/platform/image-decoders/segment_reader.cc +++ b/third_party/blink/renderer/platform/image-decoders/segment_reader.cc
@@ -6,8 +6,8 @@ #include "base/macros.h" #include "base/memory/scoped_refptr.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/threading_primitives.h" #include "third_party/skia/include/core/SkData.h" #include "third_party/skia/include/core/SkRWBuffer.h"
diff --git a/third_party/blink/renderer/platform/image-decoders/segment_reader.h b/third_party/blink/renderer/platform/image-decoders/segment_reader.h index 3755716..f367523 100644 --- a/third_party/blink/renderer/platform/image-decoders/segment_reader.h +++ b/third_party/blink/renderer/platform/image-decoders/segment_reader.h
@@ -7,7 +7,8 @@ #include "base/macros.h" #include "base/memory/scoped_refptr.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/platform_export.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h" class SkData;
diff --git a/third_party/blink/renderer/platform/image-decoders/segment_stream_test.cc b/third_party/blink/renderer/platform/image-decoders/segment_stream_test.cc index a4c36cc..19e7f3e 100644 --- a/third_party/blink/renderer/platform/image-decoders/segment_stream_test.cc +++ b/third_party/blink/renderer/platform/image-decoders/segment_stream_test.cc
@@ -7,7 +7,7 @@ #include "base/memory/scoped_refptr.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/image-decoders/segment_reader.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" // SegmentStream has 4 accessors which do not alter state: // - isCleared()
diff --git a/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder_test.cc b/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder_test.cc index cc4bd0d..4c8bcd1 100644 --- a/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder_test.cc +++ b/third_party/blink/renderer/platform/image-decoders/webp/webp_image_decoder_test.cc
@@ -37,9 +37,8 @@ #include "third_party/blink/public/platform/web_data.h" #include "third_party/blink/public/platform/web_size.h" #include "third_party/blink/renderer/platform/image-decoders/image_decoder_test_helpers.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/dtoa/utils.h" - +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/vector.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/loader/DEPS b/third_party/blink/renderer/platform/loader/DEPS index 67805a5..bea7ce0 100644 --- a/third_party/blink/renderer/platform/loader/DEPS +++ b/third_party/blink/renderer/platform/loader/DEPS
@@ -31,7 +31,7 @@ "+third_party/blink/renderer/platform/probe", "+third_party/blink/renderer/platform/runtime_enabled_features.h", "+third_party/blink/renderer/platform/scheduler", - "+third_party/blink/renderer/platform/shared_buffer.h", + "+third_party/blink/renderer/platform/wtf/shared_buffer.h", "+third_party/blink/renderer/platform/testing", "+third_party/blink/renderer/platform/timer.h", "+third_party/blink/renderer/platform/weborigin",
diff --git a/third_party/blink/renderer/platform/loader/fetch/raw_resource_test.cc b/third_party/blink/renderer/platform/loader/fetch/raw_resource_test.cc index 884a91b..6c161c6 100644 --- a/third_party/blink/renderer/platform/loader/fetch/raw_resource_test.cc +++ b/third_party/blink/renderer/platform/loader/fetch/raw_resource_test.cc
@@ -44,10 +44,10 @@ #include "third_party/blink/renderer/platform/loader/testing/replaying_bytes_consumer.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" #include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/testing_platform_support_with_mock_scheduler.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource.cc b/third_party/blink/renderer/platform/loader/fetch/resource.cc index c0be93eb..cd26399 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource.cc +++ b/third_party/blink/renderer/platform/loader/fetch/resource.cc
@@ -52,9 +52,9 @@ #include "third_party/blink/renderer/platform/loader/fetch/resource_loader.h" #include "third_party/blink/renderer/platform/network/http_parsers.h" #include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/wtf/math_extras.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource.h b/third_party/blink/renderer/platform/loader/fetch/resource.h index 6549b27..84e48e8f 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource.h +++ b/third_party/blink/renderer/platform/loader/fetch/resource.h
@@ -46,11 +46,11 @@ #include "third_party/blink/renderer/platform/loader/subresource_integrity.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cancellable_task.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/timer.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/hash_counted_set.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" #include "third_party/blink/renderer/platform/wtf/text/text_encoding.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_loader.cc b/third_party/blink/renderer/platform/loader/fetch/resource_loader.cc index 06c015a..8f6e4e5d 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource_loader.cc +++ b/third_party/blink/renderer/platform/loader/fetch/resource_loader.cc
@@ -69,11 +69,11 @@ #include "third_party/blink/renderer/platform/network/network_utils.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/scheme_registry.h" #include "third_party/blink/renderer/platform/weborigin/security_violation_reporting_policy.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_test.cc b/third_party/blink/renderer/platform/loader/fetch/resource_test.cc index f4767a1b..599ec99 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource_test.cc +++ b/third_party/blink/renderer/platform/loader/fetch/resource_test.cc
@@ -11,10 +11,9 @@ #include "third_party/blink/renderer/platform/loader/fetch/resource_response.h" #include "third_party/blink/renderer/platform/loader/testing/mock_resource.h" #include "third_party/blink/renderer/platform/loader/testing/mock_resource_client.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/testing_platform_support_with_mock_scheduler.h" #include "third_party/blink/renderer/platform/testing/url_test_helpers.h" - +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/vector.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/loader/fetch/response_body_loader.cc b/third_party/blink/renderer/platform/loader/fetch/response_body_loader.cc index 0b33687..ecb144b 100644 --- a/third_party/blink/renderer/platform/loader/fetch/response_body_loader.cc +++ b/third_party/blink/renderer/platform/loader/fetch/response_body_loader.cc
@@ -10,7 +10,7 @@ #include "third_party/blink/renderer/platform/loader/fetch/fetch_context.h" #include "third_party/blink/renderer/platform/loader/fetch/resource.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_loader.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/loader/fetch/shared_buffer_bytes_consumer.h b/third_party/blink/renderer/platform/loader/fetch/shared_buffer_bytes_consumer.h index f9c1080..1e6e574c 100644 --- a/third_party/blink/renderer/platform/loader/fetch/shared_buffer_bytes_consumer.h +++ b/third_party/blink/renderer/platform/loader/fetch/shared_buffer_bytes_consumer.h
@@ -6,7 +6,7 @@ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_LOADER_FETCH_SHARED_BUFFER_BYTES_CONSUMER_H_ #include "third_party/blink/renderer/platform/loader/fetch/bytes_consumer.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/loader/fetch/shared_buffer_bytes_consumer_test.cc b/third_party/blink/renderer/platform/loader/fetch/shared_buffer_bytes_consumer_test.cc index 9c5b242..2cec6cd 100644 --- a/third_party/blink/renderer/platform/loader/fetch/shared_buffer_bytes_consumer_test.cc +++ b/third_party/blink/renderer/platform/loader/fetch/shared_buffer_bytes_consumer_test.cc
@@ -10,7 +10,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/loader/testing/bytes_consumer_test_reader.h" #include "third_party/blink/renderer/platform/scheduler/test/fake_task_runner.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/loader/ftp_directory_listing.cc b/third_party/blink/renderer/platform/loader/ftp_directory_listing.cc index 34b8172..e53f13f 100644 --- a/third_party/blink/renderer/platform/loader/ftp_directory_listing.cc +++ b/third_party/blink/renderer/platform/loader/ftp_directory_listing.cc
@@ -20,8 +20,8 @@ #include "net/ftp/ftp_directory_listing_parser.h" #include "net/net_buildflags.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_error.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "url/gurl.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/loader/ftp_directory_listing.h b/third_party/blink/renderer/platform/loader/ftp_directory_listing.h index 78473c8..b19c818 100644 --- a/third_party/blink/renderer/platform/loader/ftp_directory_listing.h +++ b/third_party/blink/renderer/platform/loader/ftp_directory_listing.h
@@ -8,11 +8,11 @@ #include "base/memory/scoped_refptr.h" #include "base/optional.h" #include "third_party/blink/renderer/platform/platform_export.h" +#include "third_party/blink/renderer/platform/wtf/forward.h" namespace blink { class KURL; -class SharedBuffer; // Translates |input|, an FTP LISTING result, to an HTML and returns it. When // an error happens that is written in the result HTML.
diff --git a/third_party/blink/renderer/platform/loader/ftp_directory_listing_test.cc b/third_party/blink/renderer/platform/loader/ftp_directory_listing_test.cc index b18d531..9f52cba 100644 --- a/third_party/blink/renderer/platform/loader/ftp_directory_listing_test.cc +++ b/third_party/blink/renderer/platform/loader/ftp_directory_listing_test.cc
@@ -10,9 +10,9 @@ #include "net/net_buildflags.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_error.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/icu/source/i18n/unicode/timezone.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/loader/static_data_navigation_body_loader.h b/third_party/blink/renderer/platform/loader/static_data_navigation_body_loader.h index f69356f..3f68d65 100644 --- a/third_party/blink/renderer/platform/loader/static_data_navigation_body_loader.h +++ b/third_party/blink/renderer/platform/loader/static_data_navigation_body_loader.h
@@ -9,7 +9,7 @@ #include "base/memory/weak_ptr.h" #include "third_party/blink/public/platform/web_navigation_body_loader.h" #include "third_party/blink/renderer/platform/platform_export.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/mhtml/DEPS b/third_party/blink/renderer/platform/mhtml/DEPS index 3b99ec58..dc473234 100644 --- a/third_party/blink/renderer/platform/mhtml/DEPS +++ b/third_party/blink/renderer/platform/mhtml/DEPS
@@ -11,7 +11,7 @@ "+third_party/blink/renderer/platform/network", "+third_party/blink/renderer/platform/serialized_resource.h", "+third_party/blink/renderer/platform/shared_buffer_chunk_reader.h", - "+third_party/blink/renderer/platform/shared_buffer.h", + "+third_party/blink/renderer/platform/wtf/shared_buffer.h", "+third_party/blink/renderer/platform/testing", "+third_party/blink/renderer/platform/text", "+third_party/blink/renderer/platform/weborigin",
diff --git a/third_party/blink/renderer/platform/mhtml/archive_resource.h b/third_party/blink/renderer/platform/mhtml/archive_resource.h index 724bbba..1939670 100644 --- a/third_party/blink/renderer/platform/mhtml/archive_resource.h +++ b/third_party/blink/renderer/platform/mhtml/archive_resource.h
@@ -31,9 +31,9 @@ #include "base/memory/scoped_refptr.h" #include "third_party/blink/renderer/platform/heap/handle.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/wtf/forward.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/mhtml/mhtml_archive.cc b/third_party/blink/renderer/platform/mhtml/mhtml_archive.cc index 5a662f1..d45cce0 100644 --- a/third_party/blink/renderer/platform/mhtml/mhtml_archive.cc +++ b/third_party/blink/renderer/platform/mhtml/mhtml_archive.cc
@@ -37,11 +37,11 @@ #include "third_party/blink/renderer/platform/mhtml/mhtml_parser.h" #include "third_party/blink/renderer/platform/mhtml/serialized_resource.h" #include "third_party/blink/renderer/platform/network/mime/mime_type_registry.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/text/date_components.h" #include "third_party/blink/renderer/platform/weborigin/scheme_registry.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" #include "third_party/blink/renderer/platform/wtf/date_math.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/ascii_ctype.h" #include "third_party/blink/renderer/platform/wtf/text/base64.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
diff --git a/third_party/blink/renderer/platform/mhtml/mhtml_archive.h b/third_party/blink/renderer/platform/mhtml/mhtml_archive.h index 8467ad8..0f19fd94 100644 --- a/third_party/blink/renderer/platform/mhtml/mhtml_archive.h +++ b/third_party/blink/renderer/platform/mhtml/mhtml_archive.h
@@ -47,7 +47,6 @@ class ArchiveResource; class KURL; -class SharedBuffer; struct SerializedResource;
diff --git a/third_party/blink/renderer/platform/mhtml/mhtml_fuzzer.cc b/third_party/blink/renderer/platform/mhtml/mhtml_fuzzer.cc index 22b3118..31a428a 100644 --- a/third_party/blink/renderer/platform/mhtml/mhtml_fuzzer.cc +++ b/third_party/blink/renderer/platform/mhtml/mhtml_fuzzer.cc
@@ -7,8 +7,8 @@ #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/mhtml/archive_resource.h" #include "third_party/blink/renderer/platform/mhtml/mhtml_parser.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/blink_fuzzer_test_support.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/mhtml/mhtml_parser.h b/third_party/blink/renderer/platform/mhtml/mhtml_parser.h index 93aa8c3..507a5b9 100644 --- a/third_party/blink/renderer/platform/mhtml/mhtml_parser.h +++ b/third_party/blink/renderer/platform/mhtml/mhtml_parser.h
@@ -47,7 +47,6 @@ class ArchiveResource; class MIMEHeader; -class SharedBuffer; class PLATFORM_EXPORT MHTMLParser final { STACK_ALLOCATED();
diff --git a/third_party/blink/renderer/platform/mhtml/mhtml_parser_test.cc b/third_party/blink/renderer/platform/mhtml/mhtml_parser_test.cc index 7805660d..7bc70974 100644 --- a/third_party/blink/renderer/platform/mhtml/mhtml_parser_test.cc +++ b/third_party/blink/renderer/platform/mhtml/mhtml_parser_test.cc
@@ -6,7 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/mhtml/archive_resource.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/mhtml/serialized_resource.h b/third_party/blink/renderer/platform/mhtml/serialized_resource.h index c53c204..8dd0e9e 100644 --- a/third_party/blink/renderer/platform/mhtml/serialized_resource.h +++ b/third_party/blink/renderer/platform/mhtml/serialized_resource.h
@@ -31,9 +31,9 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_MHTML_SERIALIZED_RESOURCE_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_MHTML_SERIALIZED_RESOURCE_H_ -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/mhtml/shared_buffer_chunk_reader.cc b/third_party/blink/renderer/platform/mhtml/shared_buffer_chunk_reader.cc index 732afac..edd29a8 100644 --- a/third_party/blink/renderer/platform/mhtml/shared_buffer_chunk_reader.cc +++ b/third_party/blink/renderer/platform/mhtml/shared_buffer_chunk_reader.cc
@@ -30,7 +30,7 @@ #include "third_party/blink/renderer/platform/mhtml/shared_buffer_chunk_reader.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/mhtml/shared_buffer_chunk_reader.h b/third_party/blink/renderer/platform/mhtml/shared_buffer_chunk_reader.h index 08dadaa..0ebe882 100644 --- a/third_party/blink/renderer/platform/mhtml/shared_buffer_chunk_reader.h +++ b/third_party/blink/renderer/platform/mhtml/shared_buffer_chunk_reader.h
@@ -38,8 +38,6 @@ namespace blink { -class SharedBuffer; - class SharedBufferChunkReader final { DISALLOW_NEW();
diff --git a/third_party/blink/renderer/platform/network/DEPS b/third_party/blink/renderer/platform/network/DEPS index d714606..e678379b 100644 --- a/third_party/blink/renderer/platform/network/DEPS +++ b/third_party/blink/renderer/platform/network/DEPS
@@ -25,7 +25,7 @@ "+third_party/blink/renderer/platform/loader", "+third_party/blink/renderer/platform/platform_export.h", "+third_party/blink/renderer/platform/scheduler", - "+third_party/blink/renderer/platform/shared_buffer.h", + "+third_party/blink/renderer/platform/wtf/shared_buffer.h", "+third_party/blink/renderer/platform/testing", "+third_party/blink/renderer/platform/weborigin", "+third_party/blink/renderer/platform/web_task_runner.h",
diff --git a/third_party/blink/renderer/platform/network/network_utils.cc b/third_party/blink/renderer/platform/network/network_utils.cc index ab2c4f5..539544c 100644 --- a/third_party/blink/renderer/platform/network/network_utils.cc +++ b/third_party/blink/renderer/platform/network/network_utils.cc
@@ -15,8 +15,8 @@ #include "third_party/blink/public/common/mime_util/mime_util.h" #include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_response.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/string_utf8_adaptor.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "url/gurl.h"
diff --git a/third_party/blink/renderer/platform/network/network_utils.h b/third_party/blink/renderer/platform/network/network_utils.h index fa93abcd..fc0455d 100644 --- a/third_party/blink/renderer/platform/network/network_utils.h +++ b/third_party/blink/renderer/platform/network/network_utils.h
@@ -14,7 +14,6 @@ namespace blink { class KURL; -class SharedBuffer; class ResourceResponse; namespace network_utils {
diff --git a/third_party/blink/renderer/platform/testing/DEPS b/third_party/blink/renderer/platform/testing/DEPS index 0bc5f59..3d29585 100644 --- a/third_party/blink/renderer/platform/testing/DEPS +++ b/third_party/blink/renderer/platform/testing/DEPS
@@ -35,7 +35,7 @@ "+third_party/blink/renderer/platform/runtime_enabled_features.h", "+third_party/blink/renderer/platform/scheduler", "+third_party/blink/renderer/platform/scroll", - "+third_party/blink/renderer/platform/shared_buffer.h", + "+third_party/blink/renderer/platform/wtf/shared_buffer.h", "+third_party/blink/renderer/platform/text", "+third_party/blink/renderer/platform/timer.h", "+third_party/blink/renderer/platform/waitable_event.h",
diff --git a/third_party/blink/renderer/platform/testing/font_test_helpers.cc b/third_party/blink/renderer/platform/testing/font_test_helpers.cc index b26098f0..ef7d0b5 100644 --- a/third_party/blink/renderer/platform/testing/font_test_helpers.cc +++ b/third_party/blink/renderer/platform/testing/font_test_helpers.cc
@@ -8,8 +8,8 @@ #include "third_party/blink/renderer/platform/fonts/font.h" #include "third_party/blink/renderer/platform/fonts/font_custom_platform_data.h" #include "third_party/blink/renderer/platform/fonts/font_selector.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink { namespace test {
diff --git a/third_party/blink/renderer/platform/testing/image_decode_bench.cc b/third_party/blink/renderer/platform/testing/image_decode_bench.cc index 5aae7d8b..b3426cd9 100644 --- a/third_party/blink/renderer/platform/testing/image_decode_bench.cc +++ b/third_party/blink/renderer/platform/testing/image_decode_bench.cc
@@ -20,7 +20,7 @@ #include "mojo/core/embedder/embedder.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/platform/image-decoders/image_decoder.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/testing/unit_test_helpers.cc b/third_party/blink/renderer/platform/testing/unit_test_helpers.cc index a98dd8a..f78ee319 100644 --- a/third_party/blink/renderer/platform/testing/unit_test_helpers.cc +++ b/third_party/blink/renderer/platform/testing/unit_test_helpers.cc
@@ -35,8 +35,8 @@ #include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/functional.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include "third_party/blink/renderer/platform/wtf/text/string_utf8_adaptor.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/testing/unit_test_helpers.h b/third_party/blink/renderer/platform/testing/unit_test_helpers.h index 9beffda..87d7159 100644 --- a/third_party/blink/renderer/platform/testing/unit_test_helpers.h +++ b/third_party/blink/renderer/platform/testing/unit_test_helpers.h
@@ -33,8 +33,6 @@ namespace blink { -class SharedBuffer; - namespace test { // Note: You may want to use TestingPlatformSupportWithMockScheduler to
diff --git a/third_party/blink/renderer/platform/testing/weburl_loader_mock.cc b/third_party/blink/renderer/platform/testing/weburl_loader_mock.cc index a3f8ca2..f11d1d3 100644 --- a/third_party/blink/renderer/platform/testing/weburl_loader_mock.cc +++ b/third_party/blink/renderer/platform/testing/weburl_loader_mock.cc
@@ -12,8 +12,8 @@ #include "third_party/blink/public/platform/web_url_error.h" #include "third_party/blink/public/platform/web_url_loader_client.h" #include "third_party/blink/renderer/platform/scheduler/test/fake_task_runner.h" -#include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/testing/weburl_loader_mock_factory_impl.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/wtf/BUILD.gn b/third_party/blink/renderer/platform/wtf/BUILD.gn index f8da896e..eb9e761b 100644 --- a/third_party/blink/renderer/platform/wtf/BUILD.gn +++ b/third_party/blink/renderer/platform/wtf/BUILD.gn
@@ -102,6 +102,8 @@ "sanitizers.h", "scoped_logger.cc", "scoped_logger.h", + "shared_buffer.cc", + "shared_buffer.h", "size_assertions.cc", "size_assertions.h", "stack_util.cc", @@ -236,6 +238,7 @@ public_deps = [ "//base", + "//skia", "//third_party/icu", ] @@ -307,6 +310,7 @@ "pod_tree_test_helpers.cc", "pod_tree_test_helpers.h", "scoped_logger_test.cc", + "shared_buffer_test.cc", "testing/run_all_tests.cc", "text/atomic_string_test.cc", "text/case_map_test.cc",
diff --git a/third_party/blink/renderer/platform/wtf/DEPS b/third_party/blink/renderer/platform/wtf/DEPS index 7ef4a10..257797f9 100644 --- a/third_party/blink/renderer/platform/wtf/DEPS +++ b/third_party/blink/renderer/platform/wtf/DEPS
@@ -25,6 +25,7 @@ "+base/threading", "+base/time/time.h", "+base/tuple.h", + "+third_party/skia", # To avoid recursive dependency, we impose a blanket ban on using other # platform files. Think carefully if you want to relax this restriction. "-third_party/blink/renderer/platform",
diff --git a/third_party/blink/renderer/platform/wtf/forward.h b/third_party/blink/renderer/platform/wtf/forward.h index 17c1688..1395b79 100644 --- a/third_party/blink/renderer/platform/wtf/forward.h +++ b/third_party/blink/renderer/platform/wtf/forward.h
@@ -52,6 +52,7 @@ class Int16Array; class Int32Array; class OrdinalNumber; +class SharedBuffer; class String; class StringBuilder; class StringImpl; @@ -79,6 +80,7 @@ using WTF::Int8Array; using WTF::Int16Array; using WTF::Int32Array; +using WTF::SharedBuffer; using WTF::String; using WTF::StringBuffer; using WTF::StringBuilder;
diff --git a/third_party/blink/renderer/platform/shared_buffer.cc b/third_party/blink/renderer/platform/wtf/shared_buffer.cc similarity index 96% rename from third_party/blink/renderer/platform/shared_buffer.cc rename to third_party/blink/renderer/platform/wtf/shared_buffer.cc index 5228cee..cf5689cf 100644 --- a/third_party/blink/renderer/platform/shared_buffer.cc +++ b/third_party/blink/renderer/platform/wtf/shared_buffer.cc
@@ -24,17 +24,16 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include <memory> -#include "third_party/blink/renderer/platform/instrumentation/tracing/web_process_memory_dump.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" #include "third_party/blink/renderer/platform/wtf/text/unicode.h" #include "third_party/blink/renderer/platform/wtf/text/utf8.h" #include "third_party/skia/include/core/SkData.h" -namespace blink { +namespace WTF { constexpr unsigned SharedBuffer::kSegmentSize; @@ -53,7 +52,7 @@ SharedBuffer::Segment SharedBuffer::CreateSegment() { return std::unique_ptr<char[], SegmentDeleter>( static_cast<char*>(WTF::Partitions::FastMalloc(SharedBuffer::kSegmentSize, - "blink::SharedBuffer"))); + "WTF::SharedBuffer"))); } SharedBuffer::Iterator& SharedBuffer::Iterator::operator++() { @@ -249,4 +248,4 @@ data_ = flat_buffer_.data(); } -} // namespace blink +} // namespace WTF
diff --git a/third_party/blink/renderer/platform/shared_buffer.h b/third_party/blink/renderer/platform/wtf/shared_buffer.h similarity index 95% rename from third_party/blink/renderer/platform/shared_buffer.h rename to third_party/blink/renderer/platform/wtf/shared_buffer.h index 1b54ea8..f309d45d 100644 --- a/third_party/blink/renderer/platform/shared_buffer.h +++ b/third_party/blink/renderer/platform/wtf/shared_buffer.h
@@ -24,33 +24,33 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_SHARED_BUFFER_H_ -#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_SHARED_BUFFER_H_ +#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_SHARED_BUFFER_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_SHARED_BUFFER_H_ #include <algorithm> #include <utility> #include <vector> #include "base/containers/span.h" -#include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/blink/renderer/platform/wtf/ref_counted.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/vector.h" +#include "third_party/blink/renderer/platform/wtf/wtf_export.h" class SkData; template <typename T> class sk_sp; -namespace blink { +namespace WTF { -class PLATFORM_EXPORT SharedBuffer : public RefCounted<SharedBuffer> { +class WTF_EXPORT SharedBuffer : public RefCounted<SharedBuffer> { public: // Iterator for ShreadBuffer contents. An Iterator will get invalid once the // associated SharedBuffer is modified (e.g., Append() is called). An Iterator // doesn't retain the associated container. - class PLATFORM_EXPORT Iterator final { + class WTF_EXPORT Iterator final { public: ~Iterator() = default; @@ -185,7 +185,7 @@ // Helper for providing a contiguous view of the data. If the SharedBuffer is // segmented, this will copy/merge all segments into a temporary buffer. // In general, clients should use the efficient/segmented accessors. - class PLATFORM_EXPORT DeprecatedFlatData { + class WTF_EXPORT DeprecatedFlatData { STACK_ALLOCATED(); public: @@ -278,6 +278,6 @@ return buffer; } -} // namespace blink +} // namespace WTF -#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_SHARED_BUFFER_H_ +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_SHARED_BUFFER_H_
diff --git a/third_party/blink/renderer/platform/shared_buffer_test.cc b/third_party/blink/renderer/platform/wtf/shared_buffer_test.cc similarity index 99% rename from third_party/blink/renderer/platform/shared_buffer_test.cc rename to third_party/blink/renderer/platform/wtf/shared_buffer_test.cc index 5602120..71440e0 100644 --- a/third_party/blink/renderer/platform/shared_buffer_test.cc +++ b/third_party/blink/renderer/platform/wtf/shared_buffer_test.cc
@@ -28,7 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/shared_buffer.h" #include <algorithm> #include <cstdlib>
diff --git a/third_party/blink/web_tests/NeverFixTests b/third_party/blink/web_tests/NeverFixTests index 29adf27d..fe8f8cd8 100644 --- a/third_party/blink/web_tests/NeverFixTests +++ b/third_party/blink/web_tests/NeverFixTests
@@ -1622,7 +1622,6 @@ # Requires --use-fake-ui-for-media-stream to run. external/wpt/mediacapture-streams/MediaStream-default-feature-policy.https.html [ WontFix ] -virtual/audio-service/external/wpt/mediacapture-streams/MediaStream-default-feature-policy.https.html [ WontFix ] # These directories have manual tests that don't have to run with # run_web_tests.py; see https://crbug.com/359838. @@ -2138,8 +2137,6 @@ virtual/blink-cors/external/wpt/xhr/send-authentication-prompt-2-manual.htm [ WontFix ] virtual/feature-policy-permissions/external/wpt/mediacapture-streams/MediaStream-MediaElement-preload-none-manual.https.html [ WontFix ] virtual/feature-policy-permissions/external/wpt/mediacapture-streams/MediaStreamTrack-end-manual.https.html [ WontFix ] -virtual/audio-service/external/wpt/mediacapture-streams/MediaStream-MediaElement-preload-none-manual.https.html [ WontFix ] -virtual/audio-service/external/wpt/mediacapture-streams/MediaStreamTrack-end-manual.https.html [ WontFix ] virtual/omt-worker-fetch/external/wpt/service-workers/service-worker/fetch-event-is-history-backward-navigation-manual.https.html [ WontFix ] virtual/omt-worker-fetch/external/wpt/service-workers/service-worker/fetch-event-is-history-forward-navigation-manual.https.html [ WontFix ] virtual/omt-worker-fetch/external/wpt/service-workers/service-worker/fetch-event-is-reload-navigation-manual.https.html [ WontFix ] @@ -2248,7 +2245,6 @@ crbug.com/946022 [ Win7 ] images/image-zoom-to-25.html [ WontFix ] crbug.com/946022 [ Win7 ] images/image-zoom-to-500.html [ WontFix ] crbug.com/946022 [ Win7 ] media/controls/overflow-menu-hide-on-resize.html [ WontFix ] -crbug.com/946022 [ Win7 ] virtual/audio-service/media/controls/overflow-menu-hide-on-resize.html [ WontFix ] crbug.com/946022 [ Win7 ] paint/invalidation/resize-iframe-text.html [ WontFix ] crbug.com/946022 [ Win7 ] paint/invalidation/scroll/scrollbar-damage-and-full-viewport-repaint.html [ WontFix ] crbug.com/946022 [ Win7 ] paint/invalidation/window-resize/ [ WontFix ]
diff --git a/third_party/blink/web_tests/SlowTests b/third_party/blink/web_tests/SlowTests index b0f70fc..3b4112f4 100644 --- a/third_party/blink/web_tests/SlowTests +++ b/third_party/blink/web_tests/SlowTests
@@ -44,8 +44,6 @@ crbug.com/24182 jquery/traversing.html [ Slow ] crbug.com/24182 media/controls/controls-cast-do-not-fade-out.html [ Slow ] crbug.com/24182 media/controls/controls-cast-overlay-slow-fade.html [ Slow ] -crbug.com/24182 virtual/audio-service/media/controls/controls-cast-do-not-fade-out.html [ Slow ] -crbug.com/24182 virtual/audio-service/media/controls/controls-cast-overlay-slow-fade.html [ Slow ] crbug.com/24182 svg/filters/big-sized-filter.svg [ Slow ] crbug.com/24182 tables/mozilla/other/slashlogo.html [ Slow ] crbug.com/24182 fast/canvas/color-space/canvas-colorManaged-toBlob-toDataURL.html [ Slow ] @@ -119,10 +117,6 @@ crbug.com/73609 http/tests/media/video-preload-metadata.html [ Slow ] crbug.com/869829 http/tests/media/video-cancel-load.html [ Slow ] crbug.com/870259 http/tests/media/video-throttled-load-metadata.html [ Slow ] -crbug.com/73609 virtual/audio-service/http/tests/media/video-play-stall.html [ Slow ] -crbug.com/73609 virtual/audio-service/http/tests/media/video-preload-metadata.html [ Slow ] -crbug.com/869829 virtual/audio-service/http/tests/media/video-cancel-load.html [ Slow ] -crbug.com/870259 virtual/audio-service/http/tests/media/video-throttled-load-metadata.html [ Slow ] # Many of the virtual animations tests are slow. crbug.com/243871 virtual/threaded/fast/scroll-behavior/ [ Slow ] @@ -156,7 +150,6 @@ crbug.com/346259 http/tests/websocket/no-crash-on-cookie-flood.html [ Slow ] crbug.com/522646 http/tests/media/encrypted-media/encrypted-media-encrypted-event-different-origin.html [ Slow ] -crbug.com/522646 virtual/audio-service/http/tests/media/encrypted-media/encrypted-media-encrypted-event-different-origin.html [ Slow ] crbug.com/411164 [ Win ] http/tests/security/powerfulFeatureRestrictions/serviceworker-on-insecure-origin.html [ Slow ] crbug.com/411164 [ Win ] virtual/blink-cors/http/tests/security/powerfulFeatureRestrictions/serviceworker-on-insecure-origin.html [ Slow ] crbug.com/510337 http/tests/devtools/console/console-format.js [ Slow ] @@ -223,7 +216,6 @@ # Media controls tests have to wait for panel to fade out. crbug.com/722825 media/controls/video-enter-exit-fullscreen-without-hovering-doesnt-show-controls.html [ Slow ] -crbug.com/722825 virtual/audio-service/media/controls/video-enter-exit-fullscreen-without-hovering-doesnt-show-controls.html [ Slow ] crbug.com/719298 fast/dnd/dropEffect-for-effectAllowed.html [ Slow ] @@ -237,7 +229,6 @@ crbug.com/451577 [ Linux ] http/tests/devtools/layers/layer-canvas-log.js [ Slow ] crbug.com/793771 media/controls/scrubbing.html [ Slow ] -crbug.com/793771 virtual/audio-service/media/controls/scrubbing.html [ Slow ] # These tests need to do many iterations and so can't be fast. crbug.com/748418 http/tests/streams/chromium/deep-recursion-getwriter.html [ Slow ] @@ -278,10 +269,8 @@ crbug.com/864887 [ Mac ] fast/scroll-snap/snaps-after-scrollbar-scrolling.html [ Slow ] crbug.com/865262 [ Mac ] media/controls/text-track-menu-pointer-selection.html [ Slow ] -crbug.com/865262 [ Mac ] virtual/audio-service/media/controls/text-track-menu-pointer-selection.html [ Slow ] crbug.com/942951 media/controls/controls-layout-in-different-size.html [ Slow ] -crbug.com/942951 virtual/audio-service/media/controls/controls-layout-in-different-size.html [ Slow ] crbug.com/910627 webexposed/global-interface-listing-shared-worker.html [ Slow ] crbug.com/910627 virtual/stable/webexposed/global-interface-listing-shared-worker.html [ Slow ] @@ -446,11 +435,6 @@ crbug.com/874695 http/tests/media/video-buffered.html [ Slow ] crbug.com/874695 http/tests/media/video-load-metadata-decode-error.html [ Slow ] crbug.com/874695 http/tests/media/video-play-stall-before-meta-data.html [ Slow ] -crbug.com/874695 virtual/audio-service/http/tests/media/controls/toggle-class-with-state-source-buffer.html [ Slow ] -crbug.com/874695 virtual/audio-service/http/tests/media/preload-conditions.html [ Slow ] -crbug.com/874695 virtual/audio-service/http/tests/media/video-buffered.html [ Slow ] -crbug.com/874695 virtual/audio-service/http/tests/media/video-load-metadata-decode-error.html [ Slow ] -crbug.com/874695 virtual/audio-service/http/tests/media/video-play-stall-before-meta-data.html [ Slow ] crbug.com/874695 http/tests/misc/adopt-iframe-src-attr-after-remove.html [ Slow ] crbug.com/874695 http/tests/misc/async-script-removed.html [ Slow ] crbug.com/874695 http/tests/misc/client-hints-accept-meta-preloader.html [ Slow ] @@ -509,27 +493,6 @@ crbug.com/874695 media/video-controls-visibility-multimodal-mouse-after-touch.html [ Slow ] crbug.com/874695 media/video-controls-visibility-multimodal-touch-after-mouse.html [ Slow ] crbug.com/874695 media/video-played-collapse.html [ Slow ] -crbug.com/874695 virtual/audio-service/media/audio-controls-do-not-fade-out.html [ Slow ] -crbug.com/874695 virtual/audio-service/media/autoplay-muted.html [ Slow ] -crbug.com/874695 virtual/audio-service/media/color-profile-video-seek-filter.html [ Slow ] -crbug.com/874695 virtual/audio-service/media/controls/video-enter-exit-fullscreen-while-hovering-shows-controls.html [ Slow ] -crbug.com/874695 virtual/audio-service/media/encrypted-media/encrypted-media-onencrypted.html [ Slow ] -crbug.com/874695 virtual/audio-service/media/encrypted-media/encrypted-media-setmediakeys-at-same-time.html [ Slow ] -crbug.com/874695 virtual/audio-service/media/media-controls-tap-show-controls-without-activating.html [ Slow ] -crbug.com/874695 virtual/audio-service/media/media-ended.html [ Slow ] -crbug.com/874695 virtual/audio-service/media/remoteplayback/prompt-twice-throws.html [ Slow ] -crbug.com/874695 virtual/audio-service/media/track/track-cue-gc-wrapper.html [ Slow ] -crbug.com/874695 virtual/audio-service/media/unsupported-rtsp.html [ Slow ] -crbug.com/874695 virtual/audio-service/media/video-controls-always-visible-when-control-hovered.html [ Slow ] -crbug.com/874695 virtual/audio-service/media/video-controls-auto-hide-after-play-by-touch.html [ Slow ] -crbug.com/874695 virtual/audio-service/media/video-controls-dont-show-on-focus-when-disabled.html [ Slow ] -crbug.com/874695 virtual/audio-service/media/video-controls-focus-movement-on-hide.html [ Slow ] -crbug.com/874695 virtual/audio-service/media/video-controls-hide-after-touch-on-control.html [ Slow ] -crbug.com/874695 virtual/audio-service/media/video-controls-hide-on-move-outside-controls.html [ Slow ] -crbug.com/874695 virtual/audio-service/media/video-controls-show-on-focus.html [ Slow ] -crbug.com/874695 virtual/audio-service/media/video-controls-visibility-multimodal-mouse-after-touch.html [ Slow ] -crbug.com/874695 virtual/audio-service/media/video-controls-visibility-multimodal-touch-after-mouse.html [ Slow ] -crbug.com/874695 virtual/audio-service/media/video-played-collapse.html [ Slow ] crbug.com/874695 paint/invalidation/filters/filter-repaint-accelerated-child-with-filter-child.html [ Slow ] crbug.com/874695 paint/invalidation/filters/filter-repaint-accelerated-on-accelerated-filter.html [ Slow ] crbug.com/874695 paint/invalidation/filters/filter-repaint-on-accelerated-layer.html [ Slow ] @@ -641,7 +604,6 @@ crbug.com/893015 [ Linux ] virtual/streaming-preload/http/tests/fetch/chromium/response-text-gc-crash.html [ Slow ] crbug.com/914981 [ Mac ] media/controls/overflow-menu-pointer-selection.html [ Slow ] -crbug.com/914981 [ Mac ] virtual/audio-service/media/controls/overflow-menu-pointer-selection.html [ Slow ] crbug.com/914981 [ Mac ] virtual/mouseevent_fractional/fast/events/no-fake-mousemove.html [ Slow ] crbug.com/914981 [ Mac ] fast/events/no-fake-mousemove.html [ Slow ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 2f048a4..7ccaa44 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -39,7 +39,6 @@ # These two are left over from crbug.com/881040, I rebaselined them twice and # they continue to fail. crbug.com/881040 media/controls/lazy-loaded-style.html [ Failure Pass ] -crbug.com/881040 virtual/audio-service/media/controls/lazy-loaded-style.html [ Failure Pass ] # With --enable-display-compositor-pixel-dump enabled by default, these three # tests fail. See crbug.com/887140 for more info. @@ -76,10 +75,8 @@ crbug.com/801992 http/tests/misc/iframe-script-modify-attr.html [ Pass Crash ] crbug.com/819800 external/wpt/payment-request/allowpaymentrequest/setting-allowpaymentrequest-timing.https.sub.html [ Failure ] crbug.com/872952 http/tests/media/autoplay/document-user-activation-feature-policy-iframe-no-gesture.html [ Failure Pass Timeout ] -crbug.com/872952 virtual/audio-service/http/tests/media/autoplay/document-user-activation-feature-policy-iframe-no-gesture.html [ Failure Pass Timeout ] crbug.com/895001 external/wpt/html/user-activation/message-event-activation-api-iframe-cross-origin.sub.tentative.html [ Timeout Pass ] crbug.com/895001 http/tests/media/autoplay/webaudio-autoplay-iframe-with-gesture.html [ Timeout Pass ] -crbug.com/895001 virtual/audio-service/http/tests/media/autoplay/webaudio-autoplay-iframe-with-gesture.html [ Timeout Pass ] crbug.com/901502 http/tests/devtools/oopif/oopif-storage.js [ Pass Failure ] crbug.com/906879 http/tests/inspector-protocol/network/navigation-blocking-xorigin-iframe.js [ Pass Failure ] crbug.com/949003 http/tests/printing/cross-site-frame-scrolled.html [ Pass Failure ] @@ -538,13 +535,11 @@ crbug.com/949909 external/wpt/css/css-text-decor/text-decoration-040-manual.html [ Skip ] crbug.com/722825 media/controls/video-enter-exit-fullscreen-while-hovering-shows-controls.html [ Timeout Pass ] -crbug.com/722825 virtual/audio-service/media/controls/video-enter-exit-fullscreen-while-hovering-shows-controls.html [ Timeout Pass ] #### crbug.com/783229 overflow crbug.com/724701 overflow/overflow-basic-004.html [ Failure ] crbug.com/846753 [ Mac ] http/tests/media/reload-after-dialog.html [ Failure Pass Timeout ] -crbug.com/846753 [ Mac ] virtual/audio-service/http/tests/media/reload-after-dialog.html [ Failure Pass Timeout ] ### external/wpt/css/css-tables/ crbug.com/598134 external/wpt/css/css-tables/table-has-box-sizing-border-box-002.html [ Failure ] @@ -868,7 +863,6 @@ crbug.com/591099 [ Mac ] images/feature-policy-oversized-images-resize.html [ Failure ] crbug.com/974717 [ Linux ] images/feature-policy-oversized-images-resize.html [ Failure Pass ] # crbug.com/591099 [ Mac10.11 ] media/track/track-cue-rendering-position-auto-rtl.html [ Failure ] -crbug.com/591099 [ Mac10.11 ] virtual/audio-service/media/track/track-cue-rendering-position-auto-rtl.html [ Failure ] crbug.com/591099 [ Mac10.11 ] virtual/scalefactor200/fast/hidpi/static/popup-menu-appearance.html [ Failure ] crbug.com/591099 [ Mac10.13 ] compositing/geometry/root-layer-update.html [ Failure ] crbug.com/591099 [ Mac10.13 ] compositing/overlap-blending/reflection-opacity-huge.html [ Failure ] @@ -1176,9 +1170,7 @@ crbug.com/591099 [ Mac10.13 ] images/imagemap-focus-ring.html [ Failure ] crbug.com/591099 [ Mac10.13 ] images/imagemap-overflowing-polygon-focus-ring.html [ Failure ] crbug.com/591099 [ Mac10.13 ] media/video-colorspace-yuv420.html [ Failure ] -crbug.com/591099 [ Mac10.13 ] virtual/audio-service/media/video-colorspace-yuv420.html [ Failure ] crbug.com/591099 [ Mac10.13 ] media/video-empty-source.html [ Failure ] -crbug.com/591099 [ Mac10.13 ] virtual/audio-service/media/video-empty-source.html [ Failure ] crbug.com/591099 [ Mac10.13 ] paint/invalidation/background/background-misaligned.html [ Failure ] crbug.com/591099 [ Mac10.13 ] paint/invalidation/block-no-inflow-children.html [ Failure ] crbug.com/591099 [ Mac10.13 ] paint/invalidation/bugzilla-7235.html [ Failure ] @@ -2277,14 +2269,10 @@ crbug.com/280342 [ Mac ] http/tests/media/progress-events-generated-correctly.html [ Failure Pass ] crbug.com/280342 [ Linux ] http/tests/media/progress-events-generated-correctly.html [ Failure Pass ] crbug.com/280342 [ Win ] http/tests/media/progress-events-generated-correctly.html [ Failure Pass ] -crbug.com/280342 [ Mac ] virtual/audio-service/http/tests/media/progress-events-generated-correctly.html [ Failure Pass ] -crbug.com/280342 [ Linux ] virtual/audio-service/http/tests/media/progress-events-generated-correctly.html [ Failure Pass ] -crbug.com/280342 [ Win ] virtual/audio-service/http/tests/media/progress-events-generated-correctly.html [ Failure Pass ] crbug.com/520736 [ Win7 ] media/W3C/video/networkState/networkState_during_progress.html [ Failure Pass ] crbug.com/520736 [ Linux ] media/W3C/video/networkState/networkState_during_progress.html [ Failure Pass ] crbug.com/909095 [ Mac ] media/W3C/video/networkState/networkState_during_progress.html [ Failure Pass ] -crbug.com/909095 virtual/audio-service/media/W3C/video/networkState/networkState_during_progress.html [ Failure Pass ] crbug.com/862716 [ Mac ] css3/filters/effect-brightness-clamping-hw.html [ Failure Pass Timeout ] crbug.com/862716 [ Linux ] css3/filters/effect-brightness-clamping-hw.html [ Failure Pass Timeout ] @@ -2353,7 +2341,6 @@ crbug.com/432129 html/marquee/marquee-scroll.html [ Failure Pass ] crbug.com/326139 crbug.com/390125 media/video-frame-accurate-seek.html [ Failure Pass ] -crbug.com/326139 crbug.com/390125 virtual/audio-service/media/video-frame-accurate-seek.html [ Failure Pass ] crbug.com/421283 html/marquee/marquee-scrollamount.html [ Pass Failure ] # TODO(oshima): Mac Android are currently not supported. @@ -2435,7 +2422,6 @@ crbug.com/688613 external/wpt/mediacapture-streams/MediaStreamTrack-MediaElement-disabled-audio-is-silence.https.html [ Skip ] crbug.com/688613 virtual/feature-policy-permissions/external/wpt/mediacapture-streams/MediaStreamTrack-MediaElement-disabled-audio-is-silence.https.html [ Skip ] -crbug.com/688613 virtual/audio-service/external/wpt/mediacapture-streams/MediaStreamTrack-MediaElement-disabled-audio-is-silence.https.html [ Skip ] crbug.com/766135 fast/dom/Window/redirect-with-timer.html [ Timeout Pass ] @@ -2582,7 +2568,6 @@ crbug.com/467635 fast/dom/HTMLImageElement/image-sizes-meta-viewport.html [ Skip ] crbug.com/636239 [ Win7 ] media/video-zoom-controls.html [ Failure ] -crbug.com/636239 [ Win7 ] virtual/audio-service/media/video-zoom-controls.html [ Failure ] # The spec for "Propagation to the Initial Containing Block" was changed. # https://drafts.csswg.org/css-writing-modes-4/#icb @@ -2640,13 +2625,11 @@ crbug.com/658305 css3/filters/filter-effect-removed.html [ Failure Pass ] crbug.com/524160 [ Debug ] http/tests/media/media-source/stream_memory_tests/mediasource-appendbuffer-quota-exceeded-default-buffers.html [ Timeout ] -crbug.com/524160 [ Debug ] virtual/audio-service/http/tests/media/media-source/stream_memory_tests/mediasource-appendbuffer-quota-exceeded-default-buffers.html [ Timeout ] # Run the tests with the default MSE buffer sizes in the main test suite and the tests for 1MB buffers set via command line in a virtual test suite # with the --mse-audio-buffer-size-limit=1048576 and --mse-video-buffer-size-limit=1048576 command-line parameters. crbug.com/630342 virtual/mse-1mb-buffers/http/tests/media/media-source/stream_memory_tests/mediasource-appendbuffer-quota-exceeded-default-buffers.html [ Skip ] crbug.com/630342 http/tests/media/media-source/stream_memory_tests/mediasource-appendbuffer-quota-exceeded-1mb-buffers.html [ Skip ] -crbug.com/630342 virtual/audio-service/http/tests/media/media-source/stream_memory_tests/mediasource-appendbuffer-quota-exceeded-1mb-buffers.html [ Skip ] # On these platforms (all but Android) media tests don't currently use gpu-accelerated (proprietary) codecs, so no # benefit to running them again with gpu acceleration enabled. @@ -2658,9 +2641,7 @@ crbug.com/467477 fast/multicol/vertical-rl/nested-columns.html [ Failure ] crbug.com/400841 media/video-canvas-draw.html [ Failure ] -crbug.com/400841 virtual/audio-service/media/video-canvas-draw.html [ Failure ] crbug.com/400829 virtual/stable/media/stable/video-object-fit-stable.html [ Failure ] -crbug.com/400829 virtual/audio-service/media/stable/video-object-fit-stable.html [ Failure ] # These contain faulty expectations. https://chromium-review.googlesource.com/c/v8/v8/+/1350790 should fix the # faulty return values but to allow landing that patch, the tests have to be deactivated in the meanwhile. @@ -3039,18 +3020,12 @@ crbug.com/654477 fast/layers/video-layer.html [ Failure ] # These could likely be removed - see https://chromium-review.googlesource.com/c/chromium/src/+/1252141 crbug.com/654477 media/controls-focus-ring.html [ Failure ] -crbug.com/654477 virtual/audio-service/media/controls-focus-ring.html [ Failure ] crbug.com/654477 [ Mac10.10 ] http/tests/media/video-buffered-range-contains-currentTime.html [ Failure ] crbug.com/654477 [ Mac10.11 ] http/tests/media/video-buffered-range-contains-currentTime.html [ Failure ] crbug.com/654477 [ Retina ] http/tests/media/video-buffered-range-contains-currentTime.html [ Failure ] crbug.com/638621 [ Win7 ] http/tests/media/video-buffered-range-contains-currentTime.html [ Failure ] -crbug.com/654477 [ Mac10.10 ] virtual/audio-service/http/tests/media/video-buffered-range-contains-currentTime.html [ Failure ] -crbug.com/654477 [ Mac10.11 ] virtual/audio-service/http/tests/media/video-buffered-range-contains-currentTime.html [ Failure ] -crbug.com/654477 [ Retina ] virtual/audio-service/http/tests/media/video-buffered-range-contains-currentTime.html [ Failure ] -crbug.com/638621 [ Win7 ] virtual/audio-service/http/tests/media/video-buffered-range-contains-currentTime.html [ Failure ] crbug.com/637930 http/tests/media/video-buffered.html [ Pass Failure ] -crbug.com/637930 virtual/audio-service/http/tests/media/video-buffered.html [ Pass Failure ] crbug.com/613659 external/wpt/quirks/percentage-height-calculation.html [ Failure ] crbug.com/613661 external/wpt/quirks/table-cell-nowrap-minimum-width-calculation.html [ Failure ] @@ -3605,7 +3580,6 @@ crbug.com/626703 external/wpt/webvtt/rendering/cues-with-video/processing-model/bidi/start_alignment.html [ Failure ] crbug.com/626703 [ Retina ] external/wpt/html/browsers/the-window-object/apis-for-creating-and-navigating-browsing-contexts-by-name/open-features-tokenization-top-left.html [ Timeout ] crbug.com/626703 external/wpt/mediacapture-streams/MediaStream-MediaElement-srcObject.https.html [ Timeout ] -crbug.com/626703 virtual/audio-service/external/wpt/mediacapture-streams/MediaStream-MediaElement-srcObject.https.html [ Timeout ] crbug.com/626703 virtual/feature-policy-permissions/external/wpt/mediacapture-streams/MediaStream-MediaElement-srcObject.https.html [ Timeout ] crbug.com/626703 [ Linux ] external/wpt/html/cross-origin/anonymous.tentative.html [ Failure Crash ] crbug.com/626703 [ Mac10.12 ] external/wpt/html/cross-origin/anonymous.tentative.html [ Failure Crash ] @@ -4875,8 +4849,6 @@ #crbug.com/765738 [ Linux Win Mac ] http/tests/wasm/wasm_remote_postMessage_test.https.html [ Pass Timeout ] crbug.com/892212 http/tests/wasm/wasm_remote_postMessage_test.https.html [ Pass Failure Timeout ] -crbug.com/990331 virtual/audio-service/http/tests/media/media-source/mediasource-play.html [ Pass Timeout ] - # ====== Random order flaky tests from here ====== # These tests are flaky when run in random order, which is the default on Linux & Mac since since 2016-12-16. @@ -4957,7 +4929,6 @@ crbug.com/689781 external/wpt/media-source/mediasource-duration.html [ Failure Pass ] crbug.com/689781 [ Win Mac ] http/tests/media/media-source/mediasource-duration.html [ Failure Pass ] -crbug.com/689781 [ Win Mac ] virtual/audio-service/http/tests/media/media-source/mediasource-duration.html [ Failure Pass ] crbug.com/681468 fast/forms/suggestion-picker/date-suggestion-picker-appearance-zoom125.html [ Failure Pass ] crbug.com/681468 fast/forms/suggestion-picker/date-suggestion-picker-appearance-zoom200.html [ Failure Pass ] @@ -5002,7 +4973,6 @@ # Sheriff failures 2017-02-21 crbug.com/73609 http/tests/media/video-play-stall.html [ Pass Timeout ] -crbug.com/73609 virtual/audio-service/http/tests/media/video-play-stall.html [ Pass Timeout ] # Sheriff failures 2017-03-10 crbug.com/741210 [ Mac ] inspector-protocol/emulation/device-emulation-restore.js [ Failure ] @@ -5023,7 +4993,6 @@ crbug.com/722212 virtual/mouseevent_fractional/fast/events/pointerevents/mouse-pointer-event-properties.html [ Failure Timeout Pass ] # Crashes on win crbug.com/722943 media/audio-repaint.html [ Skip ] -crbug.com/722943 virtual/audio-service/media/audio-repaint.html [ Skip ] # Sheriff failures 2018-08-13 crbug.com/873454 css3/filters/effect-reference-image-hw.html [ Failure Pass ] @@ -5050,7 +5019,6 @@ crbug.com/718155 fullscreen/full-screen-iframe-not-allowed.html [ Failure ] crbug.com/718155 fullscreen/full-screen-restrictions.html [ Failure Timeout ] crbug.com/718155 media/video-controls-fullscreen-iframe-not-allowed.html [ Failure ] -crbug.com/718155 virtual/audio-service/media/video-controls-fullscreen-iframe-not-allowed.html [ Failure ] crbug.com/718155 virtual/android/fullscreen/full-screen-iframe-not-allowed.html [ Failure ] crbug.com/718155 virtual/android/fullscreen/full-screen-restrictions.html [ Failure Timeout ] @@ -5113,9 +5081,7 @@ crbug.com/745887 [ Win ] fast/frames/sandboxed-iframe-plugins.html [ Failure Pass ] crbug.com/746128 [ Win7 Debug ] media/controls/video-enter-exit-fullscreen-without-hovering-doesnt-show-controls.html [ Failure ] -crbug.com/746128 [ Win7 Debug ] virtual/audio-service/media/controls/video-enter-exit-fullscreen-without-hovering-doesnt-show-controls.html [ Failure ] crbug.com/746128 [ Mac ] media/controls/video-enter-exit-fullscreen-without-hovering-doesnt-show-controls.html [ Failure Pass ] -crbug.com/746128 [ Mac ] virtual/audio-service/media/controls/video-enter-exit-fullscreen-without-hovering-doesnt-show-controls.html [ Failure Pass ] crbug.com/731018 [ Mac ] sensor/accelerometer.html [ Failure Pass Crash ] crbug.com/731018 [ Mac ] sensor/ambient-light-sensor.html [ Failure Pass Crash ] @@ -5125,17 +5091,12 @@ # Tests failing when enabling new modern media controls crbug.com/831942 media/webkit-media-controls-webkit-appearance.html [ Failure Pass ] -crbug.com/831942 virtual/audio-service/media/webkit-media-controls-webkit-appearance.html [ Failure Pass ] crbug.com/831957 compositing/video/video-controls-layer-creation-squashing.html [ Failure Pass ] crbug.com/832157 external/wpt/html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-added.html [ Skip ] crbug.com/832169 media/media-controls-fit-properly-while-zoomed.html [ Failure Pass ] -crbug.com/832169 virtual/audio-service/media/media-controls-fit-properly-while-zoomed.html [ Failure Pass ] crbug.com/832447 media/controls/controls-page-zoom-in.html [ Failure Pass ] crbug.com/832447 media/controls/controls-page-zoom-out.html [ Failure Pass ] -crbug.com/832447 virtual/audio-service/media/controls/controls-page-zoom-in.html [ Failure Pass ] -crbug.com/832447 virtual/audio-service/media/controls/controls-page-zoom-out.html [ Failure Pass ] crbug.com/849694 [ Mac ] http/tests/media/controls/toggle-class-with-state-source-buffer.html [ Failure Pass ] -crbug.com/849694 [ Mac ] virtual/audio-service/http/tests/media/controls/toggle-class-with-state-source-buffer.html [ Failure Pass ] # ContentSecurityPolicy modifies the SchemeRegistry before some initialization. crbug.com/686118 http/tests/security/contentSecurityPolicy/register-bypassing-scheme.html [ Pass Crash ] @@ -5248,9 +5209,6 @@ crbug.com/694855 media/audio-src-suspend-after-have-metadata.html [ Skip ] crbug.com/694855 media/video-src-skip-suspend-after-have-metadata.html [ Skip ] crbug.com/694855 media/video-src-suspend-after-have-metadata.html [ Skip ] -crbug.com/694855 virtual/audio-service/media/audio-src-suspend-after-have-metadata.html [ Skip ] -crbug.com/694855 virtual/audio-service/media/video-src-skip-suspend-after-have-metadata.html [ Skip ] -crbug.com/694855 virtual/audio-service/media/video-src-suspend-after-have-metadata.html [ Skip ] ### See crbug.com/891427 comment near the top of this file: ###crbug.com/849979 media/video-layer-crash.html [ Pass Timeout ] @@ -5300,7 +5258,6 @@ # Sheriff failures 2017-10-23 crbug.com/772411 http/tests/media/autoplay-crossorigin.html [ Timeout Failure Pass ] -crbug.com/772411 virtual/audio-service/http/tests/media/autoplay-crossorigin.html [ Timeout Failure Pass ] crbug.com/777222 http/tests/devtools/inspect-iframe-from-different-domain.js [ Pass Failure Timeout ] crbug.com/778745 http/tests/inspector-protocol/cachestorage/read-cached-response.js [ Pass Failure ] @@ -5377,12 +5334,6 @@ crbug.com/783154 [ Mac ] media/controls/doubletap-on-play-button.html [ Skip ] crbug.com/783154 [ Mac ] media/controls/doubletap-to-toggle-fullscreen.html [ Skip ] crbug.com/783154 [ Mac ] media/controls/click-anywhere-to-play-pause.html [ Skip ] -crbug.com/783154 [ Mac ] virtual/audio-service/media/controls/doubletap-to-jump-backwards.html [ Skip ] -crbug.com/783154 [ Mac ] virtual/audio-service/media/controls/doubletap-to-jump-forwards.html [ Skip ] -crbug.com/783154 [ Mac ] virtual/audio-service/media/controls/doubletap-to-jump-forwards-too-short.html [ Skip ] -crbug.com/783154 [ Mac ] virtual/audio-service/media/controls/doubletap-on-play-button.html [ Skip ] -crbug.com/783154 [ Mac ] virtual/audio-service/media/controls/doubletap-to-toggle-fullscreen.html [ Skip ] -crbug.com/783154 [ Mac ] virtual/audio-service/media/controls/click-anywhere-to-play-pause.html [ Skip ] # Seen flaky on Linux, suppressing on Windows as well crbug.com/831720 [ Win ] media/controls/doubletap-to-jump-forwards-too-short.html [ Pass Failure ] @@ -5390,11 +5341,6 @@ crbug.com/831720 [ Mac ] media/controls/tap-to-hide-controls.html [ Pass Failure ] crbug.com/831720 [ Win ] media/controls/tap-to-hide-controls.html [ Pass Failure ] crbug.com/831720 [ Linux ] media/controls/tap-to-hide-controls.html [ Pass Failure ] -crbug.com/831720 [ Win ] virtual/audio-service/media/controls/doubletap-to-jump-forwards-too-short.html [ Pass Failure ] -crbug.com/831720 [ Linux ] virtual/audio-service/media/controls/doubletap-to-jump-forwards-too-short.html [ Pass Failure ] -crbug.com/831720 [ Mac ] virtual/audio-service/media/controls/tap-to-hide-controls.html [ Pass Failure ] -crbug.com/831720 [ Win ] virtual/audio-service/media/controls/tap-to-hide-controls.html [ Pass Failure ] -crbug.com/831720 [ Linux ] virtual/audio-service/media/controls/tap-to-hide-controls.html [ Pass Failure ] crbug.com/802915 css3/blending/isolation-should-include-non-local-background.html [ Failure ] @@ -5405,7 +5351,6 @@ # Does not work on Mac crbug.com/793771 [ Mac ] media/controls/scrubbing.html [ Skip ] -crbug.com/793771 [ Mac Win ] virtual/audio-service/media/controls/scrubbing.html [ Skip ] # Different paths may have different anti-aliasing pixels 2018-02-21 skbug.com/7641 external/wpt/css/css-paint-api/paint2d-paths.https.html [ Failure Pass ] @@ -5424,7 +5369,6 @@ # Sheriff failures 2018-02-20 crbug.com/789921 media/controls/repaint-on-resize.html [ Failure Pass ] -crbug.com/789921 virtual/audio-service/media/controls/repaint-on-resize.html [ Failure Pass ] # Sheriff failures 2018-02-21 crbug.com/814585 [ Linux ] fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-cjk.html [ Pass Failure ] @@ -5451,9 +5395,7 @@ crbug.com/807110 external/wpt/media-source/mediasource-sequencemode-append-buffer.html [ Failure Pass ] crbug.com/807110 external/wpt/media-source/mediasource-sourcebuffer-mode-timestamps.html [ Failure Pass ] crbug.com/794338 media/video-rotation.html [ Failure Pass ] -crbug.com/794338 virtual/audio-service/media/video-rotation.html [ Failure Pass ] crbug.com/811605 media/video-poster-after-loadedmetadata.html [ Failure Pass ] -crbug.com/811605 virtual/audio-service/media/video-poster-after-loadedmetadata.html [ Failure Pass ] crbug.com/813704 http/tests/images/png-partial-load-as-document.html [ Failure Pass ] @@ -5488,8 +5430,6 @@ # Sheriff 2018-03-22 crbug.com/824775 [ Win ] media/controls/video-controls-with-cast-rendering.html [ Pass Failure ] crbug.com/824775 [ Mac ] media/controls/video-controls-with-cast-rendering.html [ Pass Failure ] -crbug.com/824775 [ Win ] virtual/audio-service/media/controls/video-controls-with-cast-rendering.html [ Pass Failure ] -crbug.com/824775 [ Mac ] virtual/audio-service/media/controls/video-controls-with-cast-rendering.html [ Pass Failure ] crbug.com/824848 [ Linux ] external/wpt/html/semantics/links/following-hyperlinks/activation-behavior.window.html [ Pass Failure ] crbug.com/824848 [ Mac ] external/wpt/html/semantics/links/following-hyperlinks/activation-behavior.window.html [ Pass Failure ] crbug.com/824848 [ Win ] external/wpt/html/semantics/links/following-hyperlinks/activation-behavior.window.html [ Pass Failure ] @@ -5510,9 +5450,7 @@ # Sheriff 2018-03-26 crbug.com/825733 [ Win ] media/color-profile-video-seek-filter.html [ Pass Timeout Failure ] -crbug.com/825733 [ Win ] virtual/audio-service/media/color-profile-video-seek-filter.html [ Pass Timeout Failure ] crbug.com/754986 media/video-transformed.html [ Pass Failure ] -crbug.com/754986 virtual/audio-service/media/video-transformed.html [ Pass Failure ] # Sheriff 2018-03-29 crbug.com/827209 [ Win ] fast/events/middleClickAutoscroll-latching.html [ Pass Timeout Failure ] @@ -5553,10 +5491,6 @@ crbug.com/833658 [ Linux ] media/video-controls-focus-movement-on-hide.html [ Pass Failure ] crbug.com/833658 [ Win ] media/video-controls-focus-movement-on-hide.html [ Pass Failure ] crbug.com/833658 [ Mac ] media/video-controls-focus-movement-on-hide.html [ Pass Failure ] -crbug.com/833655 [ Linux ] virtual/audio-service/media/controls/closed-captions-dynamic-update.html [ Skip ] -crbug.com/833658 [ Linux ] virtual/audio-service/media/video-controls-focus-movement-on-hide.html [ Pass Failure ] -crbug.com/833658 [ Win ] virtual/audio-service/media/video-controls-focus-movement-on-hide.html [ Pass Failure ] -crbug.com/833658 [ Mac ] virtual/audio-service/media/video-controls-focus-movement-on-hide.html [ Pass Failure ] # Sheriff 2018-04-23 crbug.com/833331 [ Win10 ] inspector-protocol/page/pageNavigateToFragment.js [ Pass Failure ] @@ -5847,7 +5781,6 @@ # Sheriff 2018-11-26 crbug.com/908276 [ Mac ] external/wpt/webstorage/storage_setitem.html [ Pass Timeout ] crbug.com/908347 media/autoplay/webaudio-audio-context-resume.html [ Failure Pass ] -crbug.com/908347 virtual/audio-service/media/autoplay/webaudio-audio-context-resume.html [ Failure Pass ] # Sheriff 2018-11-29 crbug.com/910139 custom-elements/form-submission-file.html [ Crash Pass ] @@ -5868,7 +5801,6 @@ # Sheriff 2018-12-13 crbug.com/910452 media/controls/buttons-after-reset.html [ Pass Failure ] -crbug.com/910452 virtual/audio-service/media/controls/buttons-after-reset.html [ Pass Failure ] crbug.com/914782 [ Linux ] fast/scrolling/no-hover-during-scroll.html [ Pass Failure ] # Sheriff 2018-12-14 @@ -5946,9 +5878,6 @@ crbug.com/922951 media/controls/overflow-menu-hide-on-click-outside-stoppropagation.html [ Skip ] crbug.com/922951 media/controls/overflow-menu-hide-on-click-outside.html [ Skip ] crbug.com/922951 media/controls/overflow-menu-toggle-class-for-animation.html [ Skip ] -crbug.com/922951 virtual/audio-service/media/controls/overflow-menu-hide-on-click-outside-stoppropagation.html [ Skip ] -crbug.com/922951 virtual/audio-service/media/controls/overflow-menu-hide-on-click-outside.html [ Skip ] -crbug.com/922951 virtual/audio-service/media/controls/overflow-menu-toggle-class-for-animation.html [ Skip ] crbug.com/922951 scrollbars/resize-scales-with-dpi-150.html [ Skip ] crbug.com/922951 svg/animations/dynamic-modify-transform-without-baseval.html [ Skip ] crbug.com/922951 svg/animations/target-condition-crash.html [ Skip ] @@ -6032,7 +5961,6 @@ # Sheriff 2019-02-12 crbug.com/931349 [ Mac ] media/video-played-ranges-1.html [ Failure Timeout Pass ] -crbug.com/931349 [ Mac ] virtual/audio-service/media/video-played-ranges-1.html [ Failure Timeout Pass ] # Sheriff 2019-02-13 crbug.com/931646 [ Win7 ] http/tests/preload/meta-viewport-link-headers-imagesrcset.html [ Failure Pass ] @@ -6069,7 +5997,6 @@ # Sheriff 2019-02-26 crbug.com/936083 external/wpt/import-maps/builtin-import-scheme.tentative.html [ Failure Pass ] crbug.com/936165 media/autoplay-muted.html [ Timeout Pass ] -crbug.com/936165 virtual/audio-service/media/autoplay-muted.html [ Timeout Pass ] # Sheriff 2019-02-27 crbug.com/936279 external/wpt/import-maps/fallback-disallowed.sub.tentative.html [ Failure Pass Timeout ] @@ -6102,7 +6029,6 @@ # Caused a revert of a good change. crbug.com/931533 media/video-played-collapse.html [ Pass Failure ] -crbug.com/931533 virtual/audio-service/media/video-played-collapse.html [ Pass Failure ] # Test was blocking WPT importer crbug.com/941471 external/wpt/css/css-transforms/transform-flattening-001.html [ Pass Failure Crash ] @@ -6160,7 +6086,6 @@ crbug.com/919789 images/image-zoom-to-25.html [ Pass Timeout ] crbug.com/919789 images/image-zoom-to-500.html [ Pass Timeout ] crbug.com/919789 media/controls/overflow-menu-hide-on-resize.html [ Pass Timeout ] -crbug.com/919789 virtual/audio-service/media/controls/overflow-menu-hide-on-resize.html [ Pass Timeout ] crbug.com/919789 [ Linux Mac10.13 ] paint/invalidation/resize-iframe-text.html [ Pass Timeout ] crbug.com/919789 paint/invalidation/scroll/scrollbar-damage-and-full-viewport-repaint.html [ Pass Timeout ] crbug.com/919789 paint/invalidation/window-resize/ [ Pass Timeout ] @@ -6287,14 +6212,9 @@ crbug.com/963141 media/video-object-fit-change.html [ Pass Failure ] crbug.com/963141 [ Mac Win ] media/controls/video-overlay-cast-light-rendering.html [ Pass Failure ] crbug.com/963141 [ Mac ] media/video-aspect-ratio.html [ Pass Failure ] -crbug.com/963141 [ Mac Win ] virtual/audio-service/media/video-object-fit.html [ Pass Failure ] -crbug.com/963141 virtual/audio-service/media/video-object-fit-change.html [ Pass Failure ] -crbug.com/963141 [ Mac Win ] virtual/audio-service/media/controls/video-overlay-cast-light-rendering.html [ Pass Failure ] -crbug.com/963141 [ Mac ] virtual/audio-service/media/video-aspect-ratio.html [ Pass Failure ] # Sheriff 2019-05-16 crbug.com/963141 [ Linux ] media/video-object-fit.html [ Pass Failure ] -crbug.com/963141 [ Linux ] virtual/audio-service/media/video-object-fit.html [ Pass Failure ] crbug.com/963740 compositing/video-frame-size-change.html [ Pass Failure ] # Sheriff 2019-05-17 @@ -6311,7 +6231,6 @@ crbug.com/963739 [ Fuchsia ] synthetic_gestures/smooth-scroll-tiny-delta.html [ Pass Timeout ] crbug.com/964239 external/wpt/css/css-scroll-snap/scroll-margin.html [ Pass Failure ] crbug.com/965389 [ Mac ] media/track/track-cue-rendering-position-auto.html [ Pass Failure ] -crbug.com/965389 [ Mac ] virtual/audio-service/media/track/track-cue-rendering-position-auto.html [ Pass Failure ] # Sheriff 2019-05-27 crbug.com/942411 [ Win ] http/tests/devtools/network/network-search.js [ Pass Timeout ] @@ -6334,10 +6253,8 @@ # Sheriff 2019-06-05 crbug.com/971259 media/controls/volumechange-stopimmediatepropagation.html [ Pass Failure ] -crbug.com/971259 virtual/audio-service/media/controls/volumechange-stopimmediatepropagation.html [ Pass Failure ] crbug.com/971262 http/tests/devtools/profiler/live-line-level-heap-profile.js [ Pass Timeout ] crbug.com/971319 [ Mac ] media/audio-garbage-collect.html [ Pass Timeout ] -crbug.com/971319 [ Mac ] virtual/audio-service/media/audio-garbage-collect.html [ Pass Timeout ] # Sheriff 2019-06-06 crbug.com/971590 fast/dom/timer-throttling-out-of-view-cross-origin-page.html [ Pass Failure ] @@ -6448,9 +6365,6 @@ crbug.com/986477 [ Win ] external/wpt/cookies/path/match.html [ Pass Timeout ] crbug.com/986477 [ Win ] virtual/samesite-by-default-cookies/external/wpt/cookies/path/match.html [ Pass Timeout ] - -crbug.com/987269 [ Linux ] virtual/audio-service/http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-disabled.html [ Pass Failure ] -crbug.com/987269 [ Linux ] virtual/audio-service/http/tests/media/autoplay/document-user-activation-cross-origin-feature-policy-header.html [ Pass Failure ] # Sheriff 2019-07-24 crbug.com/986019 animations/play-state.html [ Pass Timeout ] crbug.com/986019 virtual/threaded/animations/play-state.html [ Pass Timeout ] @@ -6459,7 +6373,6 @@ crbug.com/987132 [ Mac ] fast/forms/select/option-strip-whitespace.html [ Failure ] crbug.com/986282 external/wpt/client-hints/accept-ch-lifetime.tentative.https.html [ Pass Failure ] crbug.com/987138 [ Linux Win ] media/controls/doubletap-to-jump-forwards.html [ Pass Timeout ] -crbug.com/987138 [ Linux Win ] virtual/audio-service/media/controls/doubletap-to-jump-forwards.html [ Pass Timeout ] # Sheriff 2019-07-26 crbug.com/835943 [ Debug ] http/tests/appcache/non-html.xhtml [ Crash Pass ] @@ -6603,3 +6516,5 @@ crbug.com/990145 [ Linux ] virtual/blink-cors/http/tests/fetch/serviceworker-proxied/thorough/cookie-base-https-other-https.html [ Pass Failure ] crbug.com/990145 [ Linux ] virtual/streaming-preload/http/tests/fetch/serviceworker-proxied/thorough/cookie-base-https-other-https.html [ Pass Failure ] crbug.com/990146 [ Linux ] virtual/blink-cors/http/tests/fetch/serviceworker/thorough/cookie-nocors-base-https-other-https.html [ Pass Failure ] +crbug.com/989863 [ Linux ] virtual/blink-cors/http/tests/fetch/serviceworker/thorough/redirect-loop-base-https-other-https.html [ Pass Failure ] +crbug.com/989863 [ Linux ] virtual/blink-cors/http/tests/fetch/serviceworker/thorough/access-control-base-https-other-https.html [ Pass Failure ]
diff --git a/third_party/blink/web_tests/VirtualTestSuites b/third_party/blink/web_tests/VirtualTestSuites index 105b1be3..d2d5139 100644 --- a/third_party/blink/web_tests/VirtualTestSuites +++ b/third_party/blink/web_tests/VirtualTestSuites
@@ -1212,20 +1212,5 @@ "prefix": "conditional-appcache-delay", "base": "http/tests/loading/appcache-delay", "args": ["--enable-features=VerifyHTMLFetchedFromAppCacheBeforeDelay"] - }, - { - "prefix": "audio-service", - "base": "http/tests/media", - "args": ["--enable-features=AudioServiceOutOfProcess,AudioServiceSandbox"] - }, - { - "prefix": "audio-service", - "base": "media", - "args": ["--enable-features=AudioServiceOutOfProcess,AudioServiceSandbox"] - }, - { - "prefix": "audio-service", - "base": "external/wpt/mediacapture-streams", - "args": ["--enable-features=AudioServiceOutOfProcess,AudioServiceSandbox"] } ]
diff --git a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json index 31e50de..c6d305a9 100644 --- a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json +++ b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_6.json
@@ -60683,6 +60683,18 @@ {} ] ], + "css/css-pseudo/before-dynamic-display-none.html": [ + [ + "css/css-pseudo/before-dynamic-display-none.html", + [ + [ + "/css/reference/pass_if_pass_below.html", + "==" + ] + ], + {} + ] + ], "css/css-pseudo/first-letter-001.html": [ [ "css/css-pseudo/first-letter-001.html", @@ -214915,6 +214927,24 @@ {} ] ], + "css/cssom-view/parsing/scroll-behavior-computed.html": [ + [ + "css/cssom-view/parsing/scroll-behavior-computed.html", + {} + ] + ], + "css/cssom-view/parsing/scroll-behavior-invalid.html": [ + [ + "css/cssom-view/parsing/scroll-behavior-invalid.html", + {} + ] + ], + "css/cssom-view/parsing/scroll-behavior-valid.html": [ + [ + "css/cssom-view/parsing/scroll-behavior-valid.html", + {} + ] + ], "css/cssom-view/position-sticky-root-scroller-with-scroll-behavior.html": [ [ "css/cssom-view/position-sticky-root-scroller-with-scroll-behavior.html", @@ -286942,6 +286972,12 @@ {} ] ], + "svg/animations/correct-events-for-short-animations-with-syncbases.html": [ + [ + "svg/animations/correct-events-for-short-animations-with-syncbases.html", + {} + ] + ], "svg/animations/scripted/end-element-on-inactive-element.svg": [ [ "svg/animations/scripted/end-element-on-inactive-element.svg", @@ -371542,6 +371578,10 @@ "ae3222595453ec46cf48810cb2f276126897bac6", "support" ], + "css/css-pseudo/before-dynamic-display-none.html": [ + "d8844f9c961e94b2fd353628cb2c6e3e12123054", + "reftest" + ], "css/css-pseudo/first-letter-001-ref.html": [ "d832a308ef93d85437ea23fccc70447b0c2a339f", "support" @@ -401982,6 +402022,18 @@ "3b062c7548f1485269b4b74570975beab4d0760f", "testharness" ], + "css/cssom-view/parsing/scroll-behavior-computed.html": [ + "ffea289ea0bf1e5b443c3f0a02151ddfa06638c2", + "testharness" + ], + "css/cssom-view/parsing/scroll-behavior-invalid.html": [ + "6dfe36e21100efd31a058d5f3e1bcd5c50efd7e6", + "testharness" + ], + "css/cssom-view/parsing/scroll-behavior-valid.html": [ + "6e708b9d81c31420c7e6b80f9b8a90a73fb21e2f", + "testharness" + ], "css/cssom-view/position-sticky-root-scroller-with-scroll-behavior.html": [ "ec1f6e2f40f32b77676ae545fd095987117d4ffe", "testharness" @@ -474402,6 +474454,10 @@ "ee86b537ae987483687cc8ba6181db82f99ab162", "support" ], + "svg/animations/correct-events-for-short-animations-with-syncbases.html": [ + "96552df4a7c35a264722848a17573e4278bddbbf", + "testharness" + ], "svg/animations/scripted/end-element-on-inactive-element.svg": [ "34be9b9781f707d488e284c3285b82009557366b", "testharness" @@ -481155,7 +481211,7 @@ "support" ], "tools/wptrunner/wptrunner/metadata.py": [ - "3e9adf65243ef260aec9aa3d928fcaa21fc9fe80", + "ca6165f7ad09bb831552177d0df6e6dde8a80e52", "support" ], "tools/wptrunner/wptrunner/products.py": [ @@ -481207,7 +481263,7 @@ "support" ], "tools/wptrunner/wptrunner/update/metadata.py": [ - "63070051dce540e6da918f63c132746363d96543", + "4bc70d311040d3397e1d0120ad82d40124705190", "support" ], "tools/wptrunner/wptrunner/update/state.py": [ @@ -481223,7 +481279,7 @@ "support" ], "tools/wptrunner/wptrunner/update/update.py": [ - "3b76c7ef0dfe45fbaa20ecd25b6fab6769cb43b6", + "c4f1e7e93ec5b93efede7853103cb48ff52c0767", "support" ], "tools/wptrunner/wptrunner/vcs.py": [ @@ -481235,7 +481291,7 @@ "support" ], "tools/wptrunner/wptrunner/wptcommandline.py": [ - "b8f11d025f00c1108205b78da1ac785f7debc66a", + "5ac29b302e65a7e6fd8330e4ad787233de7d5ec6", "support" ], "tools/wptrunner/wptrunner/wptlogging.py": [
diff --git a/third_party/blink/web_tests/external/wpt/css/css-overscroll-behavior/inheritance.html b/third_party/blink/web_tests/external/wpt/css/css-overscroll-behavior/inheritance.html index e49fa49..823d623 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-overscroll-behavior/inheritance.html +++ b/third_party/blink/web_tests/external/wpt/css/css-overscroll-behavior/inheritance.html
@@ -15,6 +15,8 @@ <div id="target"></div> </div> <script> +assert_not_inherited('overscroll-behavior-block', 'auto', 'contain'); +assert_not_inherited('overscroll-behavior-inline', 'auto', 'contain'); assert_not_inherited('overscroll-behavior-x', 'auto', 'contain'); assert_not_inherited('overscroll-behavior-y', 'auto', 'contain'); </script>
diff --git a/third_party/blink/web_tests/external/wpt/resources/SVGAnimationTestCase-testharness.js b/third_party/blink/web_tests/external/wpt/resources/SVGAnimationTestCase-testharness.js new file mode 100644 index 0000000..8fabc9a --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/resources/SVGAnimationTestCase-testharness.js
@@ -0,0 +1,100 @@ +// NOTE(edvardt): +// This file is a slimmed down wrapper for the Chromium SVGAnimationTestCase.js, +// it has some convenience functions and should not be used for new tests. +// New tests should not build on this API as it's just meant to keep things +// working. + +// Helper functions +const xlinkNS = "http://www.w3.org/1999/xlink" + +function expectFillColor(element, red, green, blue) { + let color = window.getComputedStyle(element, null).fill; + var re = new RegExp("rgba?\\(([^, ]*), ([^, ]*), ([^, ]*)(?:, )?([^, ]*)\\)"); + rgb = re.exec(color); + assert_approx_equals(Number(rgb[1]), red, 2.0); + assert_approx_equals(Number(rgb[2]), green, 2.0); + assert_approx_equals(Number(rgb[3]), blue, 2.0); +} + +function expectColor(element, red, green, blue, property) { + if (typeof property != "string") + color = getComputedStyle(element).getPropertyValue("color"); + else + color = getComputedStyle(element).getPropertyValue(property); + var re = new RegExp("rgba?\\(([^, ]*), ([^, ]*), ([^, ]*)(?:, )?([^, ]*)\\)"); + rgb = re.exec(color); + assert_approx_equals(Number(rgb[1]), red, 2.0); + assert_approx_equals(Number(rgb[2]), green, 2.0); + assert_approx_equals(Number(rgb[3]), blue, 2.0); +} + +function createSVGElement(type) { + return document.createElementNS("http://www.w3.org/2000/svg", type); +} + +function moveAnimationTimelineAndSample(index) { + var animationId = expectedResults[index][0]; + var time = expectedResults[index][1]; + var sampleCallback = expectedResults[index][2]; + var animation = rootSVGElement.ownerDocument.getElementById(animationId); + + // If we want to sample the animation end, add a small delta, to reliable point past the end of the animation. + newTime = time; + + // The sample time is relative to the start time of the animation, take that into account. + rootSVGElement.setCurrentTime(newTime); + + // NOTE(edvardt): + // This is a dumb hack, some of the old tests sampled before the animation start, this + // isn't technically part of the animation tests and is "impossible" to translate since + // tests start automatically. Thus I solved it by skipping it. + if (time != 0.0) + sampleCallback(); +} + +var currentTest = 0; +var expectedResults; + +function sampleAnimation(t) { + if (currentTest == expectedResults.length) { + t.done(); + return; + } + + moveAnimationTimelineAndSample(currentTest); + ++currentTest; + + step_timeout(t.step_func(function () { sampleAnimation(t); }), 0); +} + +function runAnimationTest(t, expected) { + if (!expected) + throw("Expected results are missing!"); + if (currentTest > 0) + throw("Not allowed to call runAnimationTest() twice"); + + expectedResults = expected; + testCount = expectedResults.length; + currentTest = 0; + + step_timeout(t.step_func(function () { sampleAnimation(this); }), 50); +} + +function smil_async_test(func) { + async_test(t => { + window.onload = t.step_func(function () { + // Pause animations, we'll drive them manually. + // This also ensures that the timeline is paused before + // it starts. This should make the instance time of the below + // 'click' (for instance) 0, and hence minimize rounding + // errors for the addition in moveAnimationTimelineAndSample. + rootSVGElement.pauseAnimations(); + + // If eg. an animation is running with begin="0s", and + // we want to sample the first time, before the animation + // starts, then we can't delay the testing by using an + // onclick event, as the animation would be past start time. + func(t); + }); + }); +}
diff --git a/third_party/blink/web_tests/svg/animations/svgnumberoptionalnumber-animation-4.html b/third_party/blink/web_tests/external/wpt/svg/animations/svgnumberoptionalnumber-animation-4.html similarity index 91% rename from third_party/blink/web_tests/svg/animations/svgnumberoptionalnumber-animation-4.html rename to third_party/blink/web_tests/external/wpt/svg/animations/svgnumberoptionalnumber-animation-4.html index de5f63b..4c734b5 100644 --- a/third_party/blink/web_tests/svg/animations/svgnumberoptionalnumber-animation-4.html +++ b/third_party/blink/web_tests/external/wpt/svg/animations/svgnumberoptionalnumber-animation-4.html
@@ -1,10 +1,9 @@ <!doctype html> -<!-- THIS HAS BEEN TRANSLATED BY A SCRIPT, THERE MIGHT BE ERRORS --> <html> <title>Test 'by' animation of SVGNumberOptionalNumber.</title> -<script src="../../resources/testharness.js"></script> -<script src="../../resources/testharnessreport.js"></script> -<script src="resources/SVGAnimationTestCase-testharness.js"></script> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/SVGAnimationTestCase-testharness.js"></script> <svg> </svg> @@ -90,4 +89,4 @@ window.clickX = 60; window.clickY = 60; -</script> \ No newline at end of file +</script>
diff --git a/third_party/blink/web_tests/svg/animations/svgpath-animation-1.html b/third_party/blink/web_tests/external/wpt/svg/animations/svgpath-animation-1.html similarity index 87% rename from third_party/blink/web_tests/svg/animations/svgpath-animation-1.html rename to third_party/blink/web_tests/external/wpt/svg/animations/svgpath-animation-1.html index 6334123..2201305 100644 --- a/third_party/blink/web_tests/svg/animations/svgpath-animation-1.html +++ b/third_party/blink/web_tests/external/wpt/svg/animations/svgpath-animation-1.html
@@ -1,10 +1,9 @@ <!doctype html> -<!-- THIS HAS BEEN TRANSLATED BY A SCRIPT, THERE MIGHT BE ERRORS --> <html> <title>Test 'by' animation on path. You should see a green 100x100 path and only PASS messages</title> -<script src="../../resources/testharness.js"></script> -<script src="../../resources/testharnessreport.js"></script> -<script src="resources/SVGAnimationTestCase-testharness.js"></script> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/SVGAnimationTestCase-testharness.js"></script> <svg> </svg> @@ -65,4 +64,4 @@ runAnimationTest(t, expectedValues); }); -</script> \ No newline at end of file +</script>
diff --git a/third_party/blink/web_tests/svg/animations/svgpointlist-animation-1.html b/third_party/blink/web_tests/external/wpt/svg/animations/svgpointlist-animation-1.html similarity index 88% rename from third_party/blink/web_tests/svg/animations/svgpointlist-animation-1.html rename to third_party/blink/web_tests/external/wpt/svg/animations/svgpointlist-animation-1.html index 5437057..a3340ba8 100644 --- a/third_party/blink/web_tests/svg/animations/svgpointlist-animation-1.html +++ b/third_party/blink/web_tests/external/wpt/svg/animations/svgpointlist-animation-1.html
@@ -1,10 +1,9 @@ <!doctype html> -<!-- THIS HAS BEEN TRANSLATED BY A SCRIPT, THERE MIGHT BE ERRORS --> <html> <title>Tests from-to animation of points on polygons.</title> -<script src="../../resources/testharness.js"></script> -<script src="../../resources/testharnessreport.js"></script> -<script src="resources/SVGAnimationTestCase-testharness.js"></script> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/SVGAnimationTestCase-testharness.js"></script> <svg> </svg> @@ -70,4 +69,4 @@ runAnimationTest(t, expectedValues); }); -</script> \ No newline at end of file +</script>
diff --git a/third_party/blink/web_tests/svg/animations/svgpointlist-animation-2.html b/third_party/blink/web_tests/external/wpt/svg/animations/svgpointlist-animation-2.html similarity index 88% rename from third_party/blink/web_tests/svg/animations/svgpointlist-animation-2.html rename to third_party/blink/web_tests/external/wpt/svg/animations/svgpointlist-animation-2.html index fa3a2982..e0819cd5 100644 --- a/third_party/blink/web_tests/svg/animations/svgpointlist-animation-2.html +++ b/third_party/blink/web_tests/external/wpt/svg/animations/svgpointlist-animation-2.html
@@ -1,10 +1,9 @@ <!doctype html> -<!-- THIS HAS BEEN TRANSLATED BY A SCRIPT, THERE MIGHT BE ERRORS --> <html> <title>Tests from-by animation of points on polygons.</title> -<script src="../../resources/testharness.js"></script> -<script src="../../resources/testharnessreport.js"></script> -<script src="resources/SVGAnimationTestCase-testharness.js"></script> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/SVGAnimationTestCase-testharness.js"></script> <svg> </svg> @@ -70,4 +69,4 @@ runAnimationTest(t, expectedValues); }); -</script> \ No newline at end of file +</script>
diff --git a/third_party/blink/web_tests/svg/animations/svgrect-animation-1.html b/third_party/blink/web_tests/external/wpt/svg/animations/svgrect-animation-1.html similarity index 91% rename from third_party/blink/web_tests/svg/animations/svgrect-animation-1.html rename to third_party/blink/web_tests/external/wpt/svg/animations/svgrect-animation-1.html index e0d8e9d..d13ccff4 100644 --- a/third_party/blink/web_tests/svg/animations/svgrect-animation-1.html +++ b/third_party/blink/web_tests/external/wpt/svg/animations/svgrect-animation-1.html
@@ -1,10 +1,9 @@ <!doctype html> -<!-- THIS HAS BEEN TRANSLATED BY A SCRIPT, THERE MIGHT BE ERRORS --> <html> <title>Test from-to SVGRect animation.</title> -<script src="../../resources/testharness.js"></script> -<script src="../../resources/testharnessreport.js"></script> -<script src="resources/SVGAnimationTestCase-testharness.js"></script> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/SVGAnimationTestCase-testharness.js"></script> <svg> </svg> @@ -83,4 +82,4 @@ runAnimationTest(t, expectedValues); }); -</script> \ No newline at end of file +</script>
diff --git a/third_party/blink/web_tests/svg/animations/svgrect-animation-2.html b/third_party/blink/web_tests/external/wpt/svg/animations/svgrect-animation-2.html similarity index 91% rename from third_party/blink/web_tests/svg/animations/svgrect-animation-2.html rename to third_party/blink/web_tests/external/wpt/svg/animations/svgrect-animation-2.html index ca3365d..86f5368 100644 --- a/third_party/blink/web_tests/svg/animations/svgrect-animation-2.html +++ b/third_party/blink/web_tests/external/wpt/svg/animations/svgrect-animation-2.html
@@ -1,10 +1,9 @@ <!doctype html> -<!-- THIS HAS BEEN TRANSLATED BY A SCRIPT, THERE MIGHT BE ERRORS --> <html> <title>Tests from-by SVGRect animation.</title> -<script src="../../resources/testharness.js"></script> -<script src="../../resources/testharnessreport.js"></script> -<script src="resources/SVGAnimationTestCase-testharness.js"></script> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/SVGAnimationTestCase-testharness.js"></script> <svg> </svg> @@ -83,4 +82,4 @@ runAnimationTest(t, expectedValues); }); -</script> \ No newline at end of file +</script>
diff --git a/third_party/blink/web_tests/svg/animations/svgstring-animation-1.html b/third_party/blink/web_tests/external/wpt/svg/animations/svgstring-animation-1.html similarity index 86% rename from third_party/blink/web_tests/svg/animations/svgstring-animation-1.html rename to third_party/blink/web_tests/external/wpt/svg/animations/svgstring-animation-1.html index 14a021f..259dfbd 100644 --- a/third_party/blink/web_tests/svg/animations/svgstring-animation-1.html +++ b/third_party/blink/web_tests/external/wpt/svg/animations/svgstring-animation-1.html
@@ -1,10 +1,9 @@ <!doctype html> -<!-- THIS HAS BEEN TRANSLATED BY A SCRIPT, THERE MIGHT BE ERRORS --> <html> <title>Test animVal support for SVGAnimatedString animations.</title> -<script src="../../resources/testharness.js"></script> -<script src="../../resources/testharnessreport.js"></script> -<script src="resources/SVGAnimationTestCase-testharness.js"></script> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/SVGAnimationTestCase-testharness.js"></script> <svg> </svg> @@ -64,4 +63,4 @@ window.animationStartsImmediately = true; -</script> \ No newline at end of file +</script>
diff --git a/third_party/blink/web_tests/svg/animations/svgstring-animation-fallback-to-discrete.html b/third_party/blink/web_tests/external/wpt/svg/animations/svgstring-animation-fallback-to-discrete.html similarity index 86% rename from third_party/blink/web_tests/svg/animations/svgstring-animation-fallback-to-discrete.html rename to third_party/blink/web_tests/external/wpt/svg/animations/svgstring-animation-fallback-to-discrete.html index 464f04a..8cf6c34 100644 --- a/third_party/blink/web_tests/svg/animations/svgstring-animation-fallback-to-discrete.html +++ b/third_party/blink/web_tests/external/wpt/svg/animations/svgstring-animation-fallback-to-discrete.html
@@ -1,10 +1,9 @@ <!doctype html> -<!-- THIS HAS BEEN TRANSLATED BY A SCRIPT, THERE MIGHT BE ERRORS --> <html> <title>Tests fallback to calcMode='discrete' on animation of SVGString with 'values'.</title> -<script src="../../resources/testharness.js"></script> -<script src="../../resources/testharnessreport.js"></script> -<script src="resources/SVGAnimationTestCase-testharness.js"></script> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/SVGAnimationTestCase-testharness.js"></script> <svg> </svg> @@ -60,4 +59,4 @@ runAnimationTest(t, expectedValues); }); -</script> \ No newline at end of file +</script>
diff --git a/third_party/blink/web_tests/svg/animations/svgtransform-animation-1.html b/third_party/blink/web_tests/external/wpt/svg/animations/svgtransform-animation-1.html similarity index 94% rename from third_party/blink/web_tests/svg/animations/svgtransform-animation-1.html rename to third_party/blink/web_tests/external/wpt/svg/animations/svgtransform-animation-1.html index e91a0824..618ba9a3 100644 --- a/third_party/blink/web_tests/svg/animations/svgtransform-animation-1.html +++ b/third_party/blink/web_tests/external/wpt/svg/animations/svgtransform-animation-1.html
@@ -1,10 +1,9 @@ <!doctype html> -<!-- THIS HAS BEEN TRANSLATED BY A SCRIPT, THERE MIGHT BE ERRORS --> <html> <title>Test accumulate=sum animation on SVGAnimateTransform.</title> -<script src="../../resources/testharness.js"></script> -<script src="../../resources/testharnessreport.js"></script> -<script src="resources/SVGAnimationTestCase-testharness.js"></script> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/SVGAnimationTestCase-testharness.js"></script> <svg> </svg> @@ -115,4 +114,4 @@ runAnimationTest(t, expectedValues); }); -</script> \ No newline at end of file +</script>
diff --git a/third_party/blink/web_tests/svg/animations/svgtransform-animation-discrete.html b/third_party/blink/web_tests/external/wpt/svg/animations/svgtransform-animation-discrete.html similarity index 90% rename from third_party/blink/web_tests/svg/animations/svgtransform-animation-discrete.html rename to third_party/blink/web_tests/external/wpt/svg/animations/svgtransform-animation-discrete.html index 853d423..17b78a2 100644 --- a/third_party/blink/web_tests/svg/animations/svgtransform-animation-discrete.html +++ b/third_party/blink/web_tests/external/wpt/svg/animations/svgtransform-animation-discrete.html
@@ -1,10 +1,9 @@ <!doctype html> -<!-- THIS HAS BEEN TRANSLATED BY A SCRIPT, THERE MIGHT BE ERRORS --> <html> <title>Test calcMode=discrete animation on SVGAnimateTransform.</title> -<script src="../../resources/testharness.js"></script> -<script src="../../resources/testharnessreport.js"></script> -<script src="resources/SVGAnimationTestCase-testharness.js"></script> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/SVGAnimationTestCase-testharness.js"></script> <svg> </svg> @@ -72,4 +71,4 @@ runAnimationTest(t, expectedValues); }); -</script> \ No newline at end of file +</script>
diff --git a/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/metadata.py b/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/metadata.py index 3e9adf6..ca6165f 100644 --- a/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/metadata.py +++ b/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/metadata.py
@@ -51,11 +51,12 @@ def update_expected(test_paths, serve_root, log_file_names, update_properties, rev_old=None, rev_new="HEAD", - full_update=False, sync_root=None, disable_intermittent=None): + full_update=False, sync_root=None, disable_intermittent=None, + update_intermittent=False, remove_intermittent=False): """Update the metadata files for web-platform-tests based on the results obtained in a previous run or runs - If stability is not None, assume log_file_names refers to logs from repeated + If disable_intermittent is not None, assume log_file_names refers to logs from repeated test jobs, disable tests that don't behave as expected on all runs""" do_delayed_imports(serve_root) @@ -64,6 +65,8 @@ for metadata_path, updated_ini in update_from_logs(id_test_map, update_properties, disable_intermittent, + update_intermittent, + remove_intermittent, full_update, *log_file_names): @@ -135,7 +138,7 @@ # for each conditional: # If all the new values match (or there aren't any) retain that conditional # If any new values mismatch: -# If stability and any repeated values don't match, disable the test +# If disable_intermittent and any repeated values don't match, disable the test # else mark the test as needing human attention # Check if all the RHS values are the same; if so collapse the conditionals @@ -214,8 +217,8 @@ return id_test_map -def update_from_logs(id_test_map, update_properties, disable_intermittent, full_update, - *log_filenames): +def update_from_logs(id_test_map, update_properties, disable_intermittent, update_intermittent, + remove_intermittent, full_update, *log_filenames): updater = ExpectedUpdater(id_test_map) @@ -224,7 +227,8 @@ with open(log_filename) as f: updater.update_from_log(f) - for item in update_results(id_test_map, update_properties, disable_intermittent, full_update): + for item in update_results(id_test_map, update_properties, full_update, + disable_intermittent, update_intermittent, remove_intermittent): yield item
diff --git a/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/update/metadata.py b/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/update/metadata.py index 6307005..4bc70d31 100644 --- a/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/update/metadata.py +++ b/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/update/metadata.py
@@ -28,7 +28,9 @@ rev_old=None, full_update=state.full_update, sync_root=sync_root, - disable_intermittent=state.disable_intermittent) + disable_intermittent=state.disable_intermittent, + update_intermittent=state.update_intermittent, + remove_intermittent=state.remove_intermittent) class CreateMetadataPatch(Step):
diff --git a/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/update/update.py b/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/update/update.py index 3b76c7e..c4f1e7e 100644 --- a/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/update/update.py +++ b/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/update/update.py
@@ -86,6 +86,8 @@ with state.push(["local_tree", "sync_tree", "paths", "serve_root"]): state.run_log = kwargs["run_log"] state.disable_intermittent = kwargs["disable_intermittent"] + state.update_intermittent = kwargs["update_intermittent"] + state.remove_intermittent = kwargs["remove_intermittent"] state.patch = kwargs["patch"] state.suite_name = kwargs["suite_name"] state.product = kwargs["product"]
diff --git a/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/wptcommandline.py b/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/wptcommandline.py index b8f11d0..5ac29b3 100644 --- a/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/wptcommandline.py +++ b/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/wptcommandline.py
@@ -611,9 +611,13 @@ help="Sync the tests with the latest from upstream (implies --patch)") parser.add_argument("--full", action="store_true", default=False, help=("For all tests that are updated, remove any existing conditions and missing subtests")) - parser.add_argument("--disable_intermittent", nargs="?", action="store", const="unstable", default=None, + parser.add_argument("--disable-intermittent", nargs="?", action="store", const="unstable", default=None, help=("Reason for disabling tests. When updating test results, disable tests that have " "inconsistent results across many runs with the given reason.")) + parser.add_argument("--update-intermittent", action="store_true", default=False, + help=("Update test metadata with expected intermittent statuses.")) + parser.add_argument("--remove-intermittent", action="store_true", default=False, + help=("Remove obsolete intermittent statuses from expected statuses.")) parser.add_argument("--no-remove-obsolete", action="store_false", dest="remove_obsolete", default=True, help=("Don't remove metadata files that no longer correspond to a test file")) parser.add_argument("--no-store-state", action="store_false", dest="store_state",
diff --git a/third_party/blink/web_tests/flag-specific/enable-blink-features=CompositeAfterPaint/paint/invalidation/forms/textarea-appearance-none-resize-handle-expected.txt b/third_party/blink/web_tests/flag-specific/enable-blink-features=CompositeAfterPaint/paint/invalidation/forms/textarea-appearance-none-resize-handle-expected.txt index 458638b..19a47bbc 100644 --- a/third_party/blink/web_tests/flag-specific/enable-blink-features=CompositeAfterPaint/paint/invalidation/forms/textarea-appearance-none-resize-handle-expected.txt +++ b/third_party/blink/web_tests/flag-specific/enable-blink-features=CompositeAfterPaint/paint/invalidation/forms/textarea-appearance-none-resize-handle-expected.txt
@@ -10,6 +10,11 @@ "object": "LayoutTextControl (positioned) TEXTAREA id='textarea'", "rect": [0, 50, 106, 206], "reason": "geometry" + }, + { + "object": "LayoutTextControl (positioned) TEXTAREA id='textarea'", + "rect": [0, 50, 106, 206], + "reason": "geometry" } ] }
diff --git a/third_party/blink/web_tests/flag-specific/enable-blink-features=CompositeAfterPaint/paint/invalidation/forms/textarea-resize-property-change-expected.txt b/third_party/blink/web_tests/flag-specific/enable-blink-features=CompositeAfterPaint/paint/invalidation/forms/textarea-resize-property-change-expected.txt index ce36c42..5960dd92 100644 --- a/third_party/blink/web_tests/flag-specific/enable-blink-features=CompositeAfterPaint/paint/invalidation/forms/textarea-resize-property-change-expected.txt +++ b/third_party/blink/web_tests/flag-specific/enable-blink-features=CompositeAfterPaint/paint/invalidation/forms/textarea-resize-property-change-expected.txt
@@ -10,6 +10,16 @@ "object": "LayoutTextControl (positioned) TEXTAREA id='textarea'", "rect": [0, 50, 106, 106], "reason": "style change" + }, + { + "object": "LayoutTextControl (positioned) TEXTAREA id='textarea'", + "rect": [0, 50, 106, 106], + "reason": "chunk appeared" + }, + { + "object": "LayoutTextControl (positioned) TEXTAREA id='textarea'", + "rect": [0, 50, 106, 106], + "reason": "chunk appeared" } ] }
diff --git a/third_party/blink/web_tests/flag-specific/enable-blink-features=CompositeAfterPaint/paint/invalidation/forms/textarea-set-disabled-expected.txt b/third_party/blink/web_tests/flag-specific/enable-blink-features=CompositeAfterPaint/paint/invalidation/forms/textarea-set-disabled-expected.txt index 3b514b6f0..1ad2ade 100644 --- a/third_party/blink/web_tests/flag-specific/enable-blink-features=CompositeAfterPaint/paint/invalidation/forms/textarea-set-disabled-expected.txt +++ b/third_party/blink/web_tests/flag-specific/enable-blink-features=CompositeAfterPaint/paint/invalidation/forms/textarea-set-disabled-expected.txt
@@ -10,6 +10,11 @@ "object": "LayoutTextControl TEXTAREA", "rect": [8, 8, 106, 106], "reason": "subtree" + }, + { + "object": "LayoutTextControl TEXTAREA", + "rect": [8, 8, 106, 106], + "reason": "subtree" } ] }
diff --git a/third_party/blink/web_tests/flag-specific/enable-blink-features=CompositeAfterPaint/paint/invalidation/scroll/composited-add-resizer-expected.txt b/third_party/blink/web_tests/flag-specific/enable-blink-features=CompositeAfterPaint/paint/invalidation/scroll/composited-add-resizer-expected.txt index ee504b1..0c50ecc9 100644 --- a/third_party/blink/web_tests/flag-specific/enable-blink-features=CompositeAfterPaint/paint/invalidation/scroll/composited-add-resizer-expected.txt +++ b/third_party/blink/web_tests/flag-specific/enable-blink-features=CompositeAfterPaint/paint/invalidation/scroll/composited-add-resizer-expected.txt
@@ -7,13 +7,23 @@ "backgroundColor": "#FFFFFF" }, { - "name": "LayoutBlockFlow DIV id='target'", + "name": "LayoutNGBlockFlow DIV id='target'", "bounds": [100, 100], "paintInvalidations": [ { - "object": "LayoutBlockFlow DIV id='target'", + "object": "LayoutNGBlockFlow DIV id='target'", "rect": [0, 0, 100, 100], "reason": "style change" + }, + { + "object": "LayoutNGBlockFlow DIV id='target'", + "rect": [0, 0, 100, 100], + "reason": "chunk appeared" + }, + { + "object": "LayoutNGBlockFlow DIV id='target'", + "rect": [0, 0, 100, 100], + "reason": "chunk appeared" } ], "transform": 1
diff --git a/third_party/blink/web_tests/virtual/audio-service/external/wpt/mediacapture-streams/README.txt b/third_party/blink/web_tests/virtual/audio-service/external/wpt/mediacapture-streams/README.txt deleted file mode 100644 index 53221e3..0000000 --- a/third_party/blink/web_tests/virtual/audio-service/external/wpt/mediacapture-streams/README.txt +++ /dev/null
@@ -1,2 +0,0 @@ -Runs external/wpt/mediacapture-streams tests with ---enable-features=AudioServiceOutOfProcess,AudioServiceSandbox
diff --git a/third_party/blink/web_tests/virtual/audio-service/http/tests/media/README.txt b/third_party/blink/web_tests/virtual/audio-service/http/tests/media/README.txt deleted file mode 100644 index ff4c6ba..0000000 --- a/third_party/blink/web_tests/virtual/audio-service/http/tests/media/README.txt +++ /dev/null
@@ -1,2 +0,0 @@ -Runs http/tests/media tests with ---enable-features=AudioServiceOutOfProcess,AudioServiceSandbox
diff --git a/third_party/blink/web_tests/virtual/audio-service/media/README.txt b/third_party/blink/web_tests/virtual/audio-service/media/README.txt deleted file mode 100644 index bcd289d..0000000 --- a/third_party/blink/web_tests/virtual/audio-service/media/README.txt +++ /dev/null
@@ -1,2 +0,0 @@ -Runs media tests with ---enable-features=AudioServiceOutOfProcess,AudioServiceSandbox
diff --git a/third_party/google_toolbox_for_mac/OWNERS b/third_party/google_toolbox_for_mac/OWNERS index 4c9fb06..d49c516 100644 --- a/third_party/google_toolbox_for_mac/OWNERS +++ b/third_party/google_toolbox_for_mac/OWNERS
@@ -1,4 +1,4 @@ avi@chromium.org mark@chromium.org rsesek@chromium.org -# COMPONENT: Platform>Apps>Feedback +# COMPONENT: UI>Browser
diff --git a/third_party/lzma_sdk/BUILD.gn b/third_party/lzma_sdk/BUILD.gn index 693b1459..6da9d54 100644 --- a/third_party/lzma_sdk/BUILD.gn +++ b/third_party/lzma_sdk/BUILD.gn
@@ -15,6 +15,14 @@ } } +config("lzma_defines") { + defines = [ + "_7ZIP_ST", + "_7Z_NO_METHODS_FILTERS", + "_LZMA_PROB32", + ] +} + static_library("lzma_sdk") { sources = [ "7z.h", @@ -57,10 +65,33 @@ "Precomp.h", ] - defines = [ - "_7ZIP_ST", - "_7Z_NO_METHODS_FILTERS", - "_LZMA_PROB32", + configs -= [ "//build/config/compiler:chromium_code" ] + configs += [ + "//build/config/compiler:no_chromium_code", + + # Must be after no_chromium_code for warning flags to be ordered correctly. + ":clang_warnings", + ":lzma_defines" + ] + public_configs = [ ":lzma_sdk_config" ] +} + +static_library("lzma_sdk_xz") { + sources = [ + "BraIA64.c", + "RotateDefs.h", + "Sha256.c", + "Sha256.h", + "Xz.c", + "Xz.h", + "XzCrc64.c", + "XzCrc64.h", + "XzCrc64Opt.c", + "XzDec.c", + ] + + deps = [ + ":lzma_sdk" ] configs -= [ "//build/config/compiler:chromium_code" ] @@ -69,6 +100,7 @@ # Must be after no_chromium_code for warning flags to be ordered correctly. ":clang_warnings", + ":lzma_defines" ] public_configs = [ ":lzma_sdk_config" ] }
diff --git a/third_party/lzma_sdk/BraIA64.c b/third_party/lzma_sdk/BraIA64.c new file mode 100644 index 0000000..fa60356 --- /dev/null +++ b/third_party/lzma_sdk/BraIA64.c
@@ -0,0 +1,69 @@ +/* BraIA64.c -- Converter for IA-64 code +2013-11-12 : Igor Pavlov : Public domain */ + +#include "Precomp.h" + +#include "Bra.h" + +static const Byte kBranchTable[32] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 4, 4, 6, 6, 0, 0, 7, 7, + 4, 4, 0, 0, 4, 4, 0, 0 +}; + +SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding) +{ + SizeT i; + if (size < 16) + return 0; + size -= 16; + for (i = 0; i <= size; i += 16) + { + UInt32 instrTemplate = data[i] & 0x1F; + UInt32 mask = kBranchTable[instrTemplate]; + UInt32 bitPos = 5; + int slot; + for (slot = 0; slot < 3; slot++, bitPos += 41) + { + UInt32 bytePos, bitRes; + UInt64 instruction, instNorm; + int j; + if (((mask >> slot) & 1) == 0) + continue; + bytePos = (bitPos >> 3); + bitRes = bitPos & 0x7; + instruction = 0; + for (j = 0; j < 6; j++) + instruction += (UInt64)data[i + j + bytePos] << (8 * j); + + instNorm = instruction >> bitRes; + if (((instNorm >> 37) & 0xF) == 0x5 && ((instNorm >> 9) & 0x7) == 0) + { + UInt32 src = (UInt32)((instNorm >> 13) & 0xFFFFF); + UInt32 dest; + src |= ((UInt32)(instNorm >> 36) & 1) << 20; + + src <<= 4; + + if (encoding) + dest = ip + (UInt32)i + src; + else + dest = src - (ip + (UInt32)i); + + dest >>= 4; + + instNorm &= ~((UInt64)(0x8FFFFF) << 13); + instNorm |= ((UInt64)(dest & 0xFFFFF) << 13); + instNorm |= ((UInt64)(dest & 0x100000) << (36 - 20)); + + instruction &= (1 << bitRes) - 1; + instruction |= (instNorm << bitRes); + for (j = 0; j < 6; j++) + data[i + j + bytePos] = (Byte)(instruction >> (8 * j)); + } + } + } + return i; +}
diff --git a/third_party/lzma_sdk/README.chromium b/third_party/lzma_sdk/README.chromium index 38f73df..96fc7881 100644 --- a/third_party/lzma_sdk/README.chromium +++ b/third_party/lzma_sdk/README.chromium
@@ -16,6 +16,7 @@ 1/ C code required to open 7z archive files and uncompress LZMA 2/ 7za.exe and 7zr.exe executables (amd64 version) 3/ source code for SfxSetup, a utility for creating self extracting archives +4/ C code required for xz decompression (split into its own static library) The patch in chromium.patch was applied to CpuArch.c to fix register corruption that can occur on 64-bit platforms built with -fPIC and register clobbering that
diff --git a/third_party/lzma_sdk/RotateDefs.h b/third_party/lzma_sdk/RotateDefs.h new file mode 100644 index 0000000..8f01d1a --- /dev/null +++ b/third_party/lzma_sdk/RotateDefs.h
@@ -0,0 +1,30 @@ +/* RotateDefs.h -- Rotate functions +2015-03-25 : Igor Pavlov : Public domain */ + +#ifndef __ROTATE_DEFS_H +#define __ROTATE_DEFS_H + +#ifdef _MSC_VER + +#include <stdlib.h> + +/* don't use _rotl with MINGW. It can insert slow call to function. */ + +/* #if (_MSC_VER >= 1200) */ +#pragma intrinsic(_rotl) +#pragma intrinsic(_rotr) +/* #endif */ + +#define rotlFixed(x, n) _rotl((x), (n)) +#define rotrFixed(x, n) _rotr((x), (n)) + +#else + +/* new compilers can translate these macros to fast commands. */ + +#define rotlFixed(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) +#define rotrFixed(x, n) (((x) >> (n)) | ((x) << (32 - (n)))) + +#endif + +#endif
diff --git a/third_party/lzma_sdk/Sha256.c b/third_party/lzma_sdk/Sha256.c new file mode 100644 index 0000000..b5bc19b --- /dev/null +++ b/third_party/lzma_sdk/Sha256.c
@@ -0,0 +1,248 @@ +/* Crypto/Sha256.c -- SHA-256 Hash +2015-11-14 : Igor Pavlov : Public domain +This code is based on public domain code from Wei Dai's Crypto++ library. */ + +#include "Precomp.h" + +#include <string.h> + +#include "CpuArch.h" +#include "RotateDefs.h" +#include "Sha256.h" + +/* define it for speed optimization */ +#ifndef _SFX +#define _SHA256_UNROLL +#define _SHA256_UNROLL2 +#endif + +/* #define _SHA256_UNROLL2 */ + +void Sha256_Init(CSha256 *p) +{ + p->state[0] = 0x6a09e667; + p->state[1] = 0xbb67ae85; + p->state[2] = 0x3c6ef372; + p->state[3] = 0xa54ff53a; + p->state[4] = 0x510e527f; + p->state[5] = 0x9b05688c; + p->state[6] = 0x1f83d9ab; + p->state[7] = 0x5be0cd19; + p->count = 0; +} + +#define S0(x) (rotrFixed(x, 2) ^ rotrFixed(x,13) ^ rotrFixed(x, 22)) +#define S1(x) (rotrFixed(x, 6) ^ rotrFixed(x,11) ^ rotrFixed(x, 25)) +#define s0(x) (rotrFixed(x, 7) ^ rotrFixed(x,18) ^ (x >> 3)) +#define s1(x) (rotrFixed(x,17) ^ rotrFixed(x,19) ^ (x >> 10)) + +#define blk0(i) (W[i]) +#define blk2(i) (W[i] += s1(W[((i)-2)&15]) + W[((i)-7)&15] + s0(W[((i)-15)&15])) + +#define Ch(x,y,z) (z^(x&(y^z))) +#define Maj(x,y,z) ((x&y)|(z&(x|y))) + +#ifdef _SHA256_UNROLL2 + +#define R(a,b,c,d,e,f,g,h, i) \ + h += S1(e) + Ch(e,f,g) + K[(i)+(j)] + (j ? blk2(i) : blk0(i)); \ + d += h; \ + h += S0(a) + Maj(a, b, c) + +#define RX_8(i) \ + R(a,b,c,d,e,f,g,h, i); \ + R(h,a,b,c,d,e,f,g, i+1); \ + R(g,h,a,b,c,d,e,f, i+2); \ + R(f,g,h,a,b,c,d,e, i+3); \ + R(e,f,g,h,a,b,c,d, i+4); \ + R(d,e,f,g,h,a,b,c, i+5); \ + R(c,d,e,f,g,h,a,b, i+6); \ + R(b,c,d,e,f,g,h,a, i+7) + +#define RX_16 RX_8(0); RX_8(8); + +#else + +#define a(i) T[(0-(i))&7] +#define b(i) T[(1-(i))&7] +#define c(i) T[(2-(i))&7] +#define d(i) T[(3-(i))&7] +#define e(i) T[(4-(i))&7] +#define f(i) T[(5-(i))&7] +#define g(i) T[(6-(i))&7] +#define h(i) T[(7-(i))&7] + +#define R(i) \ + h(i) += S1(e(i)) + Ch(e(i),f(i),g(i)) + K[(i)+(j)] + (j ? blk2(i) : blk0(i)); \ + d(i) += h(i); \ + h(i) += S0(a(i)) + Maj(a(i), b(i), c(i)) \ + +#ifdef _SHA256_UNROLL + +#define RX_8(i) R(i+0); R(i+1); R(i+2); R(i+3); R(i+4); R(i+5); R(i+6); R(i+7); +#define RX_16 RX_8(0); RX_8(8); + +#else + +#define RX_16 unsigned i; for (i = 0; i < 16; i++) { R(i); } + +#endif + +#endif + +static const UInt32 K[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + +static void Sha256_WriteByteBlock(CSha256 *p) +{ + UInt32 W[16]; + unsigned j; + UInt32 *state; + + #ifdef _SHA256_UNROLL2 + UInt32 a,b,c,d,e,f,g,h; + #else + UInt32 T[8]; + #endif + + for (j = 0; j < 16; j += 4) + { + const Byte *ccc = p->buffer + j * 4; + W[j ] = GetBe32(ccc); + W[j + 1] = GetBe32(ccc + 4); + W[j + 2] = GetBe32(ccc + 8); + W[j + 3] = GetBe32(ccc + 12); + } + + state = p->state; + + #ifdef _SHA256_UNROLL2 + a = state[0]; + b = state[1]; + c = state[2]; + d = state[3]; + e = state[4]; + f = state[5]; + g = state[6]; + h = state[7]; + #else + for (j = 0; j < 8; j++) + T[j] = state[j]; + #endif + + for (j = 0; j < 64; j += 16) + { + RX_16 + } + + #ifdef _SHA256_UNROLL2 + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; + state[5] += f; + state[6] += g; + state[7] += h; + #else + for (j = 0; j < 8; j++) + state[j] += T[j]; + #endif + + /* Wipe variables */ + /* memset(W, 0, sizeof(W)); */ + /* memset(T, 0, sizeof(T)); */ +} + +#undef S0 +#undef S1 +#undef s0 +#undef s1 + +void Sha256_Update(CSha256 *p, const Byte *data, size_t size) +{ + if (size == 0) + return; + + { + unsigned pos = (unsigned)p->count & 0x3F; + unsigned num; + + p->count += size; + + num = 64 - pos; + if (num > size) + { + memcpy(p->buffer + pos, data, size); + return; + } + + size -= num; + memcpy(p->buffer + pos, data, num); + data += num; + } + + for (;;) + { + Sha256_WriteByteBlock(p); + if (size < 64) + break; + size -= 64; + memcpy(p->buffer, data, 64); + data += 64; + } + + if (size != 0) + memcpy(p->buffer, data, size); +} + +void Sha256_Final(CSha256 *p, Byte *digest) +{ + unsigned pos = (unsigned)p->count & 0x3F; + unsigned i; + + p->buffer[pos++] = 0x80; + + while (pos != (64 - 8)) + { + pos &= 0x3F; + if (pos == 0) + Sha256_WriteByteBlock(p); + p->buffer[pos++] = 0; + } + + { + UInt64 numBits = (p->count << 3); + SetBe32(p->buffer + 64 - 8, (UInt32)(numBits >> 32)); + SetBe32(p->buffer + 64 - 4, (UInt32)(numBits)); + } + + Sha256_WriteByteBlock(p); + + for (i = 0; i < 8; i += 2) + { + UInt32 v0 = p->state[i]; + UInt32 v1 = p->state[i + 1]; + SetBe32(digest , v0); + SetBe32(digest + 4, v1); + digest += 8; + } + + Sha256_Init(p); +}
diff --git a/third_party/lzma_sdk/Sha256.h b/third_party/lzma_sdk/Sha256.h new file mode 100644 index 0000000..3f455db --- /dev/null +++ b/third_party/lzma_sdk/Sha256.h
@@ -0,0 +1,26 @@ +/* Sha256.h -- SHA-256 Hash +2013-01-18 : Igor Pavlov : Public domain */ + +#ifndef __CRYPTO_SHA256_H +#define __CRYPTO_SHA256_H + +#include "7zTypes.h" + +EXTERN_C_BEGIN + +#define SHA256_DIGEST_SIZE 32 + +typedef struct +{ + UInt32 state[8]; + UInt64 count; + Byte buffer[64]; +} CSha256; + +void Sha256_Init(CSha256 *p); +void Sha256_Update(CSha256 *p, const Byte *data, size_t size); +void Sha256_Final(CSha256 *p, Byte *digest); + +EXTERN_C_END + +#endif
diff --git a/third_party/lzma_sdk/Xz.c b/third_party/lzma_sdk/Xz.c new file mode 100644 index 0000000..1ef6878 --- /dev/null +++ b/third_party/lzma_sdk/Xz.c
@@ -0,0 +1,90 @@ +/* Xz.c - Xz +2015-05-01 : Igor Pavlov : Public domain */ + +#include "Precomp.h" + +#include "7zCrc.h" +#include "CpuArch.h" +#include "Xz.h" +#include "XzCrc64.h" + +const Byte XZ_SIG[XZ_SIG_SIZE] = { 0xFD, '7', 'z', 'X', 'Z', 0 }; +const Byte XZ_FOOTER_SIG[XZ_FOOTER_SIG_SIZE] = { 'Y', 'Z' }; + +unsigned Xz_WriteVarInt(Byte *buf, UInt64 v) +{ + unsigned i = 0; + do + { + buf[i++] = (Byte)((v & 0x7F) | 0x80); + v >>= 7; + } + while (v != 0); + buf[i - 1] &= 0x7F; + return i; +} + +void Xz_Construct(CXzStream *p) +{ + p->numBlocks = p->numBlocksAllocated = 0; + p->blocks = 0; + p->flags = 0; +} + +void Xz_Free(CXzStream *p, ISzAlloc *alloc) +{ + alloc->Free(alloc, p->blocks); + p->numBlocks = p->numBlocksAllocated = 0; + p->blocks = 0; +} + +unsigned XzFlags_GetCheckSize(CXzStreamFlags f) +{ + unsigned t = XzFlags_GetCheckType(f); + return (t == 0) ? 0 : (4 << ((t - 1) / 3)); +} + +void XzCheck_Init(CXzCheck *p, unsigned mode) +{ + p->mode = mode; + switch (mode) + { + case XZ_CHECK_CRC32: p->crc = CRC_INIT_VAL; break; + case XZ_CHECK_CRC64: p->crc64 = CRC64_INIT_VAL; break; + case XZ_CHECK_SHA256: Sha256_Init(&p->sha); break; + } +} + +void XzCheck_Update(CXzCheck *p, const void *data, size_t size) +{ + switch (p->mode) + { + case XZ_CHECK_CRC32: p->crc = CrcUpdate(p->crc, data, size); break; + case XZ_CHECK_CRC64: p->crc64 = Crc64Update(p->crc64, data, size); break; + case XZ_CHECK_SHA256: Sha256_Update(&p->sha, (const Byte *)data, size); break; + } +} + +int XzCheck_Final(CXzCheck *p, Byte *digest) +{ + switch (p->mode) + { + case XZ_CHECK_CRC32: + SetUi32(digest, CRC_GET_DIGEST(p->crc)); + break; + case XZ_CHECK_CRC64: + { + int i; + UInt64 v = CRC64_GET_DIGEST(p->crc64); + for (i = 0; i < 8; i++, v >>= 8) + digest[i] = (Byte)(v & 0xFF); + break; + } + case XZ_CHECK_SHA256: + Sha256_Final(&p->sha, digest); + break; + default: + return 0; + } + return 1; +}
diff --git a/third_party/lzma_sdk/Xz.h b/third_party/lzma_sdk/Xz.h new file mode 100644 index 0000000..be3a1c36 --- /dev/null +++ b/third_party/lzma_sdk/Xz.h
@@ -0,0 +1,275 @@ +/* Xz.h - Xz interface +2015-05-01 : Igor Pavlov : Public domain */ + +#ifndef __XZ_H +#define __XZ_H + +#include "Sha256.h" + +EXTERN_C_BEGIN + +#define XZ_ID_Subblock 1 +#define XZ_ID_Delta 3 +#define XZ_ID_X86 4 +#define XZ_ID_PPC 5 +#define XZ_ID_IA64 6 +#define XZ_ID_ARM 7 +#define XZ_ID_ARMT 8 +#define XZ_ID_SPARC 9 +#define XZ_ID_LZMA2 0x21 + +unsigned Xz_ReadVarInt(const Byte *p, size_t maxSize, UInt64 *value); +unsigned Xz_WriteVarInt(Byte *buf, UInt64 v); + +/* ---------- xz block ---------- */ + +#define XZ_BLOCK_HEADER_SIZE_MAX 1024 + +#define XZ_NUM_FILTERS_MAX 4 +#define XZ_BF_NUM_FILTERS_MASK 3 +#define XZ_BF_PACK_SIZE (1 << 6) +#define XZ_BF_UNPACK_SIZE (1 << 7) + +#define XZ_FILTER_PROPS_SIZE_MAX 20 + +typedef struct +{ + UInt64 id; + UInt32 propsSize; + Byte props[XZ_FILTER_PROPS_SIZE_MAX]; +} CXzFilter; + +typedef struct +{ + UInt64 packSize; + UInt64 unpackSize; + Byte flags; + CXzFilter filters[XZ_NUM_FILTERS_MAX]; +} CXzBlock; + +#define XzBlock_GetNumFilters(p) (((p)->flags & XZ_BF_NUM_FILTERS_MASK) + 1) +#define XzBlock_HasPackSize(p) (((p)->flags & XZ_BF_PACK_SIZE) != 0) +#define XzBlock_HasUnpackSize(p) (((p)->flags & XZ_BF_UNPACK_SIZE) != 0) + +SRes XzBlock_Parse(CXzBlock *p, const Byte *header); +SRes XzBlock_ReadHeader(CXzBlock *p, ISeqInStream *inStream, Bool *isIndex, UInt32 *headerSizeRes); + +/* ---------- xz stream ---------- */ + +#define XZ_SIG_SIZE 6 +#define XZ_FOOTER_SIG_SIZE 2 + +extern const Byte XZ_SIG[XZ_SIG_SIZE]; +extern const Byte XZ_FOOTER_SIG[XZ_FOOTER_SIG_SIZE]; + +#define XZ_STREAM_FLAGS_SIZE 2 +#define XZ_STREAM_CRC_SIZE 4 + +#define XZ_STREAM_HEADER_SIZE (XZ_SIG_SIZE + XZ_STREAM_FLAGS_SIZE + XZ_STREAM_CRC_SIZE) +#define XZ_STREAM_FOOTER_SIZE (XZ_FOOTER_SIG_SIZE + XZ_STREAM_FLAGS_SIZE + XZ_STREAM_CRC_SIZE + 4) + +#define XZ_CHECK_MASK 0xF +#define XZ_CHECK_NO 0 +#define XZ_CHECK_CRC32 1 +#define XZ_CHECK_CRC64 4 +#define XZ_CHECK_SHA256 10 + +typedef struct +{ + unsigned mode; + UInt32 crc; + UInt64 crc64; + CSha256 sha; +} CXzCheck; + +void XzCheck_Init(CXzCheck *p, unsigned mode); +void XzCheck_Update(CXzCheck *p, const void *data, size_t size); +int XzCheck_Final(CXzCheck *p, Byte *digest); + +typedef UInt16 CXzStreamFlags; + +#define XzFlags_IsSupported(f) ((f) <= XZ_CHECK_MASK) +#define XzFlags_GetCheckType(f) ((f) & XZ_CHECK_MASK) +#define XzFlags_HasDataCrc32(f) (Xz_GetCheckType(f) == XZ_CHECK_CRC32) +unsigned XzFlags_GetCheckSize(CXzStreamFlags f); + +SRes Xz_ParseHeader(CXzStreamFlags *p, const Byte *buf); +SRes Xz_ReadHeader(CXzStreamFlags *p, ISeqInStream *inStream); + +typedef struct +{ + UInt64 unpackSize; + UInt64 totalSize; +} CXzBlockSizes; + +typedef struct +{ + CXzStreamFlags flags; + size_t numBlocks; + size_t numBlocksAllocated; + CXzBlockSizes *blocks; + UInt64 startOffset; +} CXzStream; + +void Xz_Construct(CXzStream *p); +void Xz_Free(CXzStream *p, ISzAlloc *alloc); + +#define XZ_SIZE_OVERFLOW ((UInt64)(Int64)-1) + +UInt64 Xz_GetUnpackSize(const CXzStream *p); +UInt64 Xz_GetPackSize(const CXzStream *p); + +typedef struct +{ + size_t num; + size_t numAllocated; + CXzStream *streams; +} CXzs; + +void Xzs_Construct(CXzs *p); +void Xzs_Free(CXzs *p, ISzAlloc *alloc); +SRes Xzs_ReadBackward(CXzs *p, ILookInStream *inStream, Int64 *startOffset, ICompressProgress *progress, ISzAlloc *alloc); + +UInt64 Xzs_GetNumBlocks(const CXzs *p); +UInt64 Xzs_GetUnpackSize(const CXzs *p); + +typedef enum +{ + CODER_STATUS_NOT_SPECIFIED, /* use main error code instead */ + CODER_STATUS_FINISHED_WITH_MARK, /* stream was finished with end mark. */ + CODER_STATUS_NOT_FINISHED, /* stream was not finished */ + CODER_STATUS_NEEDS_MORE_INPUT /* you must provide more input bytes */ +} ECoderStatus; + +typedef enum +{ + CODER_FINISH_ANY, /* finish at any point */ + CODER_FINISH_END /* block must be finished at the end */ +} ECoderFinishMode; + +typedef struct _IStateCoder +{ + void *p; + void (*Free)(void *p, ISzAlloc *alloc); + SRes (*SetProps)(void *p, const Byte *props, size_t propSize, ISzAlloc *alloc); + void (*Init)(void *p); + SRes (*Code)(void *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + int srcWasFinished, ECoderFinishMode finishMode, int *wasFinished); +} IStateCoder; + +#define MIXCODER_NUM_FILTERS_MAX 4 + +typedef struct +{ + ISzAlloc *alloc; + Byte *buf; + unsigned numCoders; + int finished[MIXCODER_NUM_FILTERS_MAX - 1]; + size_t pos[MIXCODER_NUM_FILTERS_MAX - 1]; + size_t size[MIXCODER_NUM_FILTERS_MAX - 1]; + UInt64 ids[MIXCODER_NUM_FILTERS_MAX]; + IStateCoder coders[MIXCODER_NUM_FILTERS_MAX]; +} CMixCoder; + +void MixCoder_Construct(CMixCoder *p, ISzAlloc *alloc); +void MixCoder_Free(CMixCoder *p); +void MixCoder_Init(CMixCoder *p); +SRes MixCoder_SetFromMethod(CMixCoder *p, unsigned coderIndex, UInt64 methodId); +SRes MixCoder_Code(CMixCoder *p, Byte *dest, SizeT *destLen, + const Byte *src, SizeT *srcLen, int srcWasFinished, + ECoderFinishMode finishMode, ECoderStatus *status); + +typedef enum +{ + XZ_STATE_STREAM_HEADER, + XZ_STATE_STREAM_INDEX, + XZ_STATE_STREAM_INDEX_CRC, + XZ_STATE_STREAM_FOOTER, + XZ_STATE_STREAM_PADDING, + XZ_STATE_BLOCK_HEADER, + XZ_STATE_BLOCK, + XZ_STATE_BLOCK_FOOTER +} EXzState; + +typedef struct +{ + EXzState state; + UInt32 pos; + unsigned alignPos; + unsigned indexPreSize; + + CXzStreamFlags streamFlags; + + UInt32 blockHeaderSize; + UInt64 packSize; + UInt64 unpackSize; + + UInt64 numBlocks; + UInt64 indexSize; + UInt64 indexPos; + UInt64 padSize; + + UInt64 numStartedStreams; + UInt64 numFinishedStreams; + UInt64 numTotalBlocks; + + UInt32 crc; + CMixCoder decoder; + CXzBlock block; + CXzCheck check; + CSha256 sha; + Byte shaDigest[SHA256_DIGEST_SIZE]; + Byte buf[XZ_BLOCK_HEADER_SIZE_MAX]; +} CXzUnpacker; + +void XzUnpacker_Construct(CXzUnpacker *p, ISzAlloc *alloc); +void XzUnpacker_Init(CXzUnpacker *p); +void XzUnpacker_Free(CXzUnpacker *p); + +/* +finishMode: + It has meaning only if the decoding reaches output limit (*destLen). + CODER_FINISH_ANY - use smallest number of input bytes + CODER_FINISH_END - read EndOfStream marker after decoding + +Returns: + SZ_OK + status: + CODER_STATUS_NOT_FINISHED, + CODER_STATUS_NEEDS_MORE_INPUT - maybe there are more xz streams, + call XzUnpacker_IsStreamWasFinished to check that current stream was finished + SZ_ERROR_MEM - Memory allocation error + SZ_ERROR_DATA - Data error + SZ_ERROR_UNSUPPORTED - Unsupported method or method properties + SZ_ERROR_CRC - CRC error + // SZ_ERROR_INPUT_EOF - It needs more bytes in input buffer (src). + + SZ_ERROR_NO_ARCHIVE - the error with xz Stream Header with one of the following reasons: + - xz Stream Signature failure + - CRC32 of xz Stream Header is failed + - The size of Stream padding is not multiple of four bytes. + It's possible to get that error, if xz stream was finished and the stream + contains some another data. In that case you can call XzUnpacker_GetExtraSize() + function to get real size of xz stream. +*/ + + +SRes XzUnpacker_Code(CXzUnpacker *p, Byte *dest, SizeT *destLen, + const Byte *src, SizeT *srcLen, ECoderFinishMode finishMode, + ECoderStatus *status); + +Bool XzUnpacker_IsStreamWasFinished(CXzUnpacker *p); + +/* +Call XzUnpacker_GetExtraSize after XzUnpacker_Code function to detect real size of +xz stream in two cases: +XzUnpacker_Code() returns: + res == SZ_OK && status == CODER_STATUS_NEEDS_MORE_INPUT + res == SZ_ERROR_NO_ARCHIVE +*/ + +UInt64 XzUnpacker_GetExtraSize(CXzUnpacker *p); + +EXTERN_C_END + +#endif
diff --git a/third_party/lzma_sdk/XzCrc64.c b/third_party/lzma_sdk/XzCrc64.c new file mode 100644 index 0000000..e2da63b --- /dev/null +++ b/third_party/lzma_sdk/XzCrc64.c
@@ -0,0 +1,86 @@ +/* XzCrc64.c -- CRC64 calculation +2015-03-01 : Igor Pavlov : Public domain */ + +#include "Precomp.h" + +#include "XzCrc64.h" +#include "CpuArch.h" + +#define kCrc64Poly UINT64_CONST(0xC96C5795D7870F42) + +#ifdef MY_CPU_LE + #define CRC_NUM_TABLES 4 +#else + #define CRC_NUM_TABLES 5 + #define CRC_UINT64_SWAP(v) \ + ((v >> 56) \ + | ((v >> 40) & ((UInt64)0xFF << 8)) \ + | ((v >> 24) & ((UInt64)0xFF << 16)) \ + | ((v >> 8) & ((UInt64)0xFF << 24)) \ + | ((v << 8) & ((UInt64)0xFF << 32)) \ + | ((v << 24) & ((UInt64)0xFF << 40)) \ + | ((v << 40) & ((UInt64)0xFF << 48)) \ + | ((v << 56))) + + UInt64 MY_FAST_CALL XzCrc64UpdateT1_BeT4(UInt64 v, const void *data, size_t size, const UInt64 *table); +#endif + +#ifndef MY_CPU_BE + UInt64 MY_FAST_CALL XzCrc64UpdateT4(UInt64 v, const void *data, size_t size, const UInt64 *table); +#endif + +typedef UInt64 (MY_FAST_CALL *CRC_FUNC)(UInt64 v, const void *data, size_t size, const UInt64 *table); + +static CRC_FUNC g_Crc64Update; +UInt64 g_Crc64Table[256 * CRC_NUM_TABLES]; + +UInt64 MY_FAST_CALL Crc64Update(UInt64 v, const void *data, size_t size) +{ + return g_Crc64Update(v, data, size, g_Crc64Table); +} + +UInt64 MY_FAST_CALL Crc64Calc(const void *data, size_t size) +{ + return g_Crc64Update(CRC64_INIT_VAL, data, size, g_Crc64Table) ^ CRC64_INIT_VAL; +} + +void MY_FAST_CALL Crc64GenerateTable() +{ + UInt32 i; + for (i = 0; i < 256; i++) + { + UInt64 r = i; + unsigned j; + for (j = 0; j < 8; j++) + r = (r >> 1) ^ (kCrc64Poly & ~((r & 1) - 1)); + g_Crc64Table[i] = r; + } + for (; i < 256 * CRC_NUM_TABLES; i++) + { + UInt64 r = g_Crc64Table[i - 256]; + g_Crc64Table[i] = g_Crc64Table[r & 0xFF] ^ (r >> 8); + } + + #ifdef MY_CPU_LE + + g_Crc64Update = XzCrc64UpdateT4; + + #else + { + #ifndef MY_CPU_BE + UInt32 k = 1; + if (*(const Byte *)&k == 1) + g_Crc64Update = XzCrc64UpdateT4; + else + #endif + { + for (i = 256 * CRC_NUM_TABLES - 1; i >= 256; i--) + { + UInt64 x = g_Crc64Table[i - 256]; + g_Crc64Table[i] = CRC_UINT64_SWAP(x); + } + g_Crc64Update = XzCrc64UpdateT1_BeT4; + } + } + #endif +}
diff --git a/third_party/lzma_sdk/XzCrc64.h b/third_party/lzma_sdk/XzCrc64.h new file mode 100644 index 0000000..08dbc33 --- /dev/null +++ b/third_party/lzma_sdk/XzCrc64.h
@@ -0,0 +1,26 @@ +/* XzCrc64.h -- CRC64 calculation +2013-01-18 : Igor Pavlov : Public domain */ + +#ifndef __XZ_CRC64_H +#define __XZ_CRC64_H + +#include <stddef.h> + +#include "7zTypes.h" + +EXTERN_C_BEGIN + +extern UInt64 g_Crc64Table[]; + +void MY_FAST_CALL Crc64GenerateTable(void); + +#define CRC64_INIT_VAL UINT64_CONST(0xFFFFFFFFFFFFFFFF) +#define CRC64_GET_DIGEST(crc) ((crc) ^ CRC64_INIT_VAL) +#define CRC64_UPDATE_BYTE(crc, b) (g_Crc64Table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) + +UInt64 MY_FAST_CALL Crc64Update(UInt64 crc, const void *data, size_t size); +UInt64 MY_FAST_CALL Crc64Calc(const void *data, size_t size); + +EXTERN_C_END + +#endif
diff --git a/third_party/lzma_sdk/XzCrc64Opt.c b/third_party/lzma_sdk/XzCrc64Opt.c new file mode 100644 index 0000000..c4fde65 --- /dev/null +++ b/third_party/lzma_sdk/XzCrc64Opt.c
@@ -0,0 +1,69 @@ +/* XzCrc64Opt.c -- CRC64 calculation +2015-03-01 : Igor Pavlov : Public domain */ + +#include "Precomp.h" + +#include "CpuArch.h" + +#ifndef MY_CPU_BE + +#define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8)) + +UInt64 MY_FAST_CALL XzCrc64UpdateT4(UInt64 v, const void *data, size_t size, const UInt64 *table) +{ + const Byte *p = (const Byte *)data; + for (; size > 0 && ((unsigned)(ptrdiff_t)p & 3) != 0; size--, p++) + v = CRC_UPDATE_BYTE_2(v, *p); + for (; size >= 4; size -= 4, p += 4) + { + UInt32 d = (UInt32)v ^ *(const UInt32 *)p; + v = (v >> 32) + ^ table[0x300 + ((d ) & 0xFF)] + ^ table[0x200 + ((d >> 8) & 0xFF)] + ^ table[0x100 + ((d >> 16) & 0xFF)] + ^ table[0x000 + ((d >> 24))]; + } + for (; size > 0; size--, p++) + v = CRC_UPDATE_BYTE_2(v, *p); + return v; +} + +#endif + + +#ifndef MY_CPU_LE + +#define CRC_UINT64_SWAP(v) \ + ((v >> 56) \ + | ((v >> 40) & ((UInt64)0xFF << 8)) \ + | ((v >> 24) & ((UInt64)0xFF << 16)) \ + | ((v >> 8) & ((UInt64)0xFF << 24)) \ + | ((v << 8) & ((UInt64)0xFF << 32)) \ + | ((v << 24) & ((UInt64)0xFF << 40)) \ + | ((v << 40) & ((UInt64)0xFF << 48)) \ + | ((v << 56))) + +#define CRC_UPDATE_BYTE_2_BE(crc, b) (table[(Byte)((crc) >> 56) ^ (b)] ^ ((crc) << 8)) + +UInt64 MY_FAST_CALL XzCrc64UpdateT1_BeT4(UInt64 v, const void *data, size_t size, const UInt64 *table) +{ + const Byte *p = (const Byte *)data; + table += 0x100; + v = CRC_UINT64_SWAP(v); + for (; size > 0 && ((unsigned)(ptrdiff_t)p & 3) != 0; size--, p++) + v = CRC_UPDATE_BYTE_2_BE(v, *p); + for (; size >= 4; size -= 4, p += 4) + { + UInt32 d = (UInt32)(v >> 32) ^ *(const UInt32 *)p; + v = (v << 32) + ^ table[0x000 + ((d ) & 0xFF)] + ^ table[0x100 + ((d >> 8) & 0xFF)] + ^ table[0x200 + ((d >> 16) & 0xFF)] + ^ table[0x300 + ((d >> 24))]; + } + for (; size > 0; size--, p++) + v = CRC_UPDATE_BYTE_2_BE(v, *p); + return CRC_UINT64_SWAP(v); +} + +#endif
diff --git a/third_party/lzma_sdk/XzDec.c b/third_party/lzma_sdk/XzDec.c new file mode 100644 index 0000000..1edc0245 --- /dev/null +++ b/third_party/lzma_sdk/XzDec.c
@@ -0,0 +1,913 @@ +/* XzDec.c -- Xz Decode +2015-11-09 : Igor Pavlov : Public domain */ + +#include "Precomp.h" + +/* #define XZ_DUMP */ + +#ifdef XZ_DUMP +#include <stdio.h> +#endif + +#include <stdlib.h> +#include <string.h> + +#include "7zCrc.h" +#include "Alloc.h" +#include "Bra.h" +#include "CpuArch.h" +#include "Delta.h" +#include "Lzma2Dec.h" + +#ifdef USE_SUBBLOCK +#include "Bcj3Dec.c" +#include "SbDec.c" +#endif + +#include "Xz.h" + +#define XZ_CHECK_SIZE_MAX 64 + +#define CODER_BUF_SIZE (1 << 17) + +unsigned Xz_ReadVarInt(const Byte *p, size_t maxSize, UInt64 *value) +{ + unsigned i, limit; + *value = 0; + limit = (maxSize > 9) ? 9 : (unsigned)maxSize; + + for (i = 0; i < limit;) + { + Byte b = p[i]; + *value |= (UInt64)(b & 0x7F) << (7 * i++); + if ((b & 0x80) == 0) + return (b == 0 && i != 1) ? 0 : i; + } + return 0; +} + +/* ---------- BraState ---------- */ + +#define BRA_BUF_SIZE (1 << 14) + +typedef struct +{ + size_t bufPos; + size_t bufConv; + size_t bufTotal; + + UInt32 methodId; + int encodeMode; + UInt32 delta; + UInt32 ip; + UInt32 x86State; + Byte deltaState[DELTA_STATE_SIZE]; + + Byte buf[BRA_BUF_SIZE]; +} CBraState; + +static void BraState_Free(void *pp, ISzAlloc *alloc) +{ + alloc->Free(alloc, pp); +} + +static SRes BraState_SetProps(void *pp, const Byte *props, size_t propSize, ISzAlloc *alloc) +{ + CBraState *p = ((CBraState *)pp); + UNUSED_VAR(alloc); + p->ip = 0; + if (p->methodId == XZ_ID_Delta) + { + if (propSize != 1) + return SZ_ERROR_UNSUPPORTED; + p->delta = (unsigned)props[0] + 1; + } + else + { + if (propSize == 4) + { + UInt32 v = GetUi32(props); + switch (p->methodId) + { + case XZ_ID_PPC: + case XZ_ID_ARM: + case XZ_ID_SPARC: + if ((v & 3) != 0) + return SZ_ERROR_UNSUPPORTED; + break; + case XZ_ID_ARMT: + if ((v & 1) != 0) + return SZ_ERROR_UNSUPPORTED; + break; + case XZ_ID_IA64: + if ((v & 0xF) != 0) + return SZ_ERROR_UNSUPPORTED; + break; + } + p->ip = v; + } + else if (propSize != 0) + return SZ_ERROR_UNSUPPORTED; + } + return SZ_OK; +} + +static void BraState_Init(void *pp) +{ + CBraState *p = ((CBraState *)pp); + p->bufPos = p->bufConv = p->bufTotal = 0; + x86_Convert_Init(p->x86State); + if (p->methodId == XZ_ID_Delta) + Delta_Init(p->deltaState); +} + +#define CASE_BRA_CONV(isa) case XZ_ID_ ## isa: p->bufConv = isa ## _Convert(p->buf, p->bufTotal, p->ip, p->encodeMode); break; + +static SRes BraState_Code(void *pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + int srcWasFinished, ECoderFinishMode finishMode, int *wasFinished) +{ + CBraState *p = ((CBraState *)pp); + SizeT destLenOrig = *destLen; + SizeT srcLenOrig = *srcLen; + UNUSED_VAR(finishMode); + *destLen = 0; + *srcLen = 0; + *wasFinished = 0; + while (destLenOrig > 0) + { + if (p->bufPos != p->bufConv) + { + size_t curSize = p->bufConv - p->bufPos; + if (curSize > destLenOrig) + curSize = destLenOrig; + memcpy(dest, p->buf + p->bufPos, curSize); + p->bufPos += curSize; + *destLen += curSize; + dest += curSize; + destLenOrig -= curSize; + continue; + } + p->bufTotal -= p->bufPos; + memmove(p->buf, p->buf + p->bufPos, p->bufTotal); + p->bufPos = 0; + p->bufConv = 0; + { + size_t curSize = BRA_BUF_SIZE - p->bufTotal; + if (curSize > srcLenOrig) + curSize = srcLenOrig; + memcpy(p->buf + p->bufTotal, src, curSize); + *srcLen += curSize; + src += curSize; + srcLenOrig -= curSize; + p->bufTotal += curSize; + } + if (p->bufTotal == 0) + break; + switch (p->methodId) + { + case XZ_ID_Delta: + if (p->encodeMode) + Delta_Encode(p->deltaState, p->delta, p->buf, p->bufTotal); + else + Delta_Decode(p->deltaState, p->delta, p->buf, p->bufTotal); + p->bufConv = p->bufTotal; + break; + case XZ_ID_X86: + p->bufConv = x86_Convert(p->buf, p->bufTotal, p->ip, &p->x86State, p->encodeMode); + break; + CASE_BRA_CONV(PPC) + CASE_BRA_CONV(IA64) + CASE_BRA_CONV(ARM) + CASE_BRA_CONV(ARMT) + CASE_BRA_CONV(SPARC) + default: + return SZ_ERROR_UNSUPPORTED; + } + p->ip += (UInt32)p->bufConv; + + if (p->bufConv == 0) + { + if (!srcWasFinished) + break; + p->bufConv = p->bufTotal; + } + } + if (p->bufTotal == p->bufPos && srcLenOrig == 0 && srcWasFinished) + *wasFinished = 1; + return SZ_OK; +} + +SRes BraState_SetFromMethod(IStateCoder *p, UInt64 id, int encodeMode, ISzAlloc *alloc) +{ + CBraState *decoder; + if (id != XZ_ID_Delta && + id != XZ_ID_X86 && + id != XZ_ID_PPC && + id != XZ_ID_IA64 && + id != XZ_ID_ARM && + id != XZ_ID_ARMT && + id != XZ_ID_SPARC) + return SZ_ERROR_UNSUPPORTED; + p->p = 0; + decoder = (CBraState *)alloc->Alloc(alloc, sizeof(CBraState)); + if (decoder == 0) + return SZ_ERROR_MEM; + decoder->methodId = (UInt32)id; + decoder->encodeMode = encodeMode; + p->p = decoder; + p->Free = BraState_Free; + p->SetProps = BraState_SetProps; + p->Init = BraState_Init; + p->Code = BraState_Code; + return SZ_OK; +} + +/* ---------- SbState ---------- */ + +#ifdef USE_SUBBLOCK + +static void SbState_Free(void *pp, ISzAlloc *alloc) +{ + CSbDec *p = (CSbDec *)pp; + SbDec_Free(p); + alloc->Free(alloc, pp); +} + +static SRes SbState_SetProps(void *pp, const Byte *props, size_t propSize, ISzAlloc *alloc) +{ + UNUSED_VAR(pp); + UNUSED_VAR(props); + UNUSED_VAR(alloc); + return (propSize == 0) ? SZ_OK : SZ_ERROR_UNSUPPORTED; +} + +static void SbState_Init(void *pp) +{ + SbDec_Init((CSbDec *)pp); +} + +static SRes SbState_Code(void *pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + int srcWasFinished, ECoderFinishMode finishMode, int *wasFinished) +{ + CSbDec *p = (CSbDec *)pp; + SRes res; + UNUSED_VAR(srcWasFinished); + p->dest = dest; + p->destLen = *destLen; + p->src = src; + p->srcLen = *srcLen; + p->finish = finishMode; /* change it */ + res = SbDec_Decode((CSbDec *)pp); + *destLen -= p->destLen; + *srcLen -= p->srcLen; + *wasFinished = (*destLen == 0 && *srcLen == 0); /* change it */ + return res; +} + +SRes SbState_SetFromMethod(IStateCoder *p, ISzAlloc *alloc) +{ + CSbDec *decoder; + p->p = 0; + decoder = alloc->Alloc(alloc, sizeof(CSbDec)); + if (decoder == 0) + return SZ_ERROR_MEM; + p->p = decoder; + p->Free = SbState_Free; + p->SetProps = SbState_SetProps; + p->Init = SbState_Init; + p->Code = SbState_Code; + SbDec_Construct(decoder); + SbDec_SetAlloc(decoder, alloc); + return SZ_OK; +} +#endif + +/* ---------- Lzma2State ---------- */ + +static void Lzma2State_Free(void *pp, ISzAlloc *alloc) +{ + Lzma2Dec_Free((CLzma2Dec *)pp, alloc); + alloc->Free(alloc, pp); +} + +static SRes Lzma2State_SetProps(void *pp, const Byte *props, size_t propSize, ISzAlloc *alloc) +{ + if (propSize != 1) + return SZ_ERROR_UNSUPPORTED; + return Lzma2Dec_Allocate((CLzma2Dec *)pp, props[0], alloc); +} + +static void Lzma2State_Init(void *pp) +{ + Lzma2Dec_Init((CLzma2Dec *)pp); +} + +static SRes Lzma2State_Code(void *pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, + int srcWasFinished, ECoderFinishMode finishMode, int *wasFinished) +{ + ELzmaStatus status; + /* ELzmaFinishMode fm = (finishMode == LZMA_FINISH_ANY) ? LZMA_FINISH_ANY : LZMA_FINISH_END; */ + SRes res = Lzma2Dec_DecodeToBuf((CLzma2Dec *)pp, dest, destLen, src, srcLen, (ELzmaFinishMode)finishMode, &status); + UNUSED_VAR(srcWasFinished); + *wasFinished = (status == LZMA_STATUS_FINISHED_WITH_MARK); + return res; +} + +static SRes Lzma2State_SetFromMethod(IStateCoder *p, ISzAlloc *alloc) +{ + CLzma2Dec *decoder = (CLzma2Dec *)alloc->Alloc(alloc, sizeof(CLzma2Dec)); + p->p = decoder; + if (decoder == 0) + return SZ_ERROR_MEM; + p->Free = Lzma2State_Free; + p->SetProps = Lzma2State_SetProps; + p->Init = Lzma2State_Init; + p->Code = Lzma2State_Code; + Lzma2Dec_Construct(decoder); + return SZ_OK; +} + + +void MixCoder_Construct(CMixCoder *p, ISzAlloc *alloc) +{ + unsigned i; + p->alloc = alloc; + p->buf = NULL; + p->numCoders = 0; + for (i = 0; i < MIXCODER_NUM_FILTERS_MAX; i++) + p->coders[i].p = NULL; +} + +void MixCoder_Free(CMixCoder *p) +{ + unsigned i; + for (i = 0; i < p->numCoders; i++) + { + IStateCoder *sc = &p->coders[i]; + if (p->alloc && sc->p) + sc->Free(sc->p, p->alloc); + } + p->numCoders = 0; + if (p->buf) + { + p->alloc->Free(p->alloc, p->buf); + p->buf = NULL; /* 9.31: the BUG was fixed */ + } +} + +void MixCoder_Init(CMixCoder *p) +{ + unsigned i; + for (i = 0; i < MIXCODER_NUM_FILTERS_MAX - 1; i++) + { + p->size[i] = 0; + p->pos[i] = 0; + p->finished[i] = 0; + } + for (i = 0; i < p->numCoders; i++) + { + IStateCoder *coder = &p->coders[i]; + coder->Init(coder->p); + } +} + +SRes MixCoder_SetFromMethod(CMixCoder *p, unsigned coderIndex, UInt64 methodId) +{ + IStateCoder *sc = &p->coders[coderIndex]; + p->ids[coderIndex] = methodId; + switch (methodId) + { + case XZ_ID_LZMA2: return Lzma2State_SetFromMethod(sc, p->alloc); + #ifdef USE_SUBBLOCK + case XZ_ID_Subblock: return SbState_SetFromMethod(sc, p->alloc); + #endif + } + if (coderIndex == 0) + return SZ_ERROR_UNSUPPORTED; + return BraState_SetFromMethod(sc, methodId, 0, p->alloc); +} + +SRes MixCoder_Code(CMixCoder *p, Byte *dest, SizeT *destLen, + const Byte *src, SizeT *srcLen, int srcWasFinished, + ECoderFinishMode finishMode, ECoderStatus *status) +{ + SizeT destLenOrig = *destLen; + SizeT srcLenOrig = *srcLen; + Bool allFinished = True; + *destLen = 0; + *srcLen = 0; + *status = CODER_STATUS_NOT_FINISHED; + + if (!p->buf) + { + p->buf = (Byte *)p->alloc->Alloc(p->alloc, CODER_BUF_SIZE * (MIXCODER_NUM_FILTERS_MAX - 1)); + if (!p->buf) + return SZ_ERROR_MEM; + } + + if (p->numCoders != 1) + finishMode = CODER_FINISH_ANY; + + for (;;) + { + Bool processed = False; + unsigned i; + /* + if (p->numCoders == 1 && *destLen == destLenOrig && finishMode == LZMA_FINISH_ANY) + break; + */ + + for (i = 0; i < p->numCoders; i++) + { + SRes res; + IStateCoder *coder = &p->coders[i]; + Byte *destCur; + SizeT destLenCur, srcLenCur; + const Byte *srcCur; + int srcFinishedCur; + int encodingWasFinished; + + if (i == 0) + { + srcCur = src; + srcLenCur = srcLenOrig - *srcLen; + srcFinishedCur = srcWasFinished; + } + else + { + srcCur = p->buf + (CODER_BUF_SIZE * (i - 1)) + p->pos[i - 1]; + srcLenCur = p->size[i - 1] - p->pos[i - 1]; + srcFinishedCur = p->finished[i - 1]; + } + + if (i == p->numCoders - 1) + { + destCur = dest; + destLenCur = destLenOrig - *destLen; + } + else + { + if (p->pos[i] != p->size[i]) + continue; + destCur = p->buf + (CODER_BUF_SIZE * i); + destLenCur = CODER_BUF_SIZE; + } + + res = coder->Code(coder->p, destCur, &destLenCur, srcCur, &srcLenCur, srcFinishedCur, finishMode, &encodingWasFinished); + + if (!encodingWasFinished) + allFinished = False; + + if (i == 0) + { + *srcLen += srcLenCur; + src += srcLenCur; + } + else + { + p->pos[i - 1] += srcLenCur; + } + + if (i == p->numCoders - 1) + { + *destLen += destLenCur; + dest += destLenCur; + } + else + { + p->size[i] = destLenCur; + p->pos[i] = 0; + p->finished[i] = encodingWasFinished; + } + + if (res != SZ_OK) + return res; + + if (destLenCur != 0 || srcLenCur != 0) + processed = True; + } + if (!processed) + break; + } + if (allFinished) + *status = CODER_STATUS_FINISHED_WITH_MARK; + return SZ_OK; +} + +SRes Xz_ParseHeader(CXzStreamFlags *p, const Byte *buf) +{ + *p = (CXzStreamFlags)GetBe16(buf + XZ_SIG_SIZE); + if (CrcCalc(buf + XZ_SIG_SIZE, XZ_STREAM_FLAGS_SIZE) != + GetUi32(buf + XZ_SIG_SIZE + XZ_STREAM_FLAGS_SIZE)) + return SZ_ERROR_NO_ARCHIVE; + return XzFlags_IsSupported(*p) ? SZ_OK : SZ_ERROR_UNSUPPORTED; +} + +static Bool Xz_CheckFooter(CXzStreamFlags flags, UInt64 indexSize, const Byte *buf) +{ + return + indexSize == (((UInt64)GetUi32(buf + 4) + 1) << 2) && + (GetUi32(buf) == CrcCalc(buf + 4, 6) && + flags == GetBe16(buf + 8) && + memcmp(buf + 10, XZ_FOOTER_SIG, XZ_FOOTER_SIG_SIZE) == 0); +} + +#define READ_VARINT_AND_CHECK(buf, pos, size, res) \ + { unsigned s = Xz_ReadVarInt(buf + pos, size - pos, res); \ + if (s == 0) return SZ_ERROR_ARCHIVE; pos += s; } + + +SRes XzBlock_Parse(CXzBlock *p, const Byte *header) +{ + unsigned pos; + unsigned numFilters, i; + unsigned headerSize = (unsigned)header[0] << 2; + + if (CrcCalc(header, headerSize) != GetUi32(header + headerSize)) + return SZ_ERROR_ARCHIVE; + + pos = 1; + if (pos == headerSize) + return SZ_ERROR_ARCHIVE; + p->flags = header[pos++]; + + if (XzBlock_HasPackSize(p)) + { + READ_VARINT_AND_CHECK(header, pos, headerSize, &p->packSize); + if (p->packSize == 0 || p->packSize + headerSize >= (UInt64)1 << 63) + return SZ_ERROR_ARCHIVE; + } + + if (XzBlock_HasUnpackSize(p)) + READ_VARINT_AND_CHECK(header, pos, headerSize, &p->unpackSize); + + numFilters = XzBlock_GetNumFilters(p); + for (i = 0; i < numFilters; i++) + { + CXzFilter *filter = p->filters + i; + UInt64 size; + READ_VARINT_AND_CHECK(header, pos, headerSize, &filter->id); + READ_VARINT_AND_CHECK(header, pos, headerSize, &size); + if (size > headerSize - pos || size > XZ_FILTER_PROPS_SIZE_MAX) + return SZ_ERROR_ARCHIVE; + filter->propsSize = (UInt32)size; + memcpy(filter->props, header + pos, (size_t)size); + pos += (unsigned)size; + + #ifdef XZ_DUMP + printf("\nf[%u] = %2X: ", i, (unsigned)filter->id); + { + unsigned i; + for (i = 0; i < size; i++) + printf(" %2X", filter->props[i]); + } + #endif + } + + while (pos < headerSize) + if (header[pos++] != 0) + return SZ_ERROR_ARCHIVE; + return SZ_OK; +} + +SRes XzDec_Init(CMixCoder *p, const CXzBlock *block) +{ + unsigned i; + Bool needReInit = True; + unsigned numFilters = XzBlock_GetNumFilters(block); + + if (numFilters == p->numCoders) + { + for (i = 0; i < numFilters; i++) + if (p->ids[i] != block->filters[numFilters - 1 - i].id) + break; + needReInit = (i != numFilters); + } + + if (needReInit) + { + MixCoder_Free(p); + p->numCoders = numFilters; + for (i = 0; i < numFilters; i++) + { + const CXzFilter *f = &block->filters[numFilters - 1 - i]; + RINOK(MixCoder_SetFromMethod(p, i, f->id)); + } + } + + for (i = 0; i < numFilters; i++) + { + const CXzFilter *f = &block->filters[numFilters - 1 - i]; + IStateCoder *sc = &p->coders[i]; + RINOK(sc->SetProps(sc->p, f->props, f->propsSize, p->alloc)); + } + + MixCoder_Init(p); + return SZ_OK; +} + +void XzUnpacker_Init(CXzUnpacker *p) +{ + p->state = XZ_STATE_STREAM_HEADER; + p->pos = 0; + p->numStartedStreams = 0; + p->numFinishedStreams = 0; + p->numTotalBlocks = 0; + p->padSize = 0; +} + +void XzUnpacker_Construct(CXzUnpacker *p, ISzAlloc *alloc) +{ + MixCoder_Construct(&p->decoder, alloc); + XzUnpacker_Init(p); +} + +void XzUnpacker_Free(CXzUnpacker *p) +{ + MixCoder_Free(&p->decoder); +} + +SRes XzUnpacker_Code(CXzUnpacker *p, Byte *dest, SizeT *destLen, + const Byte *src, SizeT *srcLen, ECoderFinishMode finishMode, ECoderStatus *status) +{ + SizeT destLenOrig = *destLen; + SizeT srcLenOrig = *srcLen; + *destLen = 0; + *srcLen = 0; + *status = CODER_STATUS_NOT_SPECIFIED; + for (;;) + { + SizeT srcRem = srcLenOrig - *srcLen; + + if (p->state == XZ_STATE_BLOCK) + { + SizeT destLen2 = destLenOrig - *destLen; + SizeT srcLen2 = srcLenOrig - *srcLen; + SRes res; + if (srcLen2 == 0 && destLen2 == 0) + { + *status = CODER_STATUS_NOT_FINISHED; + return SZ_OK; + } + + res = MixCoder_Code(&p->decoder, dest, &destLen2, src, &srcLen2, False, finishMode, status); + XzCheck_Update(&p->check, dest, destLen2); + + (*srcLen) += srcLen2; + src += srcLen2; + p->packSize += srcLen2; + + (*destLen) += destLen2; + dest += destLen2; + p->unpackSize += destLen2; + + RINOK(res); + + if (*status == CODER_STATUS_FINISHED_WITH_MARK) + { + Byte temp[32]; + unsigned num = Xz_WriteVarInt(temp, p->packSize + p->blockHeaderSize + XzFlags_GetCheckSize(p->streamFlags)); + num += Xz_WriteVarInt(temp + num, p->unpackSize); + Sha256_Update(&p->sha, temp, num); + p->indexSize += num; + p->numBlocks++; + + p->state = XZ_STATE_BLOCK_FOOTER; + p->pos = 0; + p->alignPos = 0; + } + else if (srcLen2 == 0 && destLen2 == 0) + return SZ_OK; + + continue; + } + + if (srcRem == 0) + { + *status = CODER_STATUS_NEEDS_MORE_INPUT; + return SZ_OK; + } + + switch (p->state) + { + case XZ_STATE_STREAM_HEADER: + { + if (p->pos < XZ_STREAM_HEADER_SIZE) + { + if (p->pos < XZ_SIG_SIZE && *src != XZ_SIG[p->pos]) + return SZ_ERROR_NO_ARCHIVE; + p->buf[p->pos++] = *src++; + (*srcLen)++; + } + else + { + RINOK(Xz_ParseHeader(&p->streamFlags, p->buf)); + p->numStartedStreams++; + p->state = XZ_STATE_BLOCK_HEADER; + Sha256_Init(&p->sha); + p->indexSize = 0; + p->numBlocks = 0; + p->pos = 0; + } + break; + } + + case XZ_STATE_BLOCK_HEADER: + { + if (p->pos == 0) + { + p->buf[p->pos++] = *src++; + (*srcLen)++; + if (p->buf[0] == 0) + { + p->indexPreSize = 1 + Xz_WriteVarInt(p->buf + 1, p->numBlocks); + p->indexPos = p->indexPreSize; + p->indexSize += p->indexPreSize; + Sha256_Final(&p->sha, p->shaDigest); + Sha256_Init(&p->sha); + p->crc = CrcUpdate(CRC_INIT_VAL, p->buf, p->indexPreSize); + p->state = XZ_STATE_STREAM_INDEX; + } + p->blockHeaderSize = ((UInt32)p->buf[0] << 2) + 4; + } + else if (p->pos != p->blockHeaderSize) + { + UInt32 cur = p->blockHeaderSize - p->pos; + if (cur > srcRem) + cur = (UInt32)srcRem; + memcpy(p->buf + p->pos, src, cur); + p->pos += cur; + (*srcLen) += cur; + src += cur; + } + else + { + RINOK(XzBlock_Parse(&p->block, p->buf)); + p->numTotalBlocks++; + p->state = XZ_STATE_BLOCK; + p->packSize = 0; + p->unpackSize = 0; + XzCheck_Init(&p->check, XzFlags_GetCheckType(p->streamFlags)); + RINOK(XzDec_Init(&p->decoder, &p->block)); + } + break; + } + + case XZ_STATE_BLOCK_FOOTER: + { + if (((p->packSize + p->alignPos) & 3) != 0) + { + (*srcLen)++; + p->alignPos++; + if (*src++ != 0) + return SZ_ERROR_CRC; + } + else + { + UInt32 checkSize = XzFlags_GetCheckSize(p->streamFlags); + UInt32 cur = checkSize - p->pos; + if (cur != 0) + { + if (cur > srcRem) + cur = (UInt32)srcRem; + memcpy(p->buf + p->pos, src, cur); + p->pos += cur; + (*srcLen) += cur; + src += cur; + } + else + { + Byte digest[XZ_CHECK_SIZE_MAX]; + p->state = XZ_STATE_BLOCK_HEADER; + p->pos = 0; + if (XzCheck_Final(&p->check, digest) && memcmp(digest, p->buf, checkSize) != 0) + return SZ_ERROR_CRC; + } + } + break; + } + + case XZ_STATE_STREAM_INDEX: + { + if (p->pos < p->indexPreSize) + { + (*srcLen)++; + if (*src++ != p->buf[p->pos++]) + return SZ_ERROR_CRC; + } + else + { + if (p->indexPos < p->indexSize) + { + UInt64 cur = p->indexSize - p->indexPos; + if (srcRem > cur) + srcRem = (SizeT)cur; + p->crc = CrcUpdate(p->crc, src, srcRem); + Sha256_Update(&p->sha, src, srcRem); + (*srcLen) += srcRem; + src += srcRem; + p->indexPos += srcRem; + } + else if ((p->indexPos & 3) != 0) + { + Byte b = *src++; + p->crc = CRC_UPDATE_BYTE(p->crc, b); + (*srcLen)++; + p->indexPos++; + p->indexSize++; + if (b != 0) + return SZ_ERROR_CRC; + } + else + { + Byte digest[SHA256_DIGEST_SIZE]; + p->state = XZ_STATE_STREAM_INDEX_CRC; + p->indexSize += 4; + p->pos = 0; + Sha256_Final(&p->sha, digest); + if (memcmp(digest, p->shaDigest, SHA256_DIGEST_SIZE) != 0) + return SZ_ERROR_CRC; + } + } + break; + } + + case XZ_STATE_STREAM_INDEX_CRC: + { + if (p->pos < 4) + { + (*srcLen)++; + p->buf[p->pos++] = *src++; + } + else + { + p->state = XZ_STATE_STREAM_FOOTER; + p->pos = 0; + if (CRC_GET_DIGEST(p->crc) != GetUi32(p->buf)) + return SZ_ERROR_CRC; + } + break; + } + + case XZ_STATE_STREAM_FOOTER: + { + UInt32 cur = XZ_STREAM_FOOTER_SIZE - p->pos; + if (cur > srcRem) + cur = (UInt32)srcRem; + memcpy(p->buf + p->pos, src, cur); + p->pos += cur; + (*srcLen) += cur; + src += cur; + if (p->pos == XZ_STREAM_FOOTER_SIZE) + { + p->state = XZ_STATE_STREAM_PADDING; + p->numFinishedStreams++; + p->padSize = 0; + if (!Xz_CheckFooter(p->streamFlags, p->indexSize, p->buf)) + return SZ_ERROR_CRC; + } + break; + } + + case XZ_STATE_STREAM_PADDING: + { + if (*src != 0) + { + if (((UInt32)p->padSize & 3) != 0) + return SZ_ERROR_NO_ARCHIVE; + p->pos = 0; + p->state = XZ_STATE_STREAM_HEADER; + } + else + { + (*srcLen)++; + src++; + p->padSize++; + } + break; + } + + case XZ_STATE_BLOCK: break; /* to disable GCC warning */ + } + } + /* + if (p->state == XZ_STATE_FINISHED) + *status = CODER_STATUS_FINISHED_WITH_MARK; + return SZ_OK; + */ +} + +Bool XzUnpacker_IsStreamWasFinished(CXzUnpacker *p) +{ + return (p->state == XZ_STATE_STREAM_PADDING) && (((UInt32)p->padSize & 3) == 0); +} + +UInt64 XzUnpacker_GetExtraSize(CXzUnpacker *p) +{ + UInt64 num = 0; + if (p->state == XZ_STATE_STREAM_PADDING) + num += p->padSize; + else if (p->state == XZ_STATE_STREAM_HEADER) + num += p->padSize + p->pos; + return num; +}
diff --git a/tools/accessibility/inspect/ax_dump_events.cc b/tools/accessibility/inspect/ax_dump_events.cc index 5846b859..0cdf971 100644 --- a/tools/accessibility/inspect/ax_dump_events.cc +++ b/tools/accessibility/inspect/ax_dump_events.cc
@@ -8,6 +8,7 @@ #include "base/at_exit.h" #include "base/command_line.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/strings/string_number_conversions.h" #include "base/task/single_thread_task_executor.h" @@ -63,8 +64,7 @@ } base::AtExitManager exit_manager; - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); const auto server = std::make_unique<tools::AXEventServer>(pid, pattern_str); base::RunLoop().Run(); return 0;
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 8f5f3dbf..5abfe39 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -24242,6 +24242,7 @@ <int value="2990" label="V8SpeechRecognition_Constructor"/> <int value="2991" label="V8SpeechRecognition_Grammars_AttributeGetter"/> <int value="2992" label="V8SpeechRecognition_Grammars_AttributeSetter"/> + <int value="2993" label="ContactsManagerSelect"/> </enum> <enum name="FeaturePolicyAllowlistType"> @@ -35023,6 +35024,7 @@ <int value="-855130893" label="enable-touch-calibration-setting"/> <int value="-854716639" label="TranslateAndroidManualTrigger:enabled"/> <int value="-853594220" label="disable-new-avatar-menu"/> + <int value="-850821337" label="WebContentsForceDark:enabled"/> <int value="-848691867" label="DesktopPWAWindowing:enabled"/> <int value="-847651283" label="new-password-form-parsing:disabled"/> <int value="-847216521" label="ChromeDuplex:enabled"/> @@ -36223,6 +36225,7 @@ <int value="887011602" label="enable-spelling-auto-correct"/> <int value="892899792" label="MaterialDesignIncognitoNTP:disabled"/> <int value="900614020" label="ContentSuggestionsShowSummary:disabled"/> + <int value="902839593" label="WebContentsForceDark:disabled"/> <int value="903267263" label="disable-offline-pages"/> <int value="908302031" label="OmniboxUIExperimentElideSuggestionUrlAfterHost:enabled"/> @@ -39799,6 +39802,12 @@ <int value="4" label="Interrupted"/> </enum> +<enum name="MobileDownloadBackgroundTargetDeterminationResult"> + <int value="0" label="Success"/> + <int value="1" label="Target path missing"/> + <int value="2" label="Path reservation failed"/> +</enum> + <enum name="MobileDownloadCancelReason"> <int value="0" label="Not canceled"/> <int value="1" label="Click on the cancel button"/>
diff --git a/tools/metrics/histograms/expand_owners.py b/tools/metrics/histograms/expand_owners.py index ab07071..747f6f9 100644 --- a/tools/metrics/histograms/expand_owners.py +++ b/tools/metrics/histograms/expand_owners.py
@@ -4,7 +4,7 @@ """Functions for extracting email addresses from OWNERS files.""" -import histogram_ownership +import extract_histograms import os import re @@ -196,7 +196,7 @@ is_email = email_pattern.match(owner_text) is_primary_owner = (is_email or - owner_text == histogram_ownership.DUMMY_OWNER) + owner_text == extract_histograms.OWNER_PLACEHOLDER) if index == 0 and not is_primary_owner: raise Error('The histogram {} must have a primary owner, i.e. an ' 'individual\'s email address.'
diff --git a/tools/metrics/histograms/extract_histograms.py b/tools/metrics/histograms/extract_histograms.py index c1b91af8..5cb1a726 100644 --- a/tools/metrics/histograms/extract_histograms.py +++ b/tools/metrics/histograms/extract_histograms.py
@@ -97,7 +97,7 @@ def _NormalizeString(s): - """Replaces all whitespace sequences with a single space. + r"""Replaces all whitespace sequences with a single space. The function properly handles multi-line strings and XML escaped characters.
diff --git a/tools/metrics/histograms/histogram_ownership.py b/tools/metrics/histograms/histogram_ownership.py index a4eee34..5d7f9cff 100755 --- a/tools/metrics/histograms/histogram_ownership.py +++ b/tools/metrics/histograms/histogram_ownership.py
@@ -7,6 +7,7 @@ histograms. """ +import extract_histograms import os import sys import xml.etree.ElementTree @@ -14,8 +15,6 @@ sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common')) import path_util -DUMMY_OWNER = "Please list the metric's owners. Add more owner tags as needed." - def main(): tree = xml.etree.ElementTree.parse(path_util.GetHistogramsFile()) root = tree.getroot() @@ -42,7 +41,7 @@ continue if node.tag != 'owner': continue - if node.text == DUMMY_OWNER: + if node.text == extract_histograms.OWNER_PLACEHOLDER: continue assert '@' in node.text owners.append(node.text)
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 1853eed..8c952a3d 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -718,7 +718,7 @@ </histogram> <histogram name="AccountManager.Migrations.Result" enum="BooleanSuccess" - expires_after="2019-11-05"> + expires_after="2020-01-26"> <owner>sinhak@chromium.org</owner> <summary> Tracks the final result of migrating accounts to Chrome OS Account Manager. @@ -727,7 +727,7 @@ </histogram> <histogram base="true" name="AccountManager.Migrations.StepResult" - enum="BooleanSuccess" expires_after="2019-11-05"> + enum="BooleanSuccess" expires_after="2020-01-26"> <!-- Name completed by histogram_suffixes name="AccountManagerMigrationSteps" --> @@ -740,7 +740,7 @@ </histogram> <histogram name="AccountManager.NumAccounts" units="count" - expires_after="2019-11-05"> + expires_after="2020-01-26"> <owner>sinhak@chromium.org</owner> <summary> Tracks the number of accounts stored in Chrome OS Account Manager by a given @@ -965,7 +965,7 @@ </summary> </histogram> -<histogram name="Ads.Media.BytesReceived" units="KB" expires_after="2019-10-20"> +<histogram name="Ads.Media.BytesReceived" units="KB" expires_after="2020-01-26"> <owner>johnidel@chromium.org</owner> <summary> Total number of bytes buffered over the lifetime of a WebMediaPlayer inside @@ -1496,7 +1496,7 @@ </histogram> <histogram name="Android.Activity.ChromeTabbedActivity.SystemBackAction" - enum="AndroidActivitySystemBackAction"> + enum="AndroidActivitySystemBackAction" expires_after="2020-01-26"> <owner>twellington@chromium.org</owner> <summary> What happened when the user hit the system back button in @@ -1571,7 +1571,7 @@ </histogram> <histogram name="Android.BackgroundTaskScheduler.TaskCanceled" - enum="BackgroundTaskId"> + enum="BackgroundTaskId" expires_after="2020-01-26"> <owner>fgorski@chromium.org</owner> <owner>nyquist@chromium.org</owner> <summary>Records that a specific background task has been canceled.</summary> @@ -1606,7 +1606,7 @@ </histogram> <histogram name="Android.BackgroundTaskScheduler.TaskScheduled.Failure" - enum="BackgroundTaskId"> + enum="BackgroundTaskId" expires_after="2020-01-26"> <owner>fgorski@chromium.org</owner> <owner>nyquist@chromium.org</owner> <summary> @@ -1615,7 +1615,7 @@ </histogram> <histogram name="Android.BackgroundTaskScheduler.TaskScheduled.Success" - enum="BackgroundTaskId"> + enum="BackgroundTaskId" expires_after="2020-01-26"> <owner>fgorski@chromium.org</owner> <owner>nyquist@chromium.org</owner> <summary> @@ -1631,7 +1631,7 @@ </histogram> <histogram name="Android.BackgroundTaskScheduler.TaskStopped" - enum="BackgroundTaskId"> + enum="BackgroundTaskId" expires_after="2020-01-26"> <owner>fgorski@chromium.org</owner> <owner>nyquist@chromium.org</owner> <summary> @@ -2041,7 +2041,7 @@ </histogram> <histogram name="Android.DownloadManager.Filter" - enum="AndroidDownloadFilterType"> + enum="AndroidDownloadFilterType" expires_after="2020-01-26"> <owner>dtrainor@chromium.org</owner> <owner>clank-downloads@google.com</owner> <summary> @@ -2111,7 +2111,7 @@ </histogram> <histogram name="Android.DownloadManager.Menu.Action" - enum="Android.DownloadManager.Menu.Actions"> + enum="Android.DownloadManager.Menu.Actions" expires_after="2020-01-26"> <owner>dtrainor@chromium.org</owner> <owner>clank-downloads@google.com</owner> <summary>The count of Download Home top level menu actions taken.</summary> @@ -3932,7 +3932,7 @@ </histogram> <histogram name="AndroidSms.FcmMessageDispatchSuccess" - enum="AndroidSmsFcmMessageType"> + enum="AndroidSmsFcmMessageType" expires_after="2020-01-26"> <owner>azeemarshad@chromium.org</owner> <summary> Records message types for which dispatching to Android Messages for Web @@ -3942,7 +3942,7 @@ </histogram> <histogram name="AndroidSms.MultiDeviceFeatureState" - enum="MultiDevice_FeatureState"> + enum="MultiDevice_FeatureState" expires_after="2020-01-26"> <owner>jlklein@chromium.org</owner> <summary> Indicates the feature state of the Messages feature. This metric is emitted @@ -4742,7 +4742,7 @@ </histogram> <histogram name="Apps.AppListPlayStoreQueryState" - enum="AppListPlayStoreQueryState"> + enum="AppListPlayStoreQueryState" expires_after="2020-01-26"> <owner>hejq@chromium.org</owner> <summary>The state of a Play Store app search request.</summary> </histogram> @@ -5428,7 +5428,8 @@ </histogram> <histogram base="true" - name="Apps.PaginationTransition.DragScroll.PresentationTime" units="ms"> + name="Apps.PaginationTransition.DragScroll.PresentationTime" units="ms" + expires_after="2020-01-26"> <!-- Name completed by histogram_suffixes name="TabletOrClamshellMode" --> @@ -5444,7 +5445,7 @@ <histogram base="true" name="Apps.PaginationTransition.DragScroll.PresentationTime.MaxLatency" - units="ms"> + units="ms" expires_after="2020-01-26"> <!-- Name completed by histogram_suffixes name="TabletOrClamshellMode" --> @@ -5473,7 +5474,7 @@ </histogram> <histogram base="true" name="Apps.StateTransition.Drag.PresentationTime" - units="ms"> + units="ms" expires_after="2020-01-26"> <!-- Name completed by histogram_suffixes name="TabletOrClamshellMode" --> @@ -5504,13 +5505,13 @@ </summary> </histogram> -<histogram name="Arc.AndroidBootTime" units="ms"> +<histogram name="Arc.AndroidBootTime" units="ms" expires_after="2020-01-26"> <owner>elijahtaylor@google.com</owner> <owner>shihuis@google.com</owner> <summary>The time elapsed for booting up the ARC instance.</summary> </histogram> -<histogram name="Arc.AppCount"> +<histogram name="Arc.AppCount" expires_after="2020-01-26"> <owner>elijahtaylor@google.com</owner> <owner>shihuis@google.com</owner> <summary> @@ -5712,12 +5713,14 @@ </summary> </histogram> -<histogram name="Arc.CustomTabs.SessionLifetime2.All" units="ms"> +<histogram name="Arc.CustomTabs.SessionLifetime2.All" units="ms" + expires_after="2020-01-26"> <owner>hashimoto@google.com</owner> <summary>Lifetime of each session. Recorded when a session ends.</summary> </histogram> -<histogram name="Arc.CustomTabs.SessionLifetime2.Closed" units="ms"> +<histogram name="Arc.CustomTabs.SessionLifetime2.Closed" units="ms" + expires_after="2020-01-26"> <owner>hashimoto@google.com</owner> <summary> Lifetime of each session. Recorded when a session is closed. @@ -5725,7 +5728,7 @@ </histogram> <histogram name="Arc.CustomTabs.SessionLifetime2.ForwardedToNormalTab" - units="ms"> + units="ms" expires_after="2020-01-26"> <owner>hashimoto@google.com</owner> <summary> Lifetime of each session. Recorded when a session ends because the tab was @@ -5733,7 +5736,8 @@ </summary> </histogram> -<histogram name="Arc.EngagementTime.ArcTotal" units="ms"> +<histogram name="Arc.EngagementTime.ArcTotal" units="ms" + expires_after="2020-01-26"> <owner>maajid@google.com</owner> <owner>shaochuan@google.com</owner> <owner>shihuis@google.com</owner> @@ -5757,7 +5761,8 @@ </summary> </histogram> -<histogram name="Arc.EngagementTime.Foreground" units="ms"> +<histogram name="Arc.EngagementTime.Foreground" units="ms" + expires_after="2020-01-26"> <owner>maajid@google.com</owner> <owner>shaochuan@google.com</owner> <owner>shihuis@google.com</owner> @@ -5767,7 +5772,8 @@ </summary> </histogram> -<histogram name="Arc.EngagementTime.Total" units="ms"> +<histogram name="Arc.EngagementTime.Total" units="ms" + expires_after="2020-01-26"> <owner>maajid@google.com</owner> <owner>shaochuan@google.com</owner> <owner>shihuis@google.com</owner> @@ -5923,7 +5929,8 @@ <summary>The elapsed time since last OOM kill event.</summary> </histogram> -<histogram name="Arc.OptInAction" enum="ArcOptInAction"> +<histogram name="Arc.OptInAction" enum="ArcOptInAction" + expires_after="2020-01-26"> <owner>elijahtaylor@google.com</owner> <owner>shihuis@google.com</owner> <summary>Arc OptIn action taken by user.</summary> @@ -5935,7 +5942,8 @@ <summary>Arc OptIn cancelation reason.</summary> </histogram> -<histogram name="Arc.OptInResult" enum="ArcOptInResult"> +<histogram name="Arc.OptInResult" enum="ArcOptInResult" + expires_after="2020-01-26"> <owner>elijahtaylor@google.com</owner> <owner>khmel@google.com</owner> <summary>Arc OptIn flow result.</summary> @@ -5997,7 +6005,8 @@ </summary> </histogram> -<histogram name="Arc.PlayStoreSearch.ReturnedAppsTotal" units="apps"> +<histogram name="Arc.PlayStoreSearch.ReturnedAppsTotal" units="apps" + expires_after="2020-01-26"> <owner>hejq@chromium.org</owner> <summary> The total number of returned apps of a Play Store app discovery query. @@ -6062,7 +6071,8 @@ </summary> </histogram> -<histogram name="Arc.Reauthorization.Result" enum="ArcProvisioningResult"> +<histogram name="Arc.Reauthorization.Result" enum="ArcProvisioningResult" + expires_after="2020-01-26"> <!-- Name completed by histogram_suffixes name="ArcUserTypes" --> <owner>khmel@google.com</owner> @@ -6135,7 +6145,7 @@ </summary> </histogram> -<histogram name="Arc.State" enum="BooleanEnabled"> +<histogram name="Arc.State" enum="BooleanEnabled" expires_after="2020-01-26"> <owner>elijahtaylor@google.com</owner> <owner>shihuis@google.com</owner> <summary> @@ -6196,7 +6206,8 @@ </summary> </histogram> -<histogram name="Arc.UserInteraction" enum="ArcUserInteraction"> +<histogram name="Arc.UserInteraction" enum="ArcUserInteraction" + expires_after="2020-01-26"> <owner>jhorwich@chromium.org</owner> <owner>elijahtaylor@chromium.org</owner> <owner>shihuis@google.com</owner> @@ -6876,7 +6887,8 @@ </summary> </histogram> -<histogram name="Ash.Shelf.Menu.NumItemsEnabledUponSelection" units="Count"> +<histogram name="Ash.Shelf.Menu.NumItemsEnabledUponSelection" units="Count" + expires_after="2020-01-26"> <owner>bruthig@google.com</owner> <owner>tdanderson@google.com</owner> <summary> @@ -6904,7 +6916,8 @@ </summary> </histogram> -<histogram name="Ash.Shelf.NumberOfPinnedItems" units="Icons"> +<histogram name="Ash.Shelf.NumberOfPinnedItems" units="Icons" + expires_after="2020-01-26"> <owner>bruthig@google.com</owner> <owner>tdanderson@google.com</owner> <summary> @@ -7133,7 +7146,7 @@ </histogram> <histogram name="Ash.SwipeDownDrag.Tab.PresentationTime.MaxLatency.TabletMode" - units="ms"> + units="ms" expires_after="2020-01-26"> <owner>omrilio@chromium.org</owner> <summary> Maximum latency of the presentation timestamp while dragging a tab in tablet @@ -7141,14 +7154,15 @@ </summary> </histogram> -<histogram name="Ash.SwipeDownDrag.Tab.PresentationTime.TabletMode" units="ms"> +<histogram name="Ash.SwipeDownDrag.Tab.PresentationTime.TabletMode" units="ms" + expires_after="2020-01-26"> <owner>omrilio@chromium.org</owner> <summary>Presentation time while dragging a tab in tablet mode.</summary> </histogram> <histogram name="Ash.SwipeDownDrag.Window.PresentationTime.MaxLatency.TabletMode" - units="ms"> + units="ms" expires_after="2020-01-26"> <owner>omrilio@chromium.org</owner> <summary> Maximum latency of the presentation timestamp while dragging maximized @@ -7205,7 +7219,8 @@ </summary> </histogram> -<histogram name="Ash.TabletMode.AnimationSmoothness.Enter" units="%"> +<histogram name="Ash.TabletMode.AnimationSmoothness.Enter" units="%" + expires_after="2020-01-26"> <owner>oshima@chromium.org</owner> <owner>sammiequon@chromium.org</owner> <summary> @@ -7215,7 +7230,8 @@ </summary> </histogram> -<histogram name="Ash.TabletMode.AnimationSmoothness.Exit" units="%"> +<histogram name="Ash.TabletMode.AnimationSmoothness.Exit" units="%" + expires_after="2020-01-26"> <owner>oshima@chromium.org</owner> <owner>sammiequon@chromium.org</owner> <summary> @@ -7345,7 +7361,8 @@ </summary> </histogram> -<histogram name="Ash.TouchView.TouchViewActive" units="ms"> +<histogram name="Ash.TouchView.TouchViewActive" units="ms" + expires_after="2020-01-26"> <owner>girard@chromium.org</owner> <summary> The length of time that TouchView is active, for each activation. @@ -7642,7 +7659,7 @@ </summary> </histogram> -<histogram name="Ash.WindowSelector.Items"> +<histogram name="Ash.WindowSelector.Items" expires_after="2020-01-26"> <owner>flackr@chromium.org</owner> <owner>kuscher@google.com</owner> <summary> @@ -7670,7 +7687,8 @@ </summary> </histogram> -<histogram name="Ash.WindowSelector.OverviewClosedItems"> +<histogram name="Ash.WindowSelector.OverviewClosedItems" + expires_after="2020-01-26"> <owner>flackr@chromium.org</owner> <summary> The number of items closed from the window overview for a single session. @@ -7780,7 +7798,7 @@ </histogram> <histogram name="Assistant.EntryPoint" enum="AssistantEntryPoint" - expires_after="2019-11-01"> + expires_after="2020-01-26"> <owner>xiaohuic@chromium.org</owner> <owner>meilinw@chromium.org</owner> <summary> @@ -13455,7 +13473,8 @@ <summary>Gamma properties of image color space.</summary> </histogram> -<histogram base="true" name="Blink.Compositing.LayerPromotionCount"> +<histogram base="true" name="Blink.Compositing.LayerPromotionCount" + expires_after="2020-01-26"> <owner>paint-dev@chromium.org</owner> <summary> Number of composited layers based on various reasons. Recorded when a page @@ -13589,7 +13608,7 @@ </histogram> <histogram name="Blink.DecodedImage.JpegDensity.400px" - units="0.01 bits per pixel"> + units="0.01 bits per pixel" expires_after="2020-01-26"> <owner>deymo@google.com</owner> <owner>compression-dev@google.com</owner> <summary> @@ -13645,7 +13664,8 @@ </summary> </histogram> -<histogram name="Blink.DecodedImageType" enum="DecodedImageType"> +<histogram name="Blink.DecodedImageType" enum="DecodedImageType" + expires_after="2020-01-26"> <owner>urvang@chromium.org</owner> <summary>Image codec inferred during decode.</summary> </histogram> @@ -13929,7 +13949,7 @@ </histogram> <histogram name="Blink.LazyLoad.CrossOriginFrames.InitialDeferralAction" - enum="LazyLoad.FrameInitialDeferralAction"> + enum="LazyLoad.FrameInitialDeferralAction" expires_after="2020-01-26"> <owner>sclittle@chromium.org</owner> <summary> Records the initial lazy loading action taken for a cross-origin iframe. @@ -14320,7 +14340,7 @@ </histogram> <histogram name="Blink.ResourceFetcher.StaleWhileRevalidate" - enum="BooleanAttempted" expires_after="M77"> + enum="BooleanAttempted" expires_after="2020-01-26"> <owner>dtapuska@chromium.org</owner> <owner>kenjibaheux@google.com</owner> <summary>Count of resources attempted Stale Revalidation.</summary> @@ -15245,7 +15265,7 @@ <summary>Duration of time taken to run ThreadState::completeSweep().</summary> </histogram> -<histogram name="BlinkGC.GCReason" enum="GCReason"> +<histogram name="BlinkGC.GCReason" enum="GCReason" expires_after="2020-01-26"> <owner>haraken@chromium.org</owner> <summary>A type of Blink GC.</summary> </histogram> @@ -16421,7 +16441,8 @@ </summary> </histogram> -<histogram name="BlueZ.ResultOfPairing" enum="BlueZResultOfPairing"> +<histogram name="BlueZ.ResultOfPairing" enum="BlueZResultOfPairing" + expires_after="2020-01-26"> <owner>mcchou@chromium.org</owner> <summary> This is specific to Chrome OS. Records the outcomes of pairing with remote @@ -16617,7 +16638,7 @@ <summary>How users add a new bookmark.</summary> </histogram> -<histogram name="Bookmarks.FileSize" units="KB"> +<histogram name="Bookmarks.FileSize" units="KB" expires_after="2020-01-26"> <owner>mamir@chromium.org</owner> <summary> The size of the file used to persist bookmarks. It's recorded every time the @@ -16638,7 +16659,8 @@ </summary> </histogram> -<histogram name="Bookmarks.LaunchLocation" enum="BookmarkLaunchLocation"> +<histogram name="Bookmarks.LaunchLocation" enum="BookmarkLaunchLocation" + expires_after="2020-01-26"> <owner>ianwen@chromium.org</owner> <summary>Logs a UI location from which a bookmark is launched.</summary> </histogram> @@ -16669,7 +16691,8 @@ </summary> </histogram> -<histogram name="Bookmarks.OpenBookmarkType" enum="BookmarkType"> +<histogram name="Bookmarks.OpenBookmarkType" enum="BookmarkType" + expires_after="2020-01-26"> <owner>wychen@chromium.org</owner> <summary> Logs whether the bookmark entry is a user bookmark or a partner bookmark @@ -16780,7 +16803,7 @@ </histogram> <histogram name="Browser.Tabs.SelectionToVisibilityRequestTime" - units="microseconds"> + units="microseconds" expires_after="2020-01-26"> <owner>sadrul@chromium.org</owner> <owner>sky@chromium.org</owner> <summary> @@ -16866,7 +16889,7 @@ </histogram> <histogram name="BrowserDialogs.ExternalProtocol.HandleState" - enum="HandleStateType"> + enum="HandleStateType" expires_after="2020-01-26"> <owner>dominickn@chromium.org</owner> <owner>meacer@chromium.org</owner> <summary> @@ -17012,7 +17035,8 @@ </summary> </histogram> -<histogram name="BrowserRenderProcessHost.OnChannelError" enum="BooleanHit"> +<histogram name="BrowserRenderProcessHost.OnChannelError" enum="BooleanHit" + expires_after="2020-01-26"> <owner>wfh@chromium.org</owner> <summary> Number of times BrowserRenderProcessHost::OnChannelError was called. @@ -18114,7 +18138,7 @@ </histogram> <histogram name="ChildProcess.Crashed.UtilityProcessHash" - enum="UtilityProcessNameHash"> + enum="UtilityProcessNameHash" expires_after="2020-01-26"> <owner>wfh@chromium.org</owner> <summary> Count of child utility process crashes, bucketed by the hash of their @@ -18829,7 +18853,7 @@ </histogram> <histogram name="ChromeOS.Apps.IntentPickerAction" - enum="ArcIntentHandlerAction"> + enum="ArcIntentHandlerAction" expires_after="2020-01-26"> <owner>elijahtaylor@google.com</owner> <owner>dominickn@chromium.org</owner> <owner>shihuis@google.com</owner> @@ -18946,7 +18970,7 @@ </histogram> <histogram name="ChromeOS.CWP.CollectPerf" - enum="ChromeOSProfileCollectionStatus"> + enum="ChromeOSProfileCollectionStatus" expires_after="2020-01-26"> <owner>aalexand@google.com</owner> <owner>gmx@chromium.org</owner> <summary> @@ -19075,7 +19099,8 @@ </summary> </histogram> -<histogram name="ChromeOS.MemoryPressureLevel" enum="MemoryPressureLevel"> +<histogram name="ChromeOS.MemoryPressureLevel" enum="MemoryPressureLevel" + expires_after="2020-01-26"> <owner>xdai@chromium.org</owner> <summary> The memory pressure level in Chrome OS, which is recorded periodically (once @@ -20227,7 +20252,7 @@ </histogram> <histogram name="Compositing.DirectRenderer.GL.DrawFrameUs" - units="microseconds"> + units="microseconds" expires_after="2020-01-26"> <owner>weiliangc@chromium.org</owner> <summary> Time spent drawing of composited layers by GLRenderer, in microseconds. This @@ -21352,7 +21377,8 @@ <summary>The default autoplay setting at profile open.</summary> </histogram> -<histogram name="ContentSettings.DefaultCookiesSetting" enum="ContentSetting"> +<histogram name="ContentSettings.DefaultCookiesSetting" enum="ContentSetting" + expires_after="2020-01-26"> <owner>toyoshim@chromium.org</owner> <summary>The default cookies setting at profile open.</summary> </histogram> @@ -21436,7 +21462,7 @@ </histogram> <histogram name="ContentSettings.DefaultNotificationsSetting" - enum="ContentSetting"> + enum="ContentSetting" expires_after="2020-01-26"> <owner>toyoshim@chromium.org</owner> <summary>The default notification setting at profile open.</summary> </histogram> @@ -22223,7 +22249,7 @@ </histogram> <histogram name="ContentSuggestions.Feed.PagePopulatingTime" units="ms" - expires_after="2019-12-01"> + expires_after="2020-01-26"> <owner>gangwu@chromium.org</owner> <owner>fgorski@chromium.org</owner> <summary> @@ -22687,7 +22713,8 @@ </summary> </histogram> -<histogram name="ContextMenu.Shown" enum="BooleanPresent"> +<histogram name="ContextMenu.Shown" enum="BooleanPresent" + expires_after="2020-01-26"> <owner>mpearson@chromium.org</owner> <summary> Recorded when a context menu is shown, sliced by whether a web contents was @@ -22990,7 +23017,8 @@ <summary>Intervals between access time updates for each cookie.</summary> </histogram> -<histogram name="Cookie.CommitProblem" enum="CookieCommitProblem"> +<histogram name="Cookie.CommitProblem" enum="CookieCommitProblem" + expires_after="2020-01-26"> <owner>morlovich@chromium.org</owner> <summary> Recorded when a problem occurs trying to commit changes to the cookie store @@ -23056,7 +23084,7 @@ </summary> </histogram> -<histogram name="Cookie.CorruptMetaTable"> +<histogram name="Cookie.CorruptMetaTable" expires_after="2020-01-26"> <owner>tnagel@chromium.org</owner> <summary> Records the detection of a corrupted meta table. See http://crbug.com/111376 @@ -23173,7 +23201,8 @@ </summary> </histogram> -<histogram name="Cookie.LoadProblem" enum="CookieLoadProblem"> +<histogram name="Cookie.LoadProblem" enum="CookieLoadProblem" + expires_after="2020-01-26"> <owner>morlovich@chromium.org</owner> <summary> Recorded when a problem is recorded when loading the persistent cookie @@ -23969,7 +23998,7 @@ </summary> </histogram> -<histogram name="Cras.StreamFlags" units="value"> +<histogram name="Cras.StreamFlags" units="value" expires_after="2020-01-26"> <owner>yuhsuan@chromium.org</owner> <owner>chromeos-audio@google.com</owner> <summary> @@ -24007,7 +24036,8 @@ </summary> </histogram> -<histogram name="Cras.UnderrunsPerDevice" units="count"> +<histogram name="Cras.UnderrunsPerDevice" units="count" + expires_after="2020-01-26"> <owner>yuhsuan@chromium.org</owner> <owner>chromeos-audio@google.com</owner> <summary> @@ -24028,7 +24058,8 @@ </summary> </histogram> -<histogram name="CrashExitCodes.Renderer" enum="CrashExitCodes"> +<histogram name="CrashExitCodes.Renderer" enum="CrashExitCodes" + expires_after="2020-01-26"> <owner>wfh@chromium.org</owner> <summary> The exit codes for crashed renderer processes. Note: Due to @@ -24892,7 +24923,8 @@ </summary> </histogram> -<histogram name="Cryptohome.HomedirEncryptionType" enum="HomedirEncryptionType"> +<histogram name="Cryptohome.HomedirEncryptionType" enum="HomedirEncryptionType" + expires_after="2020-01-26"> <owner>dspaid@chromium.org</owner> <summary> The encryption type used for a user's cryptohome directory. This is logged @@ -25076,7 +25108,8 @@ </summary> </histogram> -<histogram name="Cryptohome.TpmResults" enum="CryptohomeTpmResults"> +<histogram name="Cryptohome.TpmResults" enum="CryptohomeTpmResults" + expires_after="2020-01-26"> <owner>afakhry@chromium.org</owner> <summary> The errors resulting from interacting with the Trusted Platform Module (TPM) @@ -25093,7 +25126,8 @@ </summary> </histogram> -<histogram base="true" name="CustomTab.SessionDuration" units="ms"> +<histogram base="true" name="CustomTab.SessionDuration" units="ms" + expires_after="2020-01-26"> <owner>ranj@chromium.org</owner> <owner>yfriedman@chromium.org</owner> <!-- Name completed by histogram_suffixes name="CustomTabOpenSource" --> @@ -25159,7 +25193,7 @@ </histogram> <histogram base="true" name="CustomTabs.DetachedResourceRequest.RedirectsCount" - units="redirects"> + units="redirects" expires_after="2020-01-26"> <owner>lizeb@chromium.org</owner> <summary> Number of redirects followed by a detached resource request until success or @@ -25168,7 +25202,7 @@ </histogram> <histogram name="CustomTabs.DynamicModule.CreateActivityDelegateTime" - units="ms" expires_after="2019-11-01"> + units="ms" expires_after="2020-01-26"> <owner>mvanouwerkerk@chromium.org</owner> <summary> Time to create an activity delegate for a custom tabs dynamic module. @@ -25177,7 +25211,7 @@ </histogram> <histogram name="CustomTabs.DynamicModule.CreatePackageContextTime" units="ms" - expires_after="2019-11-01"> + expires_after="2020-01-26"> <owner>mvanouwerkerk@chromium.org</owner> <summary> Time to create the package context for a custom tabs dynamic module. Android @@ -25186,7 +25220,7 @@ </histogram> <histogram name="CustomTabs.DynamicModule.DestructionReason" - enum="CustomTabsDynamicModuleDestructionReason" expires_after="2019-11-01"> + enum="CustomTabsDynamicModuleDestructionReason" expires_after="2020-01-26"> <owner>mvanouwerkerk@chromium.org</owner> <summary> Possible reasons for destroying a custom tabs dynamic module. Android only. @@ -25204,7 +25238,7 @@ </histogram> <histogram name="CustomTabs.DynamicModule.EntryPointLoadClassTime" units="ms" - expires_after="2019-11-01"> + expires_after="2020-01-26"> <owner>mvanouwerkerk@chromium.org</owner> <summary> Time to load the entry point class for a custom tabs dynamic module. Android @@ -25213,7 +25247,7 @@ </histogram> <histogram name="CustomTabs.DynamicModule.EntryPointNewInstanceTime" units="ms" - expires_after="2019-11-01"> + expires_after="2020-01-26"> <owner>mvanouwerkerk@chromium.org</owner> <summary> Time to instantiate the entry point class for a custom tabs dynamic module. @@ -25222,7 +25256,7 @@ </histogram> <histogram name="CustomTabs.DynamicModule.LoadResult" - enum="CustomTabsDynamicModuleLoadResult" expires_after="2019-11-01"> + enum="CustomTabsDynamicModuleLoadResult" expires_after="2020-01-26"> <owner>mvanouwerkerk@chromium.org</owner> <summary> Possible results when loading a custom tabs dynamic module. Android only. @@ -25252,7 +25286,7 @@ </histogram> <histogram name="CustomTabs.DynamicModule.ResidentSet.OnModuleDestroy" - units="KB" expires_after="2019-11-01"> + units="KB" expires_after="2020-01-26"> <owner>msalama@google.com</owner> <owner>lizeb@chromium.org</owner> <owner>mvanouwerkerk@chromium.org</owner> @@ -25263,7 +25297,7 @@ </histogram> <histogram name="CustomTabs.DynamicModule.ResidentSet.OnModuleLoad" units="KB" - expires_after="2019-11-01"> + expires_after="2020-01-26"> <owner>msalama@google.com</owner> <owner>lizeb@chromium.org</owner> <owner>mvanouwerkerk@chromium.org</owner> @@ -25351,7 +25385,7 @@ </histogram> <histogram name="CustomTabs.ParallelRequestStatusOnStart" - enum="CustomTabsParallelRequestStatusOnStart"> + enum="CustomTabsParallelRequestStatusOnStart" expires_after="2020-01-26"> <owner>lizeb@chromium.org</owner> <summary> Recorded only on Android. Whether a parallel request was requested by the @@ -25427,7 +25461,7 @@ </histogram> <histogram name="CustomTabs.SpeculationStatusOnStart" - enum="CustomTabsSpeculationStatusOnStart"> + enum="CustomTabsSpeculationStatusOnStart" expires_after="2020-01-26"> <owner>mattcary@chromium.org</owner> <summary> Recorded only for Android. How a speculation was started or why it was @@ -25442,7 +25476,7 @@ </histogram> <histogram name="CustomTabs.SpeculationStatusOnSwap" - enum="CustomTabsSpeculationStatusOnSwap"> + enum="CustomTabsSpeculationStatusOnSwap" expires_after="2020-01-26"> <owner>mattcary@chromium.org</owner> <summary> Recorded only for Android. Recorded when a speculation is requesting to swap @@ -25450,7 +25484,8 @@ </summary> </histogram> -<histogram name="CustomTabs.Visible" enum="VisibleTab" expires_after="M77"> +<histogram name="CustomTabs.Visible" enum="VisibleTab" + expires_after="2020-01-26"> <owner>yusufo@chromium.org</owner> <summary> Recorded only for Android. Records on every metrics upload whether the @@ -31387,7 +31422,8 @@ </summary> </histogram> -<histogram base="true" name="Download.DownloadSize" units="KB"> +<histogram base="true" name="Download.DownloadSize" units="KB" + expires_after="2020-01-26"> <!-- Name completed by histogram_suffixes name="Download.Parallelizable" --> <owner>dtrainor@chromium.org</owner> @@ -31828,7 +31864,7 @@ </histogram> <histogram name="Download.MapErrorNetworkFailed.NetworkService" - enum="NetErrorCodes" expires_after="M78"> + enum="NetErrorCodes" expires_after="2020-01-26"> <owner>dtrainor@chromium.org</owner> <owner>qinmin@chromium.org</owner> <summary> @@ -31993,7 +32029,7 @@ </histogram> <histogram name="Download.ParallelDownload.CreationEvent" - enum="ParallelDownloadCreationEvent"> + enum="ParallelDownloadCreationEvent" expires_after="2020-01-26"> <owner>xingliu@chromium.org</owner> <summary> When parallel downloading feature is enabled, a download may be created as @@ -33293,7 +33329,8 @@ </summary> </histogram> -<histogram name="EasyUnlock.AuthEvent.SignIn" enum="EasyUnlockAuthEvent"> +<histogram name="EasyUnlock.AuthEvent.SignIn" enum="EasyUnlockAuthEvent" + expires_after="2020-01-26"> <owner>hansberry@chromium.org</owner> <summary> Measures the use of Smart Lock on the sign-in screen: records whether a @@ -33312,7 +33349,8 @@ </summary> </histogram> -<histogram name="EasyUnlock.AuthEvent.Unlock" enum="EasyUnlockAuthEvent"> +<histogram name="EasyUnlock.AuthEvent.Unlock" enum="EasyUnlockAuthEvent" + expires_after="2020-01-26"> <owner>hansberry@chromium.org</owner> <summary> Measures the use of Smart Lock on the lock screen: records whether a Smart @@ -35460,7 +35498,7 @@ </summary> </histogram> -<histogram name="Event.HitTest" enum="EventHitTest"> +<histogram name="Event.HitTest" enum="EventHitTest" expires_after="2020-01-26"> <owner>dtapuska@chromium.org</owner> <summary> For each hit test, records whether it was a hit or miss, and why. @@ -35592,7 +35630,8 @@ </summary> </histogram> -<histogram name="Event.Latency.BlockingTime.TouchEndDefaultAllowed" units="ms"> +<histogram name="Event.Latency.BlockingTime.TouchEndDefaultAllowed" units="ms" + expires_after="2020-01-26"> <owner>tdresser@chromium.org</owner> <summary> Time between the renderer main thread receiving a touchend event and acking @@ -35603,7 +35642,7 @@ </histogram> <histogram name="Event.Latency.BlockingTime.TouchEndDefaultPrevented" - units="ms"> + units="ms" expires_after="2020-01-26"> <owner>tdresser@chromium.org</owner> <summary> Time between the renderer main thread receiving a touchend event and acking @@ -35635,7 +35674,7 @@ </histogram> <histogram name="Event.Latency.BlockingTime.TouchStartDefaultAllowed" - units="ms"> + units="ms" expires_after="2020-01-26"> <owner>tdresser@chromium.org</owner> <summary> Time between the renderer main thread receiving a touchstart event and @@ -36326,7 +36365,7 @@ </histogram> <histogram name="Event.Latency.QueueingTime.KeyPressDefaultAllowed" units="ms" - expires_after="M78"> + expires_after="2020-01-26"> <owner>tdresser@chromium.org</owner> <owner>input-dev@chromium.org</owner> <summary> @@ -36350,7 +36389,8 @@ </summary> </histogram> -<histogram name="Event.Latency.QueueingTime.TouchEndDefaultAllowed" units="ms"> +<histogram name="Event.Latency.QueueingTime.TouchEndDefaultAllowed" units="ms" + expires_after="2020-01-26"> <owner>tdresser@chromium.org</owner> <summary> Time between sending a touchend event to the renderer main thread and when @@ -36373,7 +36413,8 @@ </summary> </histogram> -<histogram name="Event.Latency.QueueingTime.TouchMoveDefaultAllowed" units="ms"> +<histogram name="Event.Latency.QueueingTime.TouchMoveDefaultAllowed" units="ms" + expires_after="2020-01-26"> <owner>tdresser@chromium.org</owner> <summary> Time between sending a touchmove event to the renderer main thread and when @@ -36385,7 +36426,7 @@ </histogram> <histogram name="Event.Latency.QueueingTime.TouchMoveDefaultPrevented" - units="ms"> + units="ms" expires_after="2020-01-26"> <owner>tdresser@chromium.org</owner> <summary> Time between sending a touchmove event to the renderer main thread and when @@ -36397,7 +36438,7 @@ </histogram> <histogram name="Event.Latency.QueueingTime.TouchStartDefaultAllowed" - units="ms"> + units="ms" expires_after="2020-01-26"> <owner>tdresser@chromium.org</owner> <summary> Time between sending a touchstart event to the renderer main thread and when @@ -36409,7 +36450,7 @@ </histogram> <histogram name="Event.Latency.QueueingTime.TouchStartDefaultPrevented" - units="ms"> + units="ms" expires_after="2020-01-26"> <owner>tdresser@chromium.org</owner> <summary> Time between sending a touchstart event to the renderer main thread and when @@ -36702,7 +36743,7 @@ <histogram name="Event.Latency.ScrollBegin.Touch.BrowserNotifiedToBeforeGpuSwap2" - units="microseconds"> + units="microseconds" expires_after="2020-01-26"> <owner>tdresser@chromium.org</owner> <summary> Time between the browser receives the notification of the first ScrollUpdate @@ -36941,7 +36982,7 @@ </histogram> <histogram name="Event.Latency.ScrollBegin.Wheel.TimeToHandled2" - units="microseconds"> + units="microseconds" expires_after="2020-01-26"> <owner>tdresser@chromium.org</owner> <summary> Time between initial creation of a wheel event and the first generated @@ -37441,7 +37482,7 @@ </histogram> <histogram name="Event.Latency.ScrollUpdate.Touch.HandledToRendererSwap2" - units="microseconds"> + units="microseconds" expires_after="2020-01-26"> <owner>tdresser@chromium.org</owner> <summary> Time between the ScrollUpdate gesture event with touch source, is handled on @@ -37505,7 +37546,7 @@ </histogram> <histogram name="Event.Latency.ScrollUpdate.Touch.TimeToHandled2" - units="microseconds"> + units="microseconds" expires_after="2020-01-26"> <owner>tdresser@chromium.org</owner> <summary> Time between initial creation of a touch event and the generated @@ -37611,7 +37652,7 @@ <histogram name="Event.Latency.ScrollUpdate.Wheel.BrowserNotifiedToBeforeGpuSwap2" - units="microseconds"> + units="microseconds" expires_after="2020-01-26"> <owner>tdresser@chromium.org</owner> <summary> Time between the browser receives the notification of a ScrollUpdate gesture @@ -38843,7 +38884,8 @@ <summary>Tracks the result of image decoding for the favicons.</summary> </histogram> -<histogram name="ExploreSites.MonthlyHostCount" units="hosts"> +<histogram name="ExploreSites.MonthlyHostCount" units="hosts" + expires_after="2020-01-26"> <owner>dimich@chromium.org</owner> <summary> Number of unique hosts visited by the user during the last 30 days. Reported @@ -44581,7 +44623,7 @@ </histogram> <histogram base="true" name="FileBrowser.CrostiniSharedPaths.Depth" - units="depth" expires_after="2019-10-01"> + units="depth" expires_after="2020-01-26"> <owner>joelhockey@chromium.org</owner> <owner>tbuckley@chromium.org</owner> <summary> @@ -47386,7 +47428,7 @@ </histogram> <histogram name="GPU.BlacklistFeatureTestResults" - enum="GPUBlacklistFeatureTestResults"> + enum="GPUBlacklistFeatureTestResults" expires_after="2020-01-26"> <owner>vmiura@chromium.org</owner> <summary> Counts number of browser invocations for which a GPU feature is @@ -48273,7 +48315,7 @@ </histogram> <histogram name="GPU.OopRaster.GlyphCacheMiss" - enum="OopRasterGlyphCacheMissType"> + enum="OopRasterGlyphCacheMissType" expires_after="2020-01-26"> <owner>khushalsagar@chromium.org</owner> <summary> During OutOfProcess(Oop) raster, the renderer generates and sends the @@ -48858,7 +48900,8 @@ </summary> </histogram> -<histogram name="Graphics.Smoothness.FrameSequenceLength" units="count"> +<histogram name="Graphics.Smoothness.FrameSequenceLength" units="count" + expires_after="2020-01-26"> <owner>sadrul@chromium.org</owner> <owner>graphics-dev@chromium.org</owner> <summary> @@ -49373,7 +49416,8 @@ </summary> </histogram> -<histogram name="History.ClearBrowsingData.Duration.FullDeletion" units="ms"> +<histogram name="History.ClearBrowsingData.Duration.FullDeletion" units="ms" + expires_after="2020-01-26"> <owner>dullweber@chromium.org</owner> <owner>msramek@chromium.org</owner> <summary> @@ -49381,7 +49425,8 @@ </summary> </histogram> -<histogram name="History.ClearBrowsingData.Duration.PartialDeletion" units="ms"> +<histogram name="History.ClearBrowsingData.Duration.PartialDeletion" units="ms" + expires_after="2020-01-26"> <owner>dullweber@chromium.org</owner> <owner>msramek@chromium.org</owner> <summary> @@ -49402,7 +49447,7 @@ </histogram> <histogram name="History.ClearBrowsingData.Duration.SlowTasks180sChrome" - enum="ChromeBrowsingDataRemoverTasks"> + enum="ChromeBrowsingDataRemoverTasks" expires_after="2020-01-26"> <owner>dullweber@chromium.org</owner> <owner>msramek@chromium.org</owner> <summary> @@ -49530,7 +49575,7 @@ </histogram> <histogram name="History.ClearBrowsingData.UserDeletedFromTab" - enum="ClearBrowsingDataTab"> + enum="ClearBrowsingDataTab" expires_after="2020-01-26"> <owner>dullweber@chromium.org</owner> <owner>msramek@chromium.org</owner> <summary> @@ -50433,7 +50478,8 @@ </summary> </histogram> -<histogram name="HttpCache.Pattern" enum="HttpCachePattern"> +<histogram name="HttpCache.Pattern" enum="HttpCachePattern" + expires_after="2020-01-26"> <owner>morlovich@chromium.org</owner> <owner>jkarlin@chromium.org</owner> <summary>For each http cache transaction, the recorded pattern.</summary> @@ -53631,12 +53677,12 @@ </histogram> <histogram name="IOS.PageLoadCount.Counts" - enum="IOSPageLoadCountNavigationType"> + enum="IOSPageLoadCountNavigationType" expires_after="2020-01-26"> <owner>danyao@chromium.org</owner> <summary>The number of navigation started events by navigation type.</summary> </histogram> -<histogram name="IOS.PageLoadCount.LoadingStarted"> +<histogram name="IOS.PageLoadCount.LoadingStarted" expires_after="2020-01-26"> <owner>danyao@chromium.org</owner> <summary> The "true" value of this boolean histogram counts the number of @@ -54332,7 +54378,8 @@ </summary> </histogram> -<histogram name="Keyboard.ShortcutViewer.StartupTime" units="ms"> +<histogram name="Keyboard.ShortcutViewer.StartupTime" units="ms" + expires_after="2020-01-26"> <owner>jamescook@chromium.org</owner> <owner>msw@chromium.org</owner> <owner>wutao@chromium.org</owner> @@ -54344,7 +54391,7 @@ </histogram> <histogram name="KeyboardAccessory.AccessoryActionImpression" - enum="AccessoryAction"> + enum="AccessoryAction" expires_after="2020-01-26"> <owner>fhorschig@chromium.org</owner> <summary> Android only. Records whenever users faces an action in the accessory bar or @@ -54353,7 +54400,7 @@ </histogram> <histogram name="KeyboardAccessory.AccessoryActionSelected" - enum="AccessoryAction"> + enum="AccessoryAction" expires_after="2020-01-26"> <owner>fhorschig@chromium.org</owner> <summary> Android only. Records whenever users select an action in the accessory bar @@ -54548,7 +54595,8 @@ </summary> </histogram> -<histogram name="Launch.HomeScreen" enum="LaunchFromHomeScreen"> +<histogram name="Launch.HomeScreen" enum="LaunchFromHomeScreen" + expires_after="2020-01-26"> <owner>dfalcantara@chromium.org</owner> <summary> Records how Chrome handled a launch from an Android Home screen shortcut. @@ -55129,7 +55177,8 @@ </summary> </histogram> -<histogram name="LoadingPredictor.PreconnectCount" units="origins"> +<histogram name="LoadingPredictor.PreconnectCount" units="origins" + expires_after="2020-01-26"> <owner>alexilin@chromium.org</owner> <summary> The number of origins that were preconnected for a page load. It includes @@ -55138,7 +55187,8 @@ </summary> </histogram> -<histogram name="LoadingPredictor.PreconnectHitsPercentage" units="%"> +<histogram name="LoadingPredictor.PreconnectHitsPercentage" units="%" + expires_after="2020-01-26"> <owner>alexilin@chromium.org</owner> <summary> The percentage of origins that were preconnected and requested by a page @@ -55148,7 +55198,8 @@ </summary> </histogram> -<histogram name="LoadingPredictor.PreconnectLearningCount" units="origins"> +<histogram name="LoadingPredictor.PreconnectLearningCount" units="origins" + expires_after="2020-01-26"> <owner>alexilin@chromium.org</owner> <summary> When the loading predictor has origins in the local database for a given @@ -55156,7 +55207,8 @@ </summary> </histogram> -<histogram name="LoadingPredictor.PreconnectLearningPrecision" units="%"> +<histogram name="LoadingPredictor.PreconnectLearningPrecision" units="%" + expires_after="2020-01-26"> <owner>alexilin@chromium.org</owner> <summary> When the loading predictor has origins in the local database for a given @@ -55186,7 +55238,8 @@ </summary> </histogram> -<histogram name="LoadingPredictor.PreresolveCount" units="hosts"> +<histogram name="LoadingPredictor.PreresolveCount" units="hosts" + expires_after="2020-01-26"> <owner>alexilin@chromium.org</owner> <summary> The number of hosts that were preresolved for a page load. It includes only @@ -55559,7 +55612,8 @@ <summary>The user's default page zoom setting, recorded on login.</summary> </histogram> -<histogram name="Login.FailureReason" enum="LoginFailureReason"> +<histogram name="Login.FailureReason" enum="LoginFailureReason" + expires_after="2020-01-26"> <owner>achuith@chromium.org</owner> <summary>Chrome OS login failure reason.</summary> </histogram> @@ -55656,7 +55710,8 @@ <summary>Result of a state key generation operation.</summary> </histogram> -<histogram name="Login.SuccessReason" enum="LoginSuccessReason"> +<histogram name="Login.SuccessReason" enum="LoginSuccessReason" + expires_after="2020-01-26"> <owner>achuith@chromium.org</owner> <summary>Chrome OS login success reason.</summary> </histogram> @@ -55696,7 +55751,8 @@ </summary> </histogram> -<histogram name="Login.UserType" enum="LoginUserType"> +<histogram name="Login.UserType" enum="LoginUserType" + expires_after="2020-01-26"> <owner>cmasone@chromium.org</owner> <summary> Chrome OS histogram that keeps track of the way a user logs in and whether @@ -65694,6 +65750,17 @@ </summary> </histogram> +<histogram name="MobileDownload.Background.TargetDeterminationResult" + enum="MobileDownloadBackgroundTargetDeterminationResult" + expires_after="2020-03-30"> + <owner>qinmin@chromium.org</owner> + <owner>xingliu@chromium.org</owner> + <summary> + Android: Records the target determination result for downloads started in + the background, that is, while the browser process is not running. + </summary> +</histogram> + <histogram name="MobileDownload.BytesDownloaded" units="KB"> <owner>qinmin@chromium.org</owner> <summary> @@ -66689,7 +66756,8 @@ </summary> </histogram> -<histogram name="MPArch.ChildProcessLaunchSubsequent"> +<histogram name="MPArch.ChildProcessLaunchSubsequent" + expires_after="2020-01-26"> <owner>ppi@chromium.org</owner> <summary> The time it takes to spawn child sub processes not counting the first one. @@ -66970,7 +67038,7 @@ <histogram name="MultiDevice.SecureChannel.BLE.Performance.ReceiveAdvertisementToConnectionDuration.Background" - units="ms"> + units="ms" expires_after="2020-01-26"> <owner>hansberry@chromium.org</owner> <owner>khorimoto@chromium.org</owner> <summary> @@ -66986,7 +67054,7 @@ <histogram name="MultiDevice.SecureChannel.BLE.Performance.StartScanToAuthenticationDuration.Background" - units="ms"> + units="ms" expires_after="2020-01-26"> <owner>hansberry@chromium.org</owner> <owner>khorimoto@chromium.org</owner> <summary> @@ -67035,7 +67103,7 @@ <histogram name="MultiDevice.SecureChannel.BLE.ReceiveAdvertisementToAuthentication.EffectiveSuccessRateWithRetries" - enum="BooleanSuccess"> + enum="BooleanSuccess" expires_after="2020-01-26"> <owner>hansberry@chromium.org</owner> <owner>khorimoto@chromium.org</owner> <summary> @@ -67047,7 +67115,7 @@ <histogram name="MultiDevice.SecureChannel.BLE.ReceiveAdvertisementToGattConnection.EffectiveSuccessRateWithRetries" - enum="BooleanSuccess"> + enum="BooleanSuccess" expires_after="2020-01-26"> <owner>hansberry@chromium.org</owner> <owner>khorimoto@chromium.org</owner> <summary> @@ -67078,7 +67146,7 @@ </histogram> <histogram name="MultiDeviceSetup.OOBE.UserChoice" - enum="MultiDeviceSetupOOBEUserChoice"> + enum="MultiDeviceSetupOOBEUserChoice" expires_after="2020-01-26"> <owner>hansberry@chromium.org</owner> <owner>khorimoto@chromium.org</owner> <owner>hsuregan@chromium.org</owner> @@ -85942,7 +86010,7 @@ </histogram> <histogram name="NQE.CellularSignalStrength.AtECTComputation" - units="Signal Strength Level" expires_after="2019-12-01"> + units="Signal Strength Level" expires_after="2020-01-26"> <owner>tbansal@chromium.org</owner> <summary> Cellular signal strength level reported by the device at the time of ECT @@ -85952,7 +86020,7 @@ </histogram> <histogram name="NQE.CellularSignalStrength.ECTReduction" - units="ECT level reduction" expires_after="2019-12-01"> + units="ECT level reduction" expires_after="2020-01-26"> <owner>tbansal@chromium.org</owner> <summary> Number of buckets by which effective connection type was reduced or capped @@ -85962,7 +86030,7 @@ </histogram> <histogram name="NQE.CellularSignalStrength.LevelAvailable" - enum="BooleanAvailable"> + enum="BooleanAvailable" expires_after="2020-01-26"> <owner>tbansal@chromium.org</owner> <owner>bengr@chromium.org</owner> <summary> @@ -85973,7 +86041,7 @@ </histogram> <histogram name="NQE.CellularSignalStrength.LevelDifference" - units="Signal Strength Level"> + units="Signal Strength Level" expires_after="2020-01-26"> <owner>tbansal@chromium.org</owner> <owner>bengr@chromium.org</owner> <summary> @@ -86098,7 +86166,7 @@ </histogram> <histogram name="NQE.EffectiveConnectionType.OnECTComputation" - enum="NQEEffectiveConnectionType"> + enum="NQEEffectiveConnectionType" expires_after="2020-01-26"> <owner>tbansal@chromium.org</owner> <owner>bengr@chromium.org</owner> <summary> @@ -90486,6 +90554,16 @@ </summary> </histogram> +<histogram name="OptimizationGuide.HintsFetcher.GetHintsRequest.HintCount" + expires_after="M82"> + <owner>mcrouse@chromium.org</owner> + <owner>sophiechang@chromium.org</owner> + <summary> + Records the number of hints received from the remote Optimization Guide + Service for every successful HintsFetch request. + </summary> +</histogram> + <histogram name="OptimizationGuide.HintsFetcher.GetHintsRequest.HostCount" units="total host count" expires_after="M80"> <owner>mcrouse@chromium.org</owner> @@ -98371,7 +98449,7 @@ </summary> </histogram> -<histogram name="PDF.HasAttachment" enum="Boolean"> +<histogram name="PDF.HasAttachment" enum="Boolean" expires_after="2020-01-26"> <owner>hnakashima@chromium.org</owner> <summary> Measures if PDFs opened in the PDF viewer have attachments. This is logged @@ -98390,7 +98468,7 @@ </summary> </histogram> -<histogram name="PDF.IsLinearized" enum="Boolean" expires_after="M77"> +<histogram name="PDF.IsLinearized" enum="Boolean" expires_after="2020-01-26"> <obsolete> Removed in July 2019. </obsolete> @@ -98401,7 +98479,8 @@ </summary> </histogram> -<histogram name="PDF.IsTagged" enum="BooleanIsTagged"> +<histogram name="PDF.IsTagged" enum="BooleanIsTagged" + expires_after="2020-01-26"> <owner>hnakashima@chromium.org</owner> <summary> Tracks documents opened in the PDF viewer that are Tagged PDFs. @@ -103090,7 +103169,8 @@ </histogram> <histogram name="Plugin.PowerSaver.PeripheralHeuristicInitialDecision" - enum="PluginPowerSaverPeripheralHeuristicDecision" expires_after="M77"> + enum="PluginPowerSaverPeripheralHeuristicDecision" + expires_after="2020-01-26"> <owner>tommycli@chromium.org</owner> <summary> Records the initial decision of the Plugin Power Saver peripheral content @@ -103100,7 +103180,7 @@ </histogram> <histogram name="Plugin.PowerSaver.PosterParamPresence" - enum="PluginPowerSaverPosterParamPresence" expires_after="M77"> + enum="PluginPowerSaverPosterParamPresence" expires_after="2020-01-26"> <owner>tommycli@chromium.org</owner> <summary> Record how many plugin object tags use poster param. This is recorded once @@ -103109,7 +103189,7 @@ </histogram> <histogram name="Plugin.PowerSaver.Unthrottle" - enum="PluginPowerSaverUnthrottleMethod"> + enum="PluginPowerSaverUnthrottleMethod" expires_after="2020-01-26"> <owner>tommycli@chromium.org</owner> <summary> Record how many throttled plugins are unthrottled, and by what method. @@ -103359,7 +103439,8 @@ </summary> </histogram> -<histogram name="Power.BatteryInfoSample" enum="BatteryInfoSampleResult"> +<histogram name="Power.BatteryInfoSample" enum="BatteryInfoSampleResult" + expires_after="2020-01-26"> <owner>tbroch@chromium.org</owner> <summary> Counts the number of times we have read the battery status from sysfs and if @@ -103399,7 +103480,8 @@ </summary> </histogram> -<histogram name="Power.BatteryRemainingAtStartOfSessionOnAC" units="%"> +<histogram name="Power.BatteryRemainingAtStartOfSessionOnAC" units="%" + expires_after="2020-01-26"> <owner>tbroch@chromium.org</owner> <summary> Chrome OS remaining battery charge as percent of the maximum battery charge, @@ -103533,7 +103615,8 @@ </summary> </histogram> -<histogram name="Power.DarkResumeWakeDurationMs.Other" units="ms"> +<histogram name="Power.DarkResumeWakeDurationMs.Other" units="ms" + expires_after="2020-01-26"> <owner>chirantan@chromium.org</owner> <owner>abhishekbh@chromium.org</owner> <owner>ravisadineni@chromium.org</owner> @@ -103573,7 +103656,7 @@ </summary> </histogram> -<histogram name="Power.DarkResumeWakeupsPerHour"> +<histogram name="Power.DarkResumeWakeupsPerHour" expires_after="2020-01-26"> <owner>chirantan@chromium.org</owner> <summary> The number of times a system woke up in dark resume in an hour. Note that @@ -103624,7 +103707,8 @@ </summary> </histogram> -<histogram name="Power.FirmwareResumeTimeOnAC" units="ms"> +<histogram name="Power.FirmwareResumeTimeOnAC" units="ms" + expires_after="2020-01-26"> <owner>tbroch@chromium.org</owner> <summary> The time that the firmware took to resume the Chrome OS device from @@ -103734,7 +103818,7 @@ </summary> </histogram> -<histogram name="Power.IdleTimeOnBattery" units="ms"> +<histogram name="Power.IdleTimeOnBattery" units="ms" expires_after="2020-01-26"> <owner>tbroch@chromium.org</owner> <owner>jiameng@chromium.org</owner> <summary> @@ -103743,7 +103827,8 @@ </summary> </histogram> -<histogram name="Power.KernelResumeTimeOnAC" units="ms"> +<histogram name="Power.KernelResumeTimeOnAC" units="ms" + expires_after="2020-01-26"> <owner>tbroch@chromium.org</owner> <summary> The time that the kernel took to resume the Chrome OS device from @@ -103759,7 +103844,8 @@ </summary> </histogram> -<histogram name="Power.KernelSuspendTimeOnAC" units="ms"> +<histogram name="Power.KernelSuspendTimeOnAC" units="ms" + expires_after="2020-01-26"> <owner>tbroch@chromium.org</owner> <summary> The time that the kernel took to suspend-to-RAM the Chrome OS device when @@ -103784,7 +103870,8 @@ </summary> </histogram> -<histogram name="Power.LengthOfSession" units="seconds"> +<histogram name="Power.LengthOfSession" units="seconds" + expires_after="2020-01-26"> <owner>tbroch@chromium.org</owner> <summary> The length of time, in seconds, that a user spent in a single session. @@ -103816,7 +103903,8 @@ </summary> </histogram> -<histogram name="Power.Mac.AppleSMCOpened" enum="BooleanSuccess"> +<histogram name="Power.Mac.AppleSMCOpened" enum="BooleanSuccess" + expires_after="2020-01-26"> <owner>sdy@chromium.org</owner> <summary> When metrics collection started, records true if a handle to the System @@ -103929,7 +104017,7 @@ </summary> </histogram> -<histogram name="Power.NumberOfSessionsPerCharge"> +<histogram name="Power.NumberOfSessionsPerCharge" expires_after="2020-01-26"> <owner>tbroch@chromium.org</owner> <summary> The number of user sessions that occured since the last time that the device @@ -103963,7 +104051,7 @@ </histogram> <histogram name="Power.PowerButtonPressInLaptopMode" - enum="PowerButtonPressType"> + enum="PowerButtonPressType" expires_after="2020-01-26"> <owner>minch@chromium.org</owner> <summary> Press power button in laptop mode will result in different scenarios @@ -103973,7 +104061,7 @@ </histogram> <histogram name="Power.PowerButtonPressInTabletMode" - enum="PowerButtonPressType"> + enum="PowerButtonPressType" expires_after="2020-01-26"> <owner>minch@chromium.org</owner> <summary> Press power button in tablet mode will result in different scenarios @@ -104003,7 +104091,8 @@ </summary> </histogram> -<histogram name="Power.PowerSupplyType" enum="PowerSupplyType"> +<histogram name="Power.PowerSupplyType" enum="PowerSupplyType" + expires_after="2020-01-26"> <owner>bleung@chromium.org</owner> <owner>tbroch@chromium.org</owner> <summary> @@ -104207,7 +104296,7 @@ </histogram> <histogram name="PowerML.SmartDimModel.Result" - enum="PowerMLSmartDimModelResult"> + enum="PowerMLSmartDimModelResult" expires_after="2020-01-26"> <owner>jiameng@chromium.org</owner> <summary> This is the status code returned by the model when calculating a user @@ -106441,7 +106530,8 @@ </summary> </histogram> -<histogram base="true" name="Previews.ServerLitePage.Penalty" units="ms"> +<histogram base="true" name="Previews.ServerLitePage.Penalty" units="ms" + expires_after="2020-01-26"> <owner>robertogden@chromium.org</owner> <summary> The lost time spent attempting a server lite page via canceling and @@ -106504,7 +106594,8 @@ </summary> </histogram> -<histogram name="Previews.ServerLitePage.Triggered" enum="Boolean"> +<histogram name="Previews.ServerLitePage.Triggered" enum="Boolean" + expires_after="2020-01-26"> <owner>robertogden@chromium.org</owner> <summary> Whether or not the server lite page preview is triggered. Recorded on every @@ -106523,7 +106614,7 @@ </histogram> <histogram name="Previews.StalePreviewTimestampShown" - enum="PreviewsStalePreviewTimestamp" expires_after="M77"> + enum="PreviewsStalePreviewTimestamp" expires_after="2020-12-31"> <owner>robertogden@chromium.org</owner> <summary> Whether the timestamp for a stale preview was shown on the UI. If the @@ -106810,7 +106901,7 @@ </summary> </histogram> -<histogram name="PrintPreview.NumberOfPrinters"> +<histogram name="PrintPreview.NumberOfPrinters" expires_after="2020-01-26"> <owner>thestig@chromium.org</owner> <summary> Count the total number of printers shown in destination drop down list. @@ -106974,7 +107065,7 @@ </histogram> <histogram name="PrintPreview.PrintDocumentType" - enum="PrintPreviewPrintDocumentTypeBuckets"> + enum="PrintPreviewPrintDocumentTypeBuckets" expires_after="2020-01-26"> <owner>rbpotter@chromium.org</owner> <summary> Track type of documents printed (HTML vs PDF). Recorded immediately after a @@ -107148,7 +107239,8 @@ </summary> </histogram> -<histogram name="Privacy.ThirdPartyCookieBlockingSetting" enum="BooleanEnabled"> +<histogram name="Privacy.ThirdPartyCookieBlockingSetting" enum="BooleanEnabled" + expires_after="2020-01-26"> <owner>mkwst@chromium.org</owner> <owner>msramek@chromium.org</owner> <summary> @@ -107560,7 +107652,7 @@ </summary> </histogram> -<histogram name="Profile.NumberOfActiveProfiles"> +<histogram name="Profile.NumberOfActiveProfiles" expires_after="2020-01-26"> <owner>feuunk@chromium.org</owner> <summary> Counts the number of profiles on a user's machine at least every 24 hours @@ -107965,6 +108057,29 @@ </summary> </histogram> +<histogram name="Profile.UserAction.PerProfile" enum="Profile" + expires_after="2020-07-30"> + <owner>msarda@chromium.org</owner> + <owner>tangltom@chromium.org</owner> + <summary> + Helper histogram to track user actions per profile. Recorded when there is + an active profile browser instance and a UMA UserAction is recorded, i.e. if + there's an active profile, a recording of a UMA UserAction will result in a + recording of a sample in this histogram. + + Each profile on a client is assigned a unique bucket, i.e. whenever a user + action happens in a browser of profile x, an entry is recorded in bucket x. + + Example: A user has 2 profiles and opens a browser window for each of them. + When the user adds a new tab in each of the browsers, an entry is recorded + in bucket 1 and 2, corresponding to the profiles. (Adding a new tab is a + recorded user metrics action.) + + Note: The guest profile has bucket 0. Regular profiles start at bucket 1. + Incognito profiles count towards the original profile. + </summary> +</histogram> + <histogram name="Profile.ValidateMenuItemInvalidIndex.IsGuest" enum="Boolean"> <owner>anthonyvd@chromium.org</owner> <summary> @@ -108151,7 +108266,7 @@ </histogram> <histogram name="ProximityAuth.BleWeaveConnectionResult" - enum="ProximityAuth_BleWeaveConnectionResult"> + enum="ProximityAuth_BleWeaveConnectionResult" expires_after="2020-01-26"> <owner>hansberry@chromium.org</owner> <summary> Provides a breakdown of how often each BLE weave connection result occurs. @@ -108159,7 +108274,8 @@ </histogram> <histogram name="ProximityAuth.BluetoothGattConnectionResult" - enum="ProximityAuth_BluetoothGattConnectionResult"> + enum="ProximityAuth_BluetoothGattConnectionResult" + expires_after="2020-01-26"> <owner>hansberry@chromium.org</owner> <summary> Provides a breakdown of how many times each possible Bluetooth GATT @@ -108172,7 +108288,8 @@ </histogram> <histogram name="ProximityAuth.BluetoothGattNotifySessionResult" - enum="ProximityAuth_BluetoothGattServiceOperationResult"> + enum="ProximityAuth_BluetoothGattServiceOperationResult" + expires_after="2020-01-26"> <owner>hansberry@chromium.org</owner> <summary> Provides a breakdown of how many times each possible Bluetooth GATT @@ -108185,7 +108302,8 @@ </histogram> <histogram name="ProximityAuth.BluetoothGattWriteCharacteristicResult" - enum="ProximityAuth_BluetoothGattServiceOperationResult"> + enum="ProximityAuth_BluetoothGattServiceOperationResult" + expires_after="2020-01-26"> <owner>hansberry@chromium.org</owner> <summary> Provides a breakdown of how many times each possible Bluetooth GATT @@ -108682,7 +108800,7 @@ </summary> </histogram> -<histogram name="Quota.AgeOfDataInDays" units="days"> +<histogram name="Quota.AgeOfDataInDays" units="days" expires_after="2020-01-26"> <owner>jarrydg@chromium.org</owner> <summary> How many kilobytes are how old. Similar to |AgeOfOrigin| except a sample is @@ -108691,7 +108809,8 @@ </summary> </histogram> -<histogram name="Quota.AgeOfOriginInDays" units="days"> +<histogram name="Quota.AgeOfOriginInDays" units="days" + expires_after="2020-01-26"> <owner>jarrydg@chromium.org</owner> <summary> How many days it's been since an origin's temporary storage has been @@ -108760,7 +108879,8 @@ </summary> </histogram> -<histogram name="Quota.EvictedBytesPerRound" units="MB"> +<histogram name="Quota.EvictedBytesPerRound" units="MB" + expires_after="2020-01-26"> <owner>jarrydg@chromium.org</owner> <summary> Amount of usage used by evicted origins in an eviction round. @@ -108847,7 +108967,8 @@ </summary> </histogram> -<histogram name="Quota.NumberOfEvictedOriginsPerRound"> +<histogram name="Quota.NumberOfEvictedOriginsPerRound" + expires_after="2020-01-26"> <owner>jarrydg@chromium.org</owner> <summary>Number of evicted origins per round.</summary> </histogram> @@ -116646,7 +116767,7 @@ </histogram> <histogram name="SBClientDownload.CheckDownloadStats" - enum="SBClientDownloadCheckDownloadStats"> + enum="SBClientDownloadCheckDownloadStats" expires_after="2020-01-26"> <owner>vakh@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <owner>mattm@chromium.org</owner> @@ -116779,7 +116900,7 @@ </histogram> <histogram name="SBClientDownload.DownloadExtensions" - enum="SBClientDownloadExtensions"> + enum="SBClientDownloadExtensions" expires_after="2020-01-26"> <owner>vakh@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <owner>mattm@chromium.org</owner> @@ -131371,7 +131492,7 @@ </histogram> <histogram name="Stability.BadMessageTerminated.Chrome" - enum="BadMessageReasonChrome"> + enum="BadMessageReasonChrome" expires_after="2020-01-26"> <owner>creis@chromium.org</owner> <owner>jamescook@chromium.org</owner> <summary> @@ -131628,7 +131749,7 @@ </histogram> <histogram name="Stability.MobileSessionShutdownType" - enum="MobileSessionShutdownType"> + enum="MobileSessionShutdownType" expires_after="2020-01-26"> <owner>pkl@chromium.org</owner> <owner>olivierrobin@chromium.org</owner> <summary> @@ -133077,7 +133198,7 @@ </histogram> <histogram name="Storage.Blob.CreateDirectoryResult" enum="PlatformFileError" - expires_after="M77"> + expires_after="2020-01-26"> <owner>dmurph@chromium.org</owner> <summary> Recorded when we create the blob storage directory for the blob storage @@ -134169,7 +134290,7 @@ <histogram name="SubresourceFilter.PageLoad.SubresourceEvaluation.TotalCPUDuration" - units="microseconds" expires_after="M78"> + units="microseconds" expires_after="2020-01-26"> <owner>pkalinnikov@chromium.org</owner> <summary> Whenever a page load is finished with subresource filtering activated, @@ -134272,7 +134393,7 @@ </histogram> <histogram name="SubresourceFilter.SubresourceLoad.Evaluation.CPUDuration" - units="microseconds"> + units="microseconds" expires_after="2020-01-26"> <owner>pkalinnikov@chromium.org</owner> <summary> Whenever a subresource of a document is evaluated against the ruleset, @@ -134565,7 +134686,8 @@ <summary>Response or error codes from uploading sync attachments.</summary> </histogram> -<histogram name="Sync.AttemptNigoriMigration" enum="SyncNigoriMigrationResult"> +<histogram name="Sync.AttemptNigoriMigration" enum="SyncNigoriMigrationResult" + expires_after="2020-01-26"> <owner>zea@chromium.org</owner> <summary> Enumeration of results from attempting to migrate Sync's nigori node and its @@ -135369,7 +135491,7 @@ </histogram> <histogram name="Sync.DirectoryVsPrefsConsistency" - enum="SyncDirectoryVsPrefsConsistency"> + enum="SyncDirectoryVsPrefsConsistency" expires_after="2020-01-26"> <owner>mastiz@chromium.org</owner> <owner>treib@chromium.org</owner> <summary> @@ -136211,7 +136333,8 @@ </summary> </histogram> -<histogram name="Sync.NigoriMigrationState" enum="SyncNigoriMigrationState"> +<histogram name="Sync.NigoriMigrationState" enum="SyncNigoriMigrationState" + expires_after="2020-01-26"> <owner>zea@chromium.org</owner> <summary>Breakdown of sync's nigori node keystore migration state.</summary> </histogram> @@ -136560,7 +136683,8 @@ </summary> </histogram> -<histogram name="Sync.PostedDataTypeGetUpdatesRequest" enum="SyncModelTypes"> +<histogram name="Sync.PostedDataTypeGetUpdatesRequest" enum="SyncModelTypes" + expires_after="2020-01-26"> <owner>mastiz@chromium.org</owner> <owner>jkrcal@chromium.org</owner> <summary> @@ -137055,7 +137179,8 @@ <summary>Data type that first requests sync initialization.</summary> </histogram> -<histogram name="Sync.StopSource" enum="SyncStopSource"> +<histogram name="Sync.StopSource" enum="SyncStopSource" + expires_after="2020-01-26"> <owner>treib@chromium.org</owner> <owner>mastiz@chromium.org</owner> <summary> @@ -141427,7 +141552,8 @@ </summary> </histogram> -<histogram name="Tracing.Background.FinalizingTraceSizeInKB" units="KB"> +<histogram name="Tracing.Background.FinalizingTraceSizeInKB" units="KB" + expires_after="2020-01-26"> <owner>oysteine@chromium.org</owner> <summary> The size, in kilobytes, of a finalized trace ready to be uploaded. @@ -141453,7 +141579,7 @@ </histogram> <histogram name="Tracing.Background.ScenarioState" - enum="BackgroundTracingState"> + enum="BackgroundTracingState" expires_after="2020-01-26"> <owner>oysteine@chromium.org</owner> <summary> Records state of the Background Tracing system, from when scenarios are @@ -141640,7 +141766,7 @@ </histogram> <histogram name="Translate.CompactInfobar.Language.NeverTranslate" - enum="CLD3LanguageCode"> + enum="CLD3LanguageCode" expires_after="2020-01-26"> <owner>anthonyvd@chromium.org</owner> <summary> Records the hashcode of the source language when never translate this @@ -141694,7 +141820,7 @@ </summary> </histogram> -<histogram name="Translate.DeclineTranslate"> +<histogram name="Translate.DeclineTranslate" expires_after="2020-01-26"> <owner>kenjibaheux@google.com</owner> <summary> The number of times the "Nope" (don't translate) or the infobar's @@ -141871,7 +141997,8 @@ </summary> </histogram> -<histogram name="Translate.MobileMenuTranslate.Shown" enum="Boolean"> +<histogram name="Translate.MobileMenuTranslate.Shown" enum="Boolean" + expires_after="2020-01-26"> <owner>yyushkina@google.com</owner> <owner>frechette@chromium.org</owner> <summary> @@ -141888,7 +142015,7 @@ </summary> </histogram> -<histogram name="Translate.ModifyTargetLang"> +<histogram name="Translate.ModifyTargetLang" expires_after="2020-01-26"> <owner>kenjibaheux@google.com</owner> <summary> The number of times the target language in the translate infobar has been @@ -142117,7 +142244,8 @@ <summary>The time from starting translation to the completion.</summary> </histogram> -<histogram name="Translate.Translate" enum="BooleanTranslate"> +<histogram name="Translate.Translate" enum="BooleanTranslate" + expires_after="2020-01-26"> <owner>kenjibaheux@google.com</owner> <summary> The number of times the translate button was clicked in the translate @@ -142806,7 +142934,8 @@ </summary> </histogram> -<histogram name="UMA.EnrollmentStatus" enum="EnrollmentStatus"> +<histogram name="UMA.EnrollmentStatus" enum="EnrollmentStatus" + expires_after="2020-01-26"> <owner>asvitkine@chromium.org</owner> <owner>kaznacheev@chromium.org</owner> <summary> @@ -143184,7 +143313,7 @@ </histogram> <histogram name="UMA.LogUpload.ResponseOrErrorCode" - enum="CombinedHttpResponseAndNetErrorCode"> + enum="CombinedHttpResponseAndNetErrorCode" expires_after="2020-01-26"> <owner>holte@chromium.org</owner> <owner>asvitkine@chromium.org</owner> <summary> @@ -143523,7 +143652,7 @@ </histogram> <histogram name="UMA.TruncatedEvents.UserAction" units="events" - expires_after="2020-01-20"> + expires_after="2020-01-26"> <owner>rkaplow@chromium.org</owner> <summary> The number of user actions events that existed in the metrics log before we @@ -144955,7 +145084,8 @@ <summary>Time spent compiling functions lazily on first run.</summary> </histogram> -<histogram name="V8.CompileLazyMicroSeconds" units="microseconds"> +<histogram name="V8.CompileLazyMicroSeconds" units="microseconds" + expires_after="2020-01-26"> <owner>hablich@chromium.org</owner> <summary> Aggregated time spent compiling functions lazily during a single script @@ -145312,7 +145442,7 @@ <summary>Time spent doing a full GC during an IdleNotification.</summary> </histogram> -<histogram name="V8.GCFinalizeMC" units="ms"> +<histogram name="V8.GCFinalizeMC" units="ms" expires_after="2020-01-26"> <owner>ulan@chromium.org</owner> <owner>hpayer@chromium.org</owner> <summary> @@ -145395,7 +145525,8 @@ </summary> </histogram> -<histogram name="V8.GCFinalizeMCForeground" units="ms"> +<histogram name="V8.GCFinalizeMCForeground" units="ms" + expires_after="2020-01-26"> <owner>ulan@chromium.org</owner> <owner>hpayer@chromium.org</owner> <summary> @@ -145517,7 +145648,7 @@ </summary> </histogram> -<histogram name="V8.GCMarkCompactor" units="ms"> +<histogram name="V8.GCMarkCompactor" units="ms" expires_after="2020-01-26"> <owner>mlippautz@chromium.org</owner> <summary> Sum of all durations of individual phases within one V8 mark-compact garbage @@ -145525,7 +145656,8 @@ </summary> </histogram> -<histogram name="V8.GCMarkCompactReason" enum="GarbageCollectionReason"> +<histogram name="V8.GCMarkCompactReason" enum="GarbageCollectionReason" + expires_after="2020-01-26"> <owner>ulan@chromium.org</owner> <summary>Reason a mark-compact garbage collection was started in V8.</summary> </histogram> @@ -147988,7 +148120,7 @@ </histogram> <histogram name="WebApk.Install.GooglePlayInstallResult" - enum="WebApkGooglePlayInstallResult"> + enum="WebApkGooglePlayInstallResult" expires_after="2020-01-26"> <owner>hanxi@chromium.org</owner> <owner>pkotwicz@chromium.org</owner> <owner>yfriedman@chromium.org</owner> @@ -148042,7 +148174,8 @@ </summary> </histogram> -<histogram name="WebApk.Install.InstallEvent" enum="WebApkInstallEvent"> +<histogram name="WebApk.Install.InstallEvent" enum="WebApkInstallEvent" + expires_after="2020-01-26"> <owner>hanxi@chromium.org</owner> <owner>pkotwicz@chromium.org</owner> <owner>yfriedman@chromium.org</owner> @@ -148521,6 +148654,10 @@ <histogram name="Webapp.Splashscreen.BackgroundColor" enum="SplashColorStatus" expires_after="M77"> + <obsolete> + Removed 07/2019 in Issue http://crbug.com/1716136. Information no longer + needed or recorded. + </obsolete> <owner>mlamouri@chromium.org</owner> <summary> Records the status of the splashscreen's background color (default or @@ -148529,17 +148666,26 @@ </histogram> <histogram name="Webapp.Splashscreen.Duration" units="ms" expires_after="M77"> + <obsolete> + Removed 07/2019 in Issue http://crbug.com/1716136. Information no longer + needed or recorded. + </obsolete> <owner>mlamouri@chromium.org</owner> <summary>Records the time during which the splashscreen was visible.</summary> </histogram> <histogram name="Webapp.Splashscreen.Hides" enum="SplashHidesReason" - expires_after="M77"> - <owner>mlamouri@chromium.org</owner> + expires_after="M80"> + <owner>pkotwicz@chromium.org</owner> + <owner>hartmanng@chromium.org</owner> <summary>Records the signal that was used to hide the splashscreen.</summary> </histogram> -<histogram name="Webapp.Splashscreen.Icon.Size" units="dp"> +<histogram name="Webapp.Splashscreen.Icon.Size" units="dp" expires_after="M77"> + <obsolete> + Removed 07/2019 in Issue http://crbug.com/1716136. Information no longer + needed or recorded. + </obsolete> <owner>mlamouri@chromium.org</owner> <summary> Records the size of the icon used to construct the splashscreen in device @@ -148550,6 +148696,10 @@ <histogram name="Webapp.Splashscreen.Icon.Type" enum="SplashIconType" expires_after="M77"> + <obsolete> + Removed 07/2019 in Issue http://crbug.com/1716136. Information no longer + needed or recorded. + </obsolete> <owner>mlamouri@chromium.org</owner> <summary> Records the origin of the icon used to construct the splashscreen. @@ -148558,6 +148708,10 @@ <histogram name="Webapp.Splashscreen.ThemeColor" enum="SplashColorStatus" expires_after="M77"> + <obsolete> + Removed 07/2019 in Issue http://crbug.com/1716136. Information no longer + needed or recorded. + </obsolete> <owner>mlamouri@chromium.org</owner> <summary> Records the status of the splashscreen's theme color (default or custom). @@ -151164,7 +151318,7 @@ </histogram> <histogram name="WebRTC.Audio.ApmCaptureInputLevelAverageRms" - units="dBFS (negated)"> + units="dBFS (negated)" expires_after="2020-01-26"> <owner>hlundin@chromium.org</owner> <summary> This histogram reports the average RMS of the signal coming in to WebRTC's @@ -151176,7 +151330,7 @@ </histogram> <histogram name="WebRTC.Audio.ApmCaptureInputLevelPeakRms" - units="dBFS (negated)"> + units="dBFS (negated)" expires_after="2020-01-26"> <owner>hlundin@chromium.org</owner> <summary> This histogram reports the peak RMS of the signal coming in to WebRTC's @@ -151188,7 +151342,7 @@ </histogram> <histogram name="WebRTC.Audio.ApmCaptureOutputLevelAverageRms" - units="dBFS (negated)"> + units="dBFS (negated)" expires_after="2020-01-26"> <owner>peah@chromium.org</owner> <summary> This histogram reports the average RMS of the signal in the output of @@ -151289,7 +151443,8 @@ </summary> </histogram> -<histogram name="WebRTC.Audio.AverageExcessBufferDelayMs" units="ms"> +<histogram name="WebRTC.Audio.AverageExcessBufferDelayMs" units="ms" + expires_after="2020-01-26"> <owner>hlundin@chromium.org</owner> <summary> Measures the average waiting time in the buffer for each packet. The waiting @@ -151380,7 +151535,7 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.DelayChanges" - enum="WebRTCEventFrequency"> + enum="WebRTCEventFrequency" expires_after="2020-01-26"> <owner>peah@chromium.org</owner> <summary> This histogram logs the frequency of echo path delay changes that are @@ -151390,7 +151545,8 @@ </summary> </histogram> -<histogram name="WebRTC.Audio.EchoCanceller.EchoPathDelay" units="Blocks"> +<histogram name="WebRTC.Audio.EchoCanceller.EchoPathDelay" units="Blocks" + expires_after="2020-01-26"> <owner>peah@chromium.org</owner> <summary> This histogram logs the estimated echo path delay in 64 sample blocks as @@ -151548,7 +151704,7 @@ </histogram> <histogram name="WebRTC.Audio.EchoCanceller.RenderOverruns" - enum="WebRTCEventFrequency"> + enum="WebRTCEventFrequency" expires_after="2020-01-26"> <owner>peah@chromium.org</owner> <summary> This histogram logs the frequency of overruns in the render buffer of the @@ -151691,7 +151847,8 @@ </summary> </histogram> -<histogram name="WebRTC.Audio.ResidualEchoDetector.EchoLikelihood" units="%"> +<histogram name="WebRTC.Audio.ResidualEchoDetector.EchoLikelihood" units="%" + expires_after="2020-01-26"> <owner>hlundin@chromium.org</owner> <owner>ivoc@chromium.org</owner> <summary> @@ -151854,7 +152011,7 @@ </summary> </histogram> -<histogram name="WebRTC.BWE.InitialRtt" units="ms"> +<histogram name="WebRTC.BWE.InitialRtt" units="ms" expires_after="2020-01-26"> <owner>holmer@chromium.org</owner> <summary> The round-trip time as measured 2 seconds into a WebRTC call. @@ -151998,7 +152155,8 @@ </summary> </histogram> -<histogram name="WebRTC.Call.EstimatedSendBitrateInKbps" units="kbps"> +<histogram name="WebRTC.Call.EstimatedSendBitrateInKbps" units="kbps" + expires_after="2020-01-26"> <owner>holmer@chromium.org</owner> <summary> Average estimated send bitrate during a call, counted from first packet sent @@ -152605,7 +152763,8 @@ </summary> </histogram> -<histogram name="WebRTC.ReliableDataChannelMessageSize" units="bytes"> +<histogram name="WebRTC.ReliableDataChannelMessageSize" units="bytes" + expires_after="2020-01-26"> <owner>perkj@chromium.org</owner> <summary> Sizes of messages sent over reliable data channels. The size of an @@ -152705,7 +152864,8 @@ </summary> </histogram> -<histogram name="WebRTC.UnreliableDataChannelMessageSize" units="bytes"> +<histogram name="WebRTC.UnreliableDataChannelMessageSize" units="bytes" + expires_after="2020-01-26"> <owner>perkj@chromium.org</owner> <summary> Sizes of messages sent over unreliable data channels. The size of an @@ -152773,21 +152933,23 @@ </summary> </histogram> -<histogram name="WebRTC.Video.BadCall.Any" units="%"> +<histogram name="WebRTC.Video.BadCall.Any" units="%" expires_after="2020-01-26"> <owner>sprang@chromium.org</owner> <summary> Fraction of time the call was classified as bad because of any reason. </summary> </histogram> -<histogram name="WebRTC.Video.BadCall.FrameRate" units="%"> +<histogram name="WebRTC.Video.BadCall.FrameRate" units="%" + expires_after="2020-01-26"> <owner>sprang@chromium.org</owner> <summary> Fraction of time the call was classified as bad because of low framerate. </summary> </histogram> -<histogram name="WebRTC.Video.BadCall.FrameRateVariance" units="%"> +<histogram name="WebRTC.Video.BadCall.FrameRateVariance" units="%" + expires_after="2020-01-26"> <owner>sprang@chromium.org</owner> <summary> Fraction of time the call was classified as bad because of high framerate @@ -152802,7 +152964,8 @@ </summary> </histogram> -<histogram name="WebRTC.Video.BandwidthLimitedResolutionInPercent" units="%"> +<histogram name="WebRTC.Video.BandwidthLimitedResolutionInPercent" units="%" + expires_after="2020-01-26"> <owner>asapersson@chromium.org</owner> <summary> Percentage of sent frames that are limited in resolution due to bandwidth @@ -152811,7 +152974,7 @@ </histogram> <histogram name="WebRTC.Video.BandwidthLimitedResolutionsDisabled" - units="disabled resolutions"> + units="disabled resolutions" expires_after="2020-01-26"> <owner>asapersson@chromium.org</owner> <summary> For frames that are limited in resolution due to bandwidth, the average @@ -152829,7 +152992,8 @@ </summary> </histogram> -<histogram name="WebRTC.Video.BitrateSentInKbps" units="kbps"> +<histogram name="WebRTC.Video.BitrateSentInKbps" units="kbps" + expires_after="2020-01-26"> <owner>asapersson@chromium.org</owner> <summary> The number of sent bits per second for a sent video stream. Recorded when a @@ -152847,7 +153011,8 @@ </summary> </histogram> -<histogram name="WebRTC.Video.CpuLimitedResolutionInPercent" units="%"> +<histogram name="WebRTC.Video.CpuLimitedResolutionInPercent" units="%" + expires_after="2020-01-26"> <owner>asapersson@chromium.org</owner> <summary> Percentage of frames that are limited in resolution due to CPU for a sent @@ -153191,7 +153356,8 @@ </summary> </histogram> -<histogram name="WebRTC.Video.NumberFreezesPerMinute" units="freezes/minute"> +<histogram name="WebRTC.Video.NumberFreezesPerMinute" units="freezes/minute" + expires_after="2020-01-26"> <owner>ssilkin@chromium.org</owner> <summary> The number of video freezes per minute for a received video stream. Recorded @@ -153199,7 +153365,8 @@ </summary> </histogram> -<histogram name="WebRTC.Video.NumberOfPauseEvents" units="pause events"> +<histogram name="WebRTC.Video.NumberOfPauseEvents" units="pause events" + expires_after="2020-01-26"> <owner>asapersson@chromium.org</owner> <summary> The number of times a video stream has been paused/resumed during a call. @@ -153335,7 +153502,8 @@ </summary> </histogram> -<histogram name="WebRTC.Video.RenderFramesPerSecond" units="fps"> +<histogram name="WebRTC.Video.RenderFramesPerSecond" units="fps" + expires_after="2020-01-26"> <owner>asapersson@chromium.org</owner> <summary> The number of sent frames to the renderer per second for a received video @@ -153929,7 +154097,8 @@ </summary> </histogram> -<histogram name="WebRTC.Video.SentPacketsLostInPercent" units="%"> +<histogram name="WebRTC.Video.SentPacketsLostInPercent" units="%" + expires_after="2020-01-26"> <owner>asapersson@chromium.org</owner> <summary> Percentage of sent packets lost for a sent video stream. Recorded when a @@ -155195,7 +155364,8 @@ <summary>The time taken for running a worker task on WorkerThread.</summary> </histogram> -<histogram name="WrenchMenu.MenuAction" enum="WrenchMenuAction"> +<histogram name="WrenchMenu.MenuAction" enum="WrenchMenuAction" + expires_after="2020-01-26"> <owner>ainslie@chromium.org</owner> <owner>edwardjung@chromium.org</owner> <summary>Number of times that each menu item is clicked.</summary> @@ -156563,6 +156733,13 @@ <affected-histogram name="Availability.Prober.TimeUntilSuccess"/> </histogram_suffixes> +<histogram_suffixes name="BackgroundDownload" separator="."> + <suffix name="BackgroundDownload" + label="Download that started in background."/> + <affected-histogram name="Download.HttpResponseCode"/> + <affected-histogram name="Download.MapErrorNetworkFailed.NetworkService"/> +</histogram_suffixes> + <histogram_suffixes name="BackgroundFetchDatabaseStorageErrors" separator="."> <suffix name="CleanupTask" label="CleanupTask"/> <suffix name="CreateMetadataTask" label="CreateMetadata DatabaseTask"/>
diff --git a/tools/perf/cli_tools/pinboard/job_configs.json b/tools/perf/cli_tools/pinboard/job_configs.json index a1e66e09..03f3beb 100644 --- a/tools/perf/cli_tools/pinboard/job_configs.json +++ b/tools/perf/cli_tools/pinboard/job_configs.json
@@ -25,5 +25,14 @@ "extra_test_args": "--story-tag-filter emerging_market", "patch": "https://chromium-review.googlesource.com/c/v8/v8/+/1278496", "repository": "chromium" + }, + { + "name": "Try job for scheduler: disable bootstrap prioritization", + "target": "performance_test_suite", + "configuration": "android-go-perf", + "benchmark": "startup.mobile", + "extra_test_args": "--story-filter=intent:coldish:bbc", + "patch": "https://chromium-review.googlesource.com/c/chromium/src/+/1731904", + "repository": "chromium" } ]
diff --git a/ui/accessibility/ax_position.h b/ui/accessibility/ax_position.h index 3399b6bd..c5b2b9e 100644 --- a/ui/accessibility/ax_position.h +++ b/ui/accessibility/ax_position.h
@@ -1795,7 +1795,8 @@ (child_index_ != BEFORE_TEXT && (child_index_ < 0 || child_index_ > AnchorChildCount()))) || (kind_ == AXPositionKind::TEXT_POSITION && - (text_offset_ < 0 || text_offset_ > MaxTextOffset()))) { + (text_offset_ < 0 || + (text_offset > 0 && text_offset_ > MaxTextOffset())))) { // Reset to the null position. kind_ = AXPositionKind::NULL_POSITION; tree_id_ = AXTreeIDUnknown();
diff --git a/ui/aura/BUILD.gn b/ui/aura/BUILD.gn index 43378db..630f2c2 100644 --- a/ui/aura/BUILD.gn +++ b/ui/aura/BUILD.gn
@@ -246,6 +246,9 @@ } if (use_ozone) { + if (is_fuchsia) { + deps += [ "//ui/ozone" ] + } sources += [ "test/ui_controls_factory_ozone.cc" ] } }
diff --git a/ui/aura/demo/demo_main.cc b/ui/aura/demo/demo_main.cc index 04fb007..9877cf7 100644 --- a/ui/aura/demo/demo_main.cc +++ b/ui/aura/demo/demo_main.cc
@@ -9,6 +9,7 @@ #include "base/i18n/icu_util.h" #include "base/macros.h" #include "base/memory/ptr_util.h" +#include "base/message_loop/message_pump_type.h" #include "base/power_monitor/power_monitor.h" #include "base/power_monitor/power_monitor_device_source.h" #include "base/run_loop.h" @@ -144,8 +145,7 @@ #endif // Create the task executor here before creating the root window. - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); base::ThreadPoolInstance::CreateAndStartWithDefaultParams("demo"); ui::InitializeInputMethodForTesting();
diff --git a/ui/aura/test/test_screen.cc b/ui/aura/test/test_screen.cc index 01be576b..1963534 100644 --- a/ui/aura/test/test_screen.cc +++ b/ui/aura/test/test_screen.cc
@@ -19,6 +19,7 @@ #include "ui/platform_window/platform_window_init_properties.h" #if defined(OS_FUCHSIA) +#include "ui/ozone/public/ozone_platform.h" // nogncheck #include "ui/platform_window/fuchsia/initialize_presenter_api_view.h" #endif @@ -50,7 +51,11 @@ ui::PlatformWindowInitProperties properties( gfx::Rect(GetPrimaryDisplay().GetSizeInPixel())); #if defined(OS_FUCHSIA) - ui::fuchsia::InitializeViewTokenAndPresentView(&properties); + if (ui::OzonePlatform::GetInstance() + ->GetPlatformProperties() + .needs_view_token) { + ui::fuchsia::InitializeViewTokenAndPresentView(&properties); + } #endif host_ = WindowTreeHost::Create(std::move(properties)).release(); // Some tests don't correctly manage window focus/activation states.
diff --git a/ui/file_manager/file_manager/background/js/runtime_loaded_test_util.js b/ui/file_manager/file_manager/background/js/runtime_loaded_test_util.js index 078a3a8..8f022aa9 100644 --- a/ui/file_manager/file_manager/background/js/runtime_loaded_test_util.js +++ b/ui/file_manager/file_manager/background/js/runtime_loaded_test_util.js
@@ -62,6 +62,7 @@ // Get the scroll position of the element. result.scrollLeft = element.scrollLeft; + result.scrollTop = element.scrollTop; return result; } @@ -312,7 +313,6 @@ /** * Sets the left scroll position of an element. - * Used to enable testing of horizontal scrolled areas. * @param {Window} contentWindow Window to be tested. * @param {string} query Query for the test element. * @param {number} position scrollLeft position to set. @@ -323,6 +323,17 @@ }; /** + * Sets the top scroll position of an element. + * @param {Window} contentWindow Window to be tested. + * @param {string} query Query for the test element. + * @param {number} position scrollTop position to set. + */ +test.util.sync.setScrollTop = (contentWindow, query, position) => { + const scrollablElement = contentWindow.document.querySelector(query); + scrollablElement.scrollTop = position; +}; + +/** * Sets style properties for an element using the CSS OM. * @param {Window} contentWindow Window to be tested. * @param {string} query Query for the test element.
diff --git a/ui/file_manager/integration_tests/file_manager/navigation_list.js b/ui/file_manager/integration_tests/file_manager/navigation_list.js index d66cc6f..0da399c 100644 --- a/ui/file_manager/integration_tests/file_manager/navigation_list.js +++ b/ui/file_manager/integration_tests/file_manager/navigation_list.js
@@ -5,43 +5,82 @@ 'use strict'; (() => { /** - * Tests that the directory tree area can be horizontally scrolled. - * TODO(crbug.com/966807) add a vertical scroll case. + * Tests that the directory tree area can be vertically scrolled. */ - testcase.navigationScrollsWhenClipped = async () => { - // Open FilesApp with the Downloads folder visible. + testcase.navigationListVerticalScroll = async () => { + // Add directory entries to overflow the navigation list container. + let folders = [ENTRIES.photos]; + for (let i = 0; i < 30; i++) { + folders.push(new TestEntryInfo({ + type: EntryType.DIRECTORY, + targetPath: '' + i, + lastModifiedTime: 'Jan 1, 1980, 11:59 PM', + nameText: '' + i, + sizeText: '--', + typeText: 'Folder' + })); + } + + // Open FilesApp on Downloads. Expand the navigation list view of Downloads. + const appId = await setupAndWaitUntilReady(RootPath.DOWNLOADS, folders, []); + await expandRoot(appId, TREEITEM_DOWNLOADS); + + // Get the navigationList and verify it is not scrolled. + const navigationList = '.dialog-navigation-list'; + const originalList = await remoteCall.waitForElementStyles( + appId, navigationList, ['scrollTop']); + chrome.test.assertTrue(originalList.scrollTop === 0); + + // Scroll the navigation list down (vertical scroll). + await remoteCall.callRemoteTestUtil( + 'setScrollTop', appId, [navigationList, 100]); + + // Check: the navigation list should be scrolled. + const newList = await remoteCall.waitForElementStyles( + appId, navigationList, ['scrollTop']); + chrome.test.assertTrue(newList.scrollTop > 0); + }; + + /** + * Tests that the directory tree area can be horizontally scrolled. + * TODO(crbug.com/966807): Clean up test case to match the comment style and + * organization of navigationListVerticalScroll. + * Remove unnecessary check that originalWidth > 0. + */ + testcase.navigationListHorizontalScroll = async () => { + // Open FilesApp on Downloads. Expand the navigation list view of Downloads. const appId = await setupAndWaitUntilReady( RootPath.DOWNLOADS, BASIC_LOCAL_ENTRY_SET, []); await expandRoot(appId, TREEITEM_DOWNLOADS); // Get the navigationList width property and make sure it has non-zero size. const navigationList = '.dialog-navigation-list'; - let list = + const originalList = await remoteCall.waitForElementStyles(appId, navigationList, ['width']); - const originalWidth = Number(list.styles['width'].match(/[0-9]*/)); + const originalWidth = Number(originalList.styles['width'].match(/[0-9]*/)); chrome.test.assertTrue(originalWidth > 0); - // Shrink the navigation list tree area to 100px. + // Shrink the navigation list tree area to 50px. await remoteCall.callRemoteTestUtil( 'setElementStyles', appId, [navigationList, {width: '50px'}]); // Check the navigation list area is scrolled completely to the left side. - chrome.test.assertTrue(list.scrollLeft == 0); + chrome.test.assertTrue(originalList.scrollLeft === 0); - // Attempt to scroll the navigation list area to the right. + // Scroll the navigation list down (horizontal scroll). await remoteCall.callRemoteTestUtil( 'setScrollLeft', appId, [navigationList, 100]); // Get the current state of the NavigationWidth width and left scroll // offset. - list = + const newList = await remoteCall.waitForElementStyles(appId, navigationList, ['width']); // Check that the width has been reduced. - const newWidth = Number(list.styles['width'].match(/[0-9]*/)); + const newWidth = Number(newList.styles['width'].match(/[0-9]*/)); chrome.test.assertTrue(newWidth < originalWidth); - // Check the navigation list area has scrolled. - chrome.test.assertTrue(list.scrollLeft > 0); + // Check: the navigation list should be scrolled. + chrome.test.assertTrue(newList.scrollLeft > 0); }; })();
diff --git a/ui/gfx/font.cc b/ui/gfx/font.cc index 99f0103..a3f46a86 100644 --- a/ui/gfx/font.cc +++ b/ui/gfx/font.cc
@@ -72,8 +72,8 @@ return platform_font_->GetFontName(); } -std::string Font::GetActualFontNameForTesting() const { - return platform_font_->GetActualFontNameForTesting(); +std::string Font::GetActualFontName() const { + return platform_font_->GetActualFontName(); } int Font::GetFontSize() const {
diff --git a/ui/gfx/font.h b/ui/gfx/font.h index 72614df..0f71876 100644 --- a/ui/gfx/font.h +++ b/ui/gfx/font.h
@@ -105,11 +105,11 @@ // Returns the style of the font. int GetStyle() const; - // Returns the specified font name in UTF-8. + // Returns the specified font name in UTF-8, without font mapping. const std::string& GetFontName() const; - // Returns the actually used font name in UTF-8. - std::string GetActualFontNameForTesting() const; + // Returns the actually used font name in UTF-8 after font mapping. + std::string GetActualFontName() const; // Returns the font size in pixels. int GetFontSize() const;
diff --git a/ui/gfx/font_list_unittest.cc b/ui/gfx/font_list_unittest.cc index f5714fa8..405bdd90 100644 --- a/ui/gfx/font_list_unittest.cc +++ b/ui/gfx/font_list_unittest.cc
@@ -236,7 +236,7 @@ // If a font list has only one font, the height and baseline must be the same. Font font1(kTestFontName, 16); ASSERT_EQ(base::ToLowerASCII(kTestFontName), - base::ToLowerASCII(font1.GetActualFontNameForTesting())); + base::ToLowerASCII(font1.GetActualFontName())); FontList font_list1(std::string(kTestFontName) + ", 16px"); EXPECT_EQ(font1.GetHeight(), font_list1.GetHeight()); EXPECT_EQ(font1.GetBaseline(), font_list1.GetBaseline()); @@ -247,7 +247,7 @@ // kTestFontName, but on Android it does not. Font font2(kCJKFontName, 16); ASSERT_EQ(base::ToLowerASCII(kCJKFontName), - base::ToLowerASCII(font2.GetActualFontNameForTesting())); + base::ToLowerASCII(font2.GetActualFontName())); std::vector<Font> fonts; fonts.push_back(font1); fonts.push_back(font2);
diff --git a/ui/gfx/font_unittest.cc b/ui/gfx/font_unittest.cc index 2e8e1db..0aeae3c 100644 --- a/ui/gfx/font_unittest.cc +++ b/ui/gfx/font_unittest.cc
@@ -60,7 +60,7 @@ EXPECT_EQ(cf.GetFontSize(), 16); EXPECT_EQ(cf.GetFontName(), kTestFontName); EXPECT_EQ(base::ToLowerASCII(kTestFontName), - base::ToLowerASCII(cf.GetActualFontNameForTesting())); + base::ToLowerASCII(cf.GetActualFontName())); } TEST_F(FontTest, LoadArialBold) { @@ -72,7 +72,7 @@ EXPECT_EQ(bold.GetStyle(), Font::NORMAL); EXPECT_EQ(bold.GetWeight(), Font::Weight::BOLD); EXPECT_EQ(base::ToLowerASCII(kTestFontName), - base::ToLowerASCII(cf.GetActualFontNameForTesting())); + base::ToLowerASCII(cf.GetActualFontName())); } TEST_F(FontTest, Ascent) { @@ -106,17 +106,17 @@ // Check that fonts used for testing are installed and enabled. On Mac // fonts may be installed but still need enabling in Font Book.app. // http://crbug.com/347429 -TEST_F(FontTest, GetActualFontNameForTesting) { +TEST_F(FontTest, GetActualFontName) { Font arial(kTestFontName, 16); EXPECT_EQ(base::ToLowerASCII(kTestFontName), - base::ToLowerASCII(arial.GetActualFontNameForTesting())) + base::ToLowerASCII(arial.GetActualFontName())) << "********\n" << "Your test environment seems to be missing Arial font, which is " << "needed for unittests. Check if Arial font is installed.\n" << "********"; Font symbol(kSymbolFontName, 16); EXPECT_EQ(base::ToLowerASCII(kSymbolFontName), - base::ToLowerASCII(symbol.GetActualFontNameForTesting())) + base::ToLowerASCII(symbol.GetActualFontName())) << "********\n" << "Your test environment seems to be missing the " << kSymbolFontName << " font, which is " @@ -127,7 +127,7 @@ const char* const invalid_font_name = "no_such_font_name"; Font fallback_font(invalid_font_name, 16); EXPECT_NE(invalid_font_name, - base::ToLowerASCII(fallback_font.GetActualFontNameForTesting())); + base::ToLowerASCII(fallback_font.GetActualFontName())); } TEST_F(FontTest, DeriveFont) {
diff --git a/ui/gfx/platform_font.h b/ui/gfx/platform_font.h index 2f2a01a..ccdfb71 100644 --- a/ui/gfx/platform_font.h +++ b/ui/gfx/platform_font.h
@@ -74,7 +74,7 @@ virtual const std::string& GetFontName() const = 0; // Returns the actually used font name in UTF-8. - virtual std::string GetActualFontNameForTesting() const = 0; + virtual std::string GetActualFontName() const = 0; // Returns the font size in pixels. virtual int GetFontSize() const = 0;
diff --git a/ui/gfx/platform_font_ios.h b/ui/gfx/platform_font_ios.h index ffaaac0..40f5b24 100644 --- a/ui/gfx/platform_font_ios.h +++ b/ui/gfx/platform_font_ios.h
@@ -28,7 +28,7 @@ int GetExpectedTextWidth(int length) override; int GetStyle() const override; const std::string& GetFontName() const override; - std::string GetActualFontNameForTesting() const override; + std::string GetActualFontName() const override; int GetFontSize() const override; const FontRenderParams& GetFontRenderParams() override; NativeFont GetNativeFont() const override;
diff --git a/ui/gfx/platform_font_ios.mm b/ui/gfx/platform_font_ios.mm index a5e0336..8d8d6a9 100644 --- a/ui/gfx/platform_font_ios.mm +++ b/ui/gfx/platform_font_ios.mm
@@ -77,7 +77,7 @@ return font_name_; } -std::string PlatformFontIOS::GetActualFontNameForTesting() const { +std::string PlatformFontIOS::GetActualFontName() const { return base::SysNSStringToUTF8([GetNativeFont() familyName]); }
diff --git a/ui/gfx/platform_font_mac.h b/ui/gfx/platform_font_mac.h index e127fa1..903227e8 100644 --- a/ui/gfx/platform_font_mac.h +++ b/ui/gfx/platform_font_mac.h
@@ -31,7 +31,7 @@ int GetExpectedTextWidth(int length) override; int GetStyle() const override; const std::string& GetFontName() const override; - std::string GetActualFontNameForTesting() const override; + std::string GetActualFontName() const override; int GetFontSize() const override; const FontRenderParams& GetFontRenderParams() override; NativeFont GetNativeFont() const override;
diff --git a/ui/gfx/platform_font_mac.mm b/ui/gfx/platform_font_mac.mm index c8ce3bd..1f57c28 100644 --- a/ui/gfx/platform_font_mac.mm +++ b/ui/gfx/platform_font_mac.mm
@@ -293,7 +293,7 @@ return font_name_; } -std::string PlatformFontMac::GetActualFontNameForTesting() const { +std::string PlatformFontMac::GetActualFontName() const { return base::SysNSStringToUTF8([native_font_ familyName]); }
diff --git a/ui/gfx/platform_font_skia.cc b/ui/gfx/platform_font_skia.cc index 35cef218..3764e0f 100644 --- a/ui/gfx/platform_font_skia.cc +++ b/ui/gfx/platform_font_skia.cc
@@ -237,7 +237,7 @@ return font_family_; } -std::string PlatformFontSkia::GetActualFontNameForTesting() const { +std::string PlatformFontSkia::GetActualFontName() const { SkString family_name; typeface_->getFamilyName(&family_name); return family_name.c_str();
diff --git a/ui/gfx/platform_font_skia.h b/ui/gfx/platform_font_skia.h index d38e6d6..077c31f 100644 --- a/ui/gfx/platform_font_skia.h +++ b/ui/gfx/platform_font_skia.h
@@ -53,7 +53,7 @@ int GetExpectedTextWidth(int length) override; int GetStyle() const override; const std::string& GetFontName() const override; - std::string GetActualFontNameForTesting() const override; + std::string GetActualFontName() const override; int GetFontSize() const override; const FontRenderParams& GetFontRenderParams() override;
diff --git a/ui/gfx/platform_font_win.cc b/ui/gfx/platform_font_win.cc index 478e45e..3fa1041e3 100644 --- a/ui/gfx/platform_font_win.cc +++ b/ui/gfx/platform_font_win.cc
@@ -326,7 +326,7 @@ return font_ref_->font_name(); } -std::string PlatformFontWin::GetActualFontNameForTesting() const { +std::string PlatformFontWin::GetActualFontName() const { // With the current implementation on Windows, HFontRef::font_name() returns // the font name taken from the HFONT handle, but it's not the name that comes // from the font's metadata. See http://crbug.com/327287
diff --git a/ui/gfx/platform_font_win.h b/ui/gfx/platform_font_win.h index b4e538e..70caaa2 100644 --- a/ui/gfx/platform_font_win.h +++ b/ui/gfx/platform_font_win.h
@@ -51,7 +51,7 @@ int GetExpectedTextWidth(int length) override; int GetStyle() const override; const std::string& GetFontName() const override; - std::string GetActualFontNameForTesting() const override; + std::string GetActualFontName() const override; int GetFontSize() const override; const FontRenderParams& GetFontRenderParams() override; NativeFont GetNativeFont() const;
diff --git a/ui/gfx/render_text_harfbuzz.cc b/ui/gfx/render_text_harfbuzz.cc index f84ee50..2dfd4fe 100644 --- a/ui/gfx/render_text_harfbuzz.cc +++ b/ui/gfx/render_text_harfbuzz.cc
@@ -849,8 +849,7 @@ << ", rtl: " << font_params.is_rtl << "," << " level: '" << font_params.level << "', script: " << font_params.script << "," - << " font: '" << font_params.font.GetActualFontNameForTesting() - << "'," + << " font: '" << font_params.font.GetActualFontName() << "'," << " glyph_count: " << shape.glyph_count << ", pos: " << pos << "," << " glyph_to_char: " << glyph_to_char_string;
diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc index b5530465..4158ce5 100644 --- a/ui/gfx/render_text_unittest.cc +++ b/ui/gfx/render_text_unittest.cc
@@ -2958,10 +2958,10 @@ // kTestFontName, but on Android it does not. Font test_font(kTestFontName, 16); ASSERT_EQ(base::ToLowerASCII(kTestFontName), - base::ToLowerASCII(test_font.GetActualFontNameForTesting())); + base::ToLowerASCII(test_font.GetActualFontName())); Font cjk_font(kCJKFontName, 16); ASSERT_EQ(base::ToLowerASCII(kCJKFontName), - base::ToLowerASCII(cjk_font.GetActualFontNameForTesting())); + base::ToLowerASCII(cjk_font.GetActualFontName())); // "a" should be rendered with the test font, not with the CJK font. const char* test_font_text = "a"; // "円" (U+5168 Han character YEN) should render with the CJK font, not @@ -4761,9 +4761,9 @@ const std::vector<Font>& fonts = font_list.GetFonts(); ASSERT_EQ(2u, fonts.size()); ASSERT_EQ(base::ToLowerASCII(kTestFontName), - base::ToLowerASCII(fonts[0].GetActualFontNameForTesting())); + base::ToLowerASCII(fonts[0].GetActualFontName())); ASSERT_EQ(base::ToLowerASCII(kSymbolFontName), - base::ToLowerASCII(fonts[1].GetActualFontNameForTesting())); + base::ToLowerASCII(fonts[1].GetActualFontName())); // "⊕" (U+2295, CIRCLED PLUS) should be rendered with Symbol rather than // falling back to some other font that's present on the system.
diff --git a/ui/ozone/demo/ozone_demo.cc b/ui/ozone/demo/ozone_demo.cc index 005b89b..8be648b 100644 --- a/ui/ozone/demo/ozone_demo.cc +++ b/ui/ozone/demo/ozone_demo.cc
@@ -8,6 +8,7 @@ #include "base/at_exit.h" #include "base/command_line.h" #include "base/debug/stack_trace.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "base/task/thread_pool/thread_pool.h" @@ -70,8 +71,7 @@ mojo::core::Init(); - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); base::ThreadPoolInstance::CreateAndStartWithDefaultParams("OzoneDemo"); ui::OzonePlatform::InitParams params;
diff --git a/ui/ozone/demo/skia/skia_demo.cc b/ui/ozone/demo/skia/skia_demo.cc index 4610ad4f8..b6b68762 100644 --- a/ui/ozone/demo/skia/skia_demo.cc +++ b/ui/ozone/demo/skia/skia_demo.cc
@@ -8,6 +8,7 @@ #include "base/at_exit.h" #include "base/command_line.h" #include "base/debug/stack_trace.h" +#include "base/message_loop/message_pump_type.h" #include "base/run_loop.h" #include "base/task/single_thread_task_executor.h" #include "base/task/thread_pool/thread_pool.h" @@ -45,8 +46,7 @@ // Build UI thread task executor. This is used by platform // implementations for event polling & running background tasks. - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); base::ThreadPoolInstance::CreateAndStartWithDefaultParams("SkiaDemo"); ui::OzonePlatform::InitParams params;
diff --git a/ui/ozone/platform/wayland/wayland_buffer_fuzzer.cc b/ui/ozone/platform/wayland/wayland_buffer_fuzzer.cc index 310d46e..463b773 100644 --- a/ui/ozone/platform/wayland/wayland_buffer_fuzzer.cc +++ b/ui/ozone/platform/wayland/wayland_buffer_fuzzer.cc
@@ -13,6 +13,7 @@ #include "base/files/file_path.h" #include "base/files/file_util.h" +#include "base/message_loop/message_pump_type.h" #include "base/task/single_thread_task_executor.h" #include "testing/gmock/include/gmock/gmock.h" #include "third_party/libFuzzer/src/utils/FuzzedDataProvider.h" @@ -61,8 +62,7 @@ DRM_FORMAT_XRGB2101010, DRM_FORMAT_XBGR2101010, DRM_FORMAT_RGB565, DRM_FORMAT_UYVY, DRM_FORMAT_NV12, DRM_FORMAT_YVU420}; - base::SingleThreadTaskExecutor main_task_executor( - base::MessagePump::Type::UI); + base::SingleThreadTaskExecutor main_task_executor(base::MessagePumpType::UI); MockPlatformWindowDelegate delegate; std::unique_ptr<ui::WaylandConnection> connection =
diff --git a/ui/strings/ui_strings.grd b/ui/strings/ui_strings.grd index 5b1013e4..5dfb97992 100644 --- a/ui/strings/ui_strings.grd +++ b/ui/strings/ui_strings.grd
@@ -980,7 +980,7 @@ Can't send number </message> <message name="IDS_BROWSER_SHARING_CLICK_TO_CALL_DIALOG_HELP_TEXT_NO_DEVICES" desc="The label to be shown as a help text of the dialog when user click on a phone number, if there are no phones to choose from."> - To send a number from here to your phone, <ph name="TROUBLESHOOT_LINK">$1<ex>turn on sync</ex></ph> for both devices in settings. + To send a number from here to your Android phone, <ph name="TROUBLESHOOT_LINK">$1<ex>turn on sync</ex></ph> for both devices in settings. </message> <message name="IDS_BROWSER_SHARING_CLICK_TO_CALL_DIALOG_TROUBLESHOOT_LINK" desc="The label to be shown on the dialog when user click on a phone number for the link to a help page to turn on sync."> turn on sync
diff --git a/ui/strings/ui_strings_grd/IDS_BROWSER_SHARING_CLICK_TO_CALL_DIALOG_HELP_TEXT_NO_DEVICES.png.sha1 b/ui/strings/ui_strings_grd/IDS_BROWSER_SHARING_CLICK_TO_CALL_DIALOG_HELP_TEXT_NO_DEVICES.png.sha1 index 6ef4ea9..e248058 100644 --- a/ui/strings/ui_strings_grd/IDS_BROWSER_SHARING_CLICK_TO_CALL_DIALOG_HELP_TEXT_NO_DEVICES.png.sha1 +++ b/ui/strings/ui_strings_grd/IDS_BROWSER_SHARING_CLICK_TO_CALL_DIALOG_HELP_TEXT_NO_DEVICES.png.sha1
@@ -1 +1 @@ -a5eae26416ab8f82745704c4f1e6610181f7353c \ No newline at end of file +7e22e64a75f074df199380752b3ceef4cbc76758 \ No newline at end of file