diff --git a/DEPS b/DEPS index ac3b919..d385cbf5 100644 --- a/DEPS +++ b/DEPS
@@ -40,7 +40,7 @@ # 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': 'e29ce641d378022a18f1dac731a71784b3eb5a11', + 'skia_revision': '0e8fc8b9e6a138cf4a66b421fb824679df717329', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. @@ -96,7 +96,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': 'df2363501bd70a2c99ac8a0307a1b864cedf7db6', + 'catapult_revision': '707aaac64b3c0a86d253e1ab502e73996d63927e', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other.
diff --git a/android_webview/BUILD.gn b/android_webview/BUILD.gn index 1d91d4e..6b17fd1 100644 --- a/android_webview/BUILD.gn +++ b/android_webview/BUILD.gn
@@ -396,6 +396,8 @@ "browser/net/aw_url_request_context_getter.h", "browser/net/aw_url_request_job_factory.cc", "browser/net/aw_url_request_job_factory.h", + "browser/net/aw_web_resource_request.cc", + "browser/net/aw_web_resource_request.h", "browser/net/aw_web_resource_response.h", "browser/net/init_native_callback.h", "browser/net/input_stream_reader.cc",
diff --git a/android_webview/browser/aw_contents_client_bridge_base.h b/android_webview/browser/aw_contents_client_bridge_base.h index c3834c6..3a60dbc 100644 --- a/android_webview/browser/aw_contents_client_bridge_base.h +++ b/android_webview/browser/aw_contents_client_bridge_base.h
@@ -7,10 +7,12 @@ #include <memory> +#include "android_webview/browser/net/aw_web_resource_request.h" #include "base/supports_user_data.h" #include "content/public/browser/certificate_request_result_type.h" #include "content/public/browser/javascript_dialog_manager.h" #include "content/public/browser/resource_request_info.h" +#include "net/http/http_response_headers.h" class GURL; @@ -87,6 +89,17 @@ virtual void NewLoginRequest(const std::string& realm, const std::string& account, const std::string& args) = 0; + + // Called when a resource loading error has occured (e.g. an I/O error, + // host name lookup failure etc.) + virtual void OnReceivedError(const AwWebResourceRequest& request, + int error_code) = 0; + + // Called when a response from the server is received with status code >= 400. + virtual void OnReceivedHttpError( + const AwWebResourceRequest& request, + const scoped_refptr<const net::HttpResponseHeaders>& + response_headers) = 0; }; } // namespace android_webview
diff --git a/android_webview/browser/aw_contents_io_thread_client.h b/android_webview/browser/aw_contents_io_thread_client.h index 82968ed..e9a0bf34 100644 --- a/android_webview/browser/aw_contents_io_thread_client.h +++ b/android_webview/browser/aw_contents_io_thread_client.h
@@ -13,7 +13,6 @@ #include "base/callback_forward.h" namespace net { -class HttpResponseHeaders; class URLRequest; } @@ -95,15 +94,6 @@ // Retrieve the AcceptThirdPartyCookies setting value of this AwContents. virtual bool ShouldAcceptThirdPartyCookies() const = 0; - - // Called when a resource loading error has occured (e.g. an I/O error, - // host name lookup failure etc.) - virtual void OnReceivedError(const net::URLRequest* request) = 0; - - // Called when a response from the server is received with status code >= 400. - virtual void OnReceivedHttpError( - const net::URLRequest* request, - const net::HttpResponseHeaders* response_headers) = 0; }; } // namespace android_webview
diff --git a/android_webview/browser/net/aw_network_delegate.cc b/android_webview/browser/net/aw_network_delegate.cc index e7bb30c..934e788 100644 --- a/android_webview/browser/net/aw_network_delegate.cc +++ b/android_webview/browser/net/aw_network_delegate.cc
@@ -5,8 +5,10 @@ #include "android_webview/browser/net/aw_network_delegate.h" #include "android_webview/browser/aw_browser_context.h" +#include "android_webview/browser/aw_contents_client_bridge_base.h" #include "android_webview/browser/aw_contents_io_thread_client.h" #include "android_webview/browser/aw_cookie_access_policy.h" +#include "android_webview/browser/net/aw_web_resource_request.h" #include "base/android/build_info.h" #include "components/policy/core/browser/url_blacklist_manager.h" #include "content/public/browser/browser_thread.h" @@ -22,6 +24,21 @@ namespace android_webview { +namespace { + +void OnReceivedHttpErrorOnUiThread( + const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter, + const AwWebResourceRequest& request, + scoped_refptr<const net::HttpResponseHeaders> original_response_headers) { + AwContentsClientBridgeBase* client = + AwContentsClientBridgeBase::FromWebContentsGetter(web_contents_getter); + if (!client) + return; + client->OnReceivedHttpError(request, original_response_headers); +} + +} // namespace + AwNetworkDelegate::AwNetworkDelegate() : url_blacklist_manager_(nullptr) { } @@ -64,15 +81,17 @@ scoped_refptr<net::HttpResponseHeaders>* override_response_headers, GURL* allowed_unsafe_redirect_url) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - int render_process_id, render_frame_id; - if (original_response_headers->response_code() >= 400 && - content::ResourceRequestInfo::GetRenderFrameForRequest( - request, &render_process_id, &render_frame_id)) { - std::unique_ptr<AwContentsIoThreadClient> io_thread_client = - AwContentsIoThreadClient::FromID(render_process_id, render_frame_id); - if (io_thread_client.get()) { - io_thread_client->OnReceivedHttpError(request, original_response_headers); - } + if (original_response_headers->response_code() >= 400) { + const content::ResourceRequestInfo* request_info = + content::ResourceRequestInfo::ForRequest(request); + // keep a ref before binding and posting to UI thread. + scoped_refptr<const net::HttpResponseHeaders> response_headers( + original_response_headers); + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + base::Bind(&OnReceivedHttpErrorOnUiThread, + request_info->GetWebContentsGetterForRequest(), + AwWebResourceRequest(*request), response_headers)); } return net::OK; }
diff --git a/android_webview/browser/net/aw_web_resource_request.cc b/android_webview/browser/net/aw_web_resource_request.cc new file mode 100644 index 0000000..20f8e7c --- /dev/null +++ b/android_webview/browser/net/aw_web_resource_request.cc
@@ -0,0 +1,58 @@ +// 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. + +#include "android_webview/browser/net/aw_web_resource_request.h" + +#include "content/public/browser/resource_request_info.h" +#include "net/http/http_request_headers.h" +#include "net/http/http_response_headers.h" +#include "net/url_request/url_request.h" + +using base::android::ConvertJavaStringToUTF16; +using base::android::ConvertUTF8ToJavaString; +using base::android::ConvertUTF16ToJavaString; +using base::android::ToJavaArrayOfStrings; + +namespace android_webview { + +AwWebResourceRequest::AwWebResourceRequest(const net::URLRequest& request) + : url(request.url().spec()), method(request.method()) { + const content::ResourceRequestInfo* info = + content::ResourceRequestInfo::ForRequest(&request); + is_main_frame = + info && info->GetResourceType() == content::RESOURCE_TYPE_MAIN_FRAME; + has_user_gesture = info && info->HasUserGesture(); + + net::HttpRequestHeaders headers; + if (!request.GetFullRequestHeaders(&headers)) + headers = request.extra_request_headers(); + net::HttpRequestHeaders::Iterator headers_iterator(headers); + while (headers_iterator.GetNext()) { + header_names.push_back(headers_iterator.name()); + header_values.push_back(headers_iterator.value()); + } +} + +AwWebResourceRequest::AwWebResourceRequest(AwWebResourceRequest&& other) = + default; +AwWebResourceRequest& AwWebResourceRequest::operator=( + AwWebResourceRequest&& other) = default; +AwWebResourceRequest::~AwWebResourceRequest() = default; + +AwWebResourceRequest::AwJavaWebResourceRequest::AwJavaWebResourceRequest() = + default; +AwWebResourceRequest::AwJavaWebResourceRequest::~AwJavaWebResourceRequest() = + default; + +// static +void AwWebResourceRequest::ConvertToJava(JNIEnv* env, + const AwWebResourceRequest& request, + AwJavaWebResourceRequest* jRequest) { + jRequest->jurl = ConvertUTF8ToJavaString(env, request.url); + jRequest->jmethod = ConvertUTF8ToJavaString(env, request.method); + jRequest->jheader_names = ToJavaArrayOfStrings(env, request.header_names); + jRequest->jheader_values = ToJavaArrayOfStrings(env, request.header_values); +} + +} // namespace android_webview
diff --git a/android_webview/browser/net/aw_web_resource_request.h b/android_webview/browser/net/aw_web_resource_request.h new file mode 100644 index 0000000..53dca70 --- /dev/null +++ b/android_webview/browser/net/aw_web_resource_request.h
@@ -0,0 +1,57 @@ +// 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. + +#ifndef ANDROID_WEBVIEW_BROWSER_NET_AW_WEB_RESOURCE_REQUEST_H_ +#define ANDROID_WEBVIEW_BROWSER_NET_AW_WEB_RESOURCE_REQUEST_H_ + +#include <string> +#include <vector> + +#include "base/android/jni_array.h" +#include "base/android/jni_string.h" + +namespace net { +class URLRequest; +} + +namespace android_webview { + +// A passive data structure only used to carry request information. This +// class should be copyable. +struct AwWebResourceRequest final { + explicit AwWebResourceRequest(const net::URLRequest& request); + + // Add default copy/move/assign operators. Adding explicit destructor + // prevents generating move operator. + AwWebResourceRequest(AwWebResourceRequest&& other); + AwWebResourceRequest& operator=(AwWebResourceRequest&& other); + ~AwWebResourceRequest(); + + // The java equivalent + struct AwJavaWebResourceRequest { + AwJavaWebResourceRequest(); + ~AwJavaWebResourceRequest(); + + base::android::ScopedJavaLocalRef<jstring> jurl; + base::android::ScopedJavaLocalRef<jstring> jmethod; + base::android::ScopedJavaLocalRef<jobjectArray> jheader_names; + base::android::ScopedJavaLocalRef<jobjectArray> jheader_values; + }; + + // Convenience method to convert AwWebResourceRequest to Java equivalent. + static void ConvertToJava(JNIEnv* env, + const AwWebResourceRequest& request, + AwJavaWebResourceRequest* jRequest); + + std::string url; + std::string method; + bool is_main_frame; + bool has_user_gesture; + std::vector<std::string> header_names; + std::vector<std::string> header_values; +}; + +} // namespace android_webview + +#endif // ANDROID_WEBVIEW_BROWSER_NET_AW_WEB_RESOURCE_REQUEST_H_
diff --git a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc index 435ac16..c995084 100644 --- a/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc +++ b/android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.cc
@@ -12,6 +12,7 @@ #include "android_webview/browser/aw_contents_io_thread_client.h" #include "android_webview/browser/aw_login_delegate.h" #include "android_webview/browser/aw_resource_context.h" +#include "android_webview/browser/net/aw_web_resource_request.h" #include "android_webview/browser/renderer_host/auto_login_parser.h" #include "android_webview/common/url_constants.h" #include "base/memory/scoped_vector.h" @@ -32,6 +33,7 @@ using android_webview::AwContentsIoThreadClient; using android_webview::AwContentsClientBridgeBase; +using android_webview::AwWebResourceRequest; using content::BrowserThread; using content::ResourceType; using content::WebContents; @@ -84,6 +86,20 @@ client->NewLoginRequest(realm, account, args); } +void OnReceivedErrorOnUiThread( + const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter, + const AwWebResourceRequest& request, + int error_code) { + AwContentsClientBridgeBase* client = + AwContentsClientBridgeBase::FromWebContentsGetter(web_contents_getter); + if (!client) { + DLOG(WARNING) << "io_client is null, onReceivedError dropped for " + << request.url; + return; + } + client->OnReceivedError(request, error_code); +} + } // namespace namespace android_webview { @@ -285,19 +301,15 @@ if (request && !request->status().is_success()) { const content::ResourceRequestInfo* request_info = content::ResourceRequestInfo::ForRequest(request); - std::unique_ptr<AwContentsIoThreadClient> io_client = - AwContentsIoThreadClient::FromID(request_info->GetChildID(), - request_info->GetRenderFrameID()); - if (io_client) { - io_client->OnReceivedError(request); - } else { - DLOG(WARNING) << "io_client is null, onReceivedError dropped for " << - request->url(); - } + + BrowserThread::PostTask( + BrowserThread::UI, FROM_HERE, + base::Bind(&OnReceivedErrorOnUiThread, + request_info->GetWebContentsGetterForRequest(), + AwWebResourceRequest(*request), request->status().error())); } } - void AwResourceDispatcherHostDelegate::DownloadStarting( net::URLRequest* request, content::ResourceContext* resource_context,
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java index 27eb4f4..71f6033 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -73,7 +73,6 @@ import org.chromium.content_public.browser.navigation_controller.LoadURLType; import org.chromium.content_public.browser.navigation_controller.UserAgentOverrideOption; import org.chromium.content_public.common.Referrer; -import org.chromium.net.NetError; import org.chromium.net.NetworkChangeNotifier; import org.chromium.ui.base.ActivityWindowAndroid; import org.chromium.ui.base.PageTransition; @@ -471,37 +470,6 @@ public boolean shouldAcceptThirdPartyCookies() { return mSettings.getAcceptThirdPartyCookies(); } - - @Override - public void onReceivedError(AwContentsClient.AwWebResourceRequest request, - AwContentsClient.AwWebResourceError error) { - String unreachableWebDataUrl = AwContentsStatics.getUnreachableWebDataUrl(); - boolean isErrorUrl = - unreachableWebDataUrl != null && unreachableWebDataUrl.equals(request.url); - if (!isErrorUrl && error.errorCode != NetError.ERR_ABORTED) { - // NetError.ERR_ABORTED error code is generated for the following reasons: - // - WebView.stopLoading is called; - // - the navigation is intercepted by the embedder via shouldOverrideUrlLoading; - // - server returned 204 status (no content). - // - // Android WebView does not notify the embedder of these situations using - // this error code with the WebViewClient.onReceivedError callback. - error.errorCode = ErrorCodeConversionHelper.convertErrorCode(error.errorCode); - mContentsClient.getCallbackHelper().postOnReceivedError(request, error); - if (request.isMainFrame) { - // Need to call onPageFinished after onReceivedError for backwards compatibility - // with the classic webview. See also AwWebContentsObserver.didFailLoad which is - // used when we want to send onPageFinished alone. - mContentsClient.getCallbackHelper().postOnPageFinished(request.url); - } - } - } - - @Override - public void onReceivedHttpError(AwContentsClient.AwWebResourceRequest request, - AwWebResourceResponse response) { - mContentsClient.getCallbackHelper().postOnReceivedHttpError(request, response); - } } private class BackgroundThreadClientImpl extends AwContentsBackgroundThreadClient {
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java b/android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java index b415e95..a294913 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java
@@ -14,11 +14,14 @@ import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.CalledByNativeUnchecked; import org.chromium.base.annotations.JNINamespace; +import org.chromium.net.NetError; import java.security.Principal; import java.security.PrivateKey; import java.security.cert.CertificateEncodingException; import java.security.cert.X509Certificate; +import java.util.HashMap; +import java.util.Map; import javax.security.auth.x500.X500Principal; @@ -259,10 +262,90 @@ } @CalledByNative - public void newLoginRequest(String realm, String account, String args) { + private void newLoginRequest(String realm, String account, String args) { mClient.getCallbackHelper().postOnReceivedLoginRequest(realm, account, args); } + @CalledByNative + private void onReceivedError( + // WebResourceRequest + String url, boolean isMainFrame, boolean hasUserGesture, String method, + String[] requestHeaderNames, String[] requestHeaderValues, + // WebResourceError + int errorCode, String description) { + AwContentsClient.AwWebResourceRequest request = new AwContentsClient.AwWebResourceRequest(); + request.url = url; + request.isMainFrame = isMainFrame; + request.hasUserGesture = hasUserGesture; + request.method = method; + request.requestHeaders = new HashMap<String, String>(requestHeaderNames.length); + for (int i = 0; i < requestHeaderNames.length; ++i) { + request.requestHeaders.put(requestHeaderNames[i], requestHeaderValues[i]); + } + AwContentsClient.AwWebResourceError error = new AwContentsClient.AwWebResourceError(); + error.errorCode = errorCode; + error.description = description; + + String unreachableWebDataUrl = AwContentsStatics.getUnreachableWebDataUrl(); + boolean isErrorUrl = + unreachableWebDataUrl != null && unreachableWebDataUrl.equals(request.url); + + if (!isErrorUrl && error.errorCode != NetError.ERR_ABORTED) { + // NetError.ERR_ABORTED error code is generated for the following reasons: + // - WebView.stopLoading is called; + // - the navigation is intercepted by the embedder via shouldOverrideUrlLoading; + // - server returned 204 status (no content). + // + // Android WebView does not notify the embedder of these situations using + // this error code with the WebViewClient.onReceivedError callback. + error.errorCode = ErrorCodeConversionHelper.convertErrorCode(error.errorCode); + mClient.getCallbackHelper().postOnReceivedError(request, error); + if (request.isMainFrame) { + // Need to call onPageFinished after onReceivedError for backwards compatibility + // with the classic webview. See also AwWebContentsObserver.didFailLoad which is + // used when we want to send onPageFinished alone. + mClient.getCallbackHelper().postOnPageFinished(request.url); + } + } + } + + @CalledByNative + private void onReceivedHttpError( + // WebResourceRequest + String url, boolean isMainFrame, boolean hasUserGesture, String method, + String[] requestHeaderNames, String[] requestHeaderValues, + // WebResourceResponse + String mimeType, String encoding, int statusCode, String reasonPhrase, + String[] responseHeaderNames, String[] responseHeaderValues) { + AwContentsClient.AwWebResourceRequest request = new AwContentsClient.AwWebResourceRequest(); + request.url = url; + request.isMainFrame = isMainFrame; + request.hasUserGesture = hasUserGesture; + request.method = method; + request.requestHeaders = new HashMap<String, String>(requestHeaderNames.length); + for (int i = 0; i < requestHeaderNames.length; ++i) { + request.requestHeaders.put(requestHeaderNames[i], requestHeaderValues[i]); + } + Map<String, String> responseHeaders = + new HashMap<String, String>(responseHeaderNames.length); + // Note that we receive un-coalesced response header lines, thus we need to combine + // values for the same header. + for (int i = 0; i < responseHeaderNames.length; ++i) { + if (!responseHeaders.containsKey(responseHeaderNames[i])) { + responseHeaders.put(responseHeaderNames[i], responseHeaderValues[i]); + } else if (!responseHeaderValues[i].isEmpty()) { + String currentValue = responseHeaders.get(responseHeaderNames[i]); + if (!currentValue.isEmpty()) { + currentValue += ", "; + } + responseHeaders.put(responseHeaderNames[i], currentValue + responseHeaderValues[i]); + } + } + AwWebResourceResponse response = new AwWebResourceResponse( + mimeType, encoding, null, statusCode, reasonPhrase, responseHeaders); + mClient.getCallbackHelper().postOnReceivedHttpError(request, response); + } + @CalledByNativeUnchecked private boolean shouldOverrideUrlLoading( String url, boolean hasUserGesture, boolean isRedirect, boolean isMainFrame) {
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentsIoThreadClient.java b/android_webview/java/src/org/chromium/android_webview/AwContentsIoThreadClient.java index db658ed..bd972fe 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContentsIoThreadClient.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContentsIoThreadClient.java
@@ -7,9 +7,6 @@ import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; -import java.util.HashMap; -import java.util.Map; - /** * Delegate for handling callbacks. All methods are called on the IO thread. * @@ -35,73 +32,4 @@ @CalledByNative public abstract AwContentsBackgroundThreadClient getBackgroundThreadClient(); - - public abstract void onReceivedError(AwContentsClient.AwWebResourceRequest request, - AwContentsClient.AwWebResourceError error); - - public abstract void onReceivedHttpError(AwContentsClient.AwWebResourceRequest request, - AwWebResourceResponse response); - - // Protected methods --------------------------------------------------------------------------- - - @CalledByNative - protected void onReceivedError( - // WebResourceRequest - String url, boolean isMainFrame, boolean hasUserGesture, String method, - String[] requestHeaderNames, String[] requestHeaderValues, - // WebResourceError - int errorCode, String description) { - AwContentsClient.AwWebResourceRequest request = - new AwContentsClient.AwWebResourceRequest(); - request.url = url; - request.isMainFrame = isMainFrame; - request.hasUserGesture = hasUserGesture; - request.method = method; - request.requestHeaders = new HashMap<String, String>(requestHeaderNames.length); - for (int i = 0; i < requestHeaderNames.length; ++i) { - request.requestHeaders.put(requestHeaderNames[i], requestHeaderValues[i]); - } - AwContentsClient.AwWebResourceError error = new AwContentsClient.AwWebResourceError(); - error.errorCode = errorCode; - error.description = description; - onReceivedError(request, error); - } - - @CalledByNative - protected void onReceivedHttpError( - // WebResourceRequest - String url, boolean isMainFrame, boolean hasUserGesture, String method, - String[] requestHeaderNames, String[] requestHeaderValues, - // WebResourceResponse - String mimeType, String encoding, int statusCode, String reasonPhrase, - String[] responseHeaderNames, String[] responseHeaderValues) { - AwContentsClient.AwWebResourceRequest request = - new AwContentsClient.AwWebResourceRequest(); - request.url = url; - request.isMainFrame = isMainFrame; - request.hasUserGesture = hasUserGesture; - request.method = method; - request.requestHeaders = new HashMap<String, String>(requestHeaderNames.length); - for (int i = 0; i < requestHeaderNames.length; ++i) { - request.requestHeaders.put(requestHeaderNames[i], requestHeaderValues[i]); - } - Map<String, String> responseHeaders = - new HashMap<String, String>(responseHeaderNames.length); - // Note that we receive un-coalesced response header lines, thus we need to combine - // values for the same header. - for (int i = 0; i < responseHeaderNames.length; ++i) { - if (!responseHeaders.containsKey(responseHeaderNames[i])) { - responseHeaders.put(responseHeaderNames[i], responseHeaderValues[i]); - } else if (!responseHeaderValues[i].isEmpty()) { - String currentValue = responseHeaders.get(responseHeaderNames[i]); - if (!currentValue.isEmpty()) { - currentValue += ", "; - } - responseHeaders.put(responseHeaderNames[i], currentValue + responseHeaderValues[i]); - } - } - AwWebResourceResponse response = new AwWebResourceResponse( - mimeType, encoding, null, statusCode, reasonPhrase, responseHeaders); - onReceivedHttpError(request, response); - } }
diff --git a/android_webview/java/src/org/chromium/android_webview/AwServiceWorkerController.java b/android_webview/java/src/org/chromium/android_webview/AwServiceWorkerController.java index 532d6ca..a73f6cc 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwServiceWorkerController.java +++ b/android_webview/java/src/org/chromium/android_webview/AwServiceWorkerController.java
@@ -81,18 +81,6 @@ // see e.g. AwCookieAccessPolicy::GetShouldAcceptThirdPartyCookies. return false; } - - @Override - public void onReceivedError(AwContentsClient.AwWebResourceRequest request, - AwContentsClient.AwWebResourceError error) { - // TODO - } - - @Override - public void onReceivedHttpError(AwContentsClient.AwWebResourceRequest request, - AwWebResourceResponse response) { - // TODO - } } private class ServiceWorkerBackgroundThreadClientImpl
diff --git a/android_webview/native/aw_contents_client_bridge.cc b/android_webview/native/aw_contents_client_bridge.cc index c3c2c0b..f1d79baa 100644 --- a/android_webview/native/aw_contents_client_bridge.cc +++ b/android_webview/native/aw_contents_client_bridge.cc
@@ -23,6 +23,7 @@ #include "grit/components_strings.h" #include "jni/AwContentsClientBridge_jni.h" #include "net/cert/x509_certificate.h" +#include "net/http/http_response_headers.h" #include "net/ssl/openssl_client_key_store.h" #include "net/ssl/ssl_cert_request_info.h" #include "net/ssl/ssl_client_cert_type.h" @@ -38,7 +39,9 @@ using base::android::HasException; using base::android::JavaRef; using base::android::ScopedJavaLocalRef; +using base::android::ToJavaArrayOfStrings; using content::BrowserThread; +using std::vector; namespace android_webview { @@ -411,6 +414,77 @@ jargs); } +void AwContentsClientBridge::OnReceivedError( + const AwWebResourceRequest& request, + int error_code) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + JNIEnv* env = AttachCurrentThread(); + ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); + if (obj.is_null()) + return; + + ScopedJavaLocalRef<jstring> jstring_description = + ConvertUTF8ToJavaString(env, net::ErrorToString(error_code)); + + AwWebResourceRequest::AwJavaWebResourceRequest java_web_resource_request; + AwWebResourceRequest::ConvertToJava(env, request, &java_web_resource_request); + + Java_AwContentsClientBridge_onReceivedError( + env, obj, java_web_resource_request.jurl, request.is_main_frame, + request.has_user_gesture, java_web_resource_request.jmethod, + java_web_resource_request.jheader_names, + java_web_resource_request.jheader_values, error_code, + jstring_description); +} + +void AwContentsClientBridge::OnReceivedHttpError( + const AwWebResourceRequest& request, + const scoped_refptr<const net::HttpResponseHeaders>& response_headers) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + JNIEnv* env = AttachCurrentThread(); + ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); + if (obj.is_null()) + return; + + AwWebResourceRequest::AwJavaWebResourceRequest java_web_resource_request; + AwWebResourceRequest::ConvertToJava(env, request, &java_web_resource_request); + + vector<std::string> response_header_names; + vector<std::string> response_header_values; + + { + size_t headers_iterator = 0; + std::string header_name, header_value; + while (response_headers->EnumerateHeaderLines( + &headers_iterator, &header_name, &header_value)) { + response_header_names.push_back(header_name); + response_header_values.push_back(header_value); + } + } + + std::string mime_type, encoding; + response_headers->GetMimeTypeAndCharset(&mime_type, &encoding); + ScopedJavaLocalRef<jstring> jstring_mime_type = + ConvertUTF8ToJavaString(env, mime_type); + ScopedJavaLocalRef<jstring> jstring_encoding = + ConvertUTF8ToJavaString(env, encoding); + int status_code = response_headers->response_code(); + ScopedJavaLocalRef<jstring> jstring_reason = + ConvertUTF8ToJavaString(env, response_headers->GetStatusText()); + ScopedJavaLocalRef<jobjectArray> jstringArray_response_header_names = + ToJavaArrayOfStrings(env, response_header_names); + ScopedJavaLocalRef<jobjectArray> jstringArray_response_header_values = + ToJavaArrayOfStrings(env, response_header_values); + + Java_AwContentsClientBridge_onReceivedHttpError( + env, obj, java_web_resource_request.jurl, request.is_main_frame, + request.has_user_gesture, java_web_resource_request.jmethod, + java_web_resource_request.jheader_names, + java_web_resource_request.jheader_values, jstring_mime_type, + jstring_encoding, status_code, jstring_reason, + jstringArray_response_header_names, jstringArray_response_header_values); +} + void AwContentsClientBridge::ConfirmJsResult(JNIEnv* env, const JavaRef<jobject>&, int id,
diff --git a/android_webview/native/aw_contents_client_bridge.h b/android_webview/native/aw_contents_client_bridge.h index 0b4091e..da8909ca 100644 --- a/android_webview/native/aw_contents_client_bridge.h +++ b/android_webview/native/aw_contents_client_bridge.h
@@ -71,6 +71,13 @@ const std::string& account, const std::string& args) override; + void OnReceivedError(const AwWebResourceRequest& request, + int error_code) override; + + void OnReceivedHttpError(const AwWebResourceRequest& request, + const scoped_refptr<const net::HttpResponseHeaders>& + response_headers) override; + // Methods called from Java. void ProceedSslError(JNIEnv* env, const base::android::JavaRef<jobject>& obj,
diff --git a/android_webview/native/aw_contents_io_thread_client_impl.cc b/android_webview/native/aw_contents_io_thread_client_impl.cc index 63965db..225de649 100644 --- a/android_webview/native/aw_contents_io_thread_client_impl.cc +++ b/android_webview/native/aw_contents_io_thread_client_impl.cc
@@ -8,6 +8,7 @@ #include <memory> #include <utility> +#include "android_webview/browser/net/aw_web_resource_request.h" #include "android_webview/common/devtools_instrumentation.h" #include "android_webview/native/aw_contents_background_thread_client.h" #include "android_webview/native/aw_web_resource_response_impl.h" @@ -24,11 +25,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" #include "jni/AwContentsIoThreadClient_jni.h" -#include "net/base/net_errors.h" -#include "net/http/http_request_headers.h" -#include "net/http/http_response_headers.h" #include "net/url_request/url_request.h" -#include "url/gurl.h" using base::android::AttachCurrentThread; using base::android::ConvertUTF8ToJavaString; @@ -43,7 +40,6 @@ using std::map; using std::pair; using std::string; -using std::vector; namespace android_webview { @@ -158,51 +154,6 @@ delete this; } -struct WebResourceRequest { - std::string url; - std::string method; - bool is_main_frame; - bool has_user_gesture; - vector<string> header_names; - vector<string> header_values; - - ScopedJavaLocalRef<jstring> jstring_url; - ScopedJavaLocalRef<jstring> jstring_method; - ScopedJavaLocalRef<jobjectArray> jstringArray_header_names; - ScopedJavaLocalRef<jobjectArray> jstringArray_header_values; - - WebResourceRequest(const net::URLRequest* request) - : url(request->url().spec()), - method(request->method()) { - const content::ResourceRequestInfo* info = - content::ResourceRequestInfo::ForRequest(request); - is_main_frame = - info && info->GetResourceType() == content::RESOURCE_TYPE_MAIN_FRAME; - has_user_gesture = info && info->HasUserGesture(); - - net::HttpRequestHeaders headers; - if (!request->GetFullRequestHeaders(&headers)) - headers = request->extra_request_headers(); - net::HttpRequestHeaders::Iterator headers_iterator(headers); - while (headers_iterator.GetNext()) { - header_names.push_back(headers_iterator.name()); - header_values.push_back(headers_iterator.value()); - } - } - - WebResourceRequest(JNIEnv* env, const net::URLRequest* request) - : WebResourceRequest(request) { - ConvertToJava(env); - } - - void ConvertToJava(JNIEnv* env) { - jstring_url = ConvertUTF8ToJavaString(env, url); - jstring_method = ConvertUTF8ToJavaString(env, method); - jstringArray_header_names = ToJavaArrayOfStrings(env, header_names); - jstringArray_header_values = ToJavaArrayOfStrings(env, header_values); - } -}; - } // namespace // AwContentsIoThreadClientImpl ----------------------------------------------- @@ -313,7 +264,7 @@ namespace { std::unique_ptr<AwWebResourceResponse> RunShouldInterceptRequest( - WebResourceRequest web_request, + const AwWebResourceRequest& request, JavaObjectWeakGlobalRef ref) { DCHECK_CURRENTLY_ON(BrowserThread::FILE); JNIEnv* env = AttachCurrentThread(); @@ -321,16 +272,17 @@ if (obj.is_null()) return nullptr; - web_request.ConvertToJava(env); + AwWebResourceRequest::AwJavaWebResourceRequest java_web_resource_request; + AwWebResourceRequest::ConvertToJava(env, request, &java_web_resource_request); devtools_instrumentation::ScopedEmbedderCallbackTask embedder_callback( "shouldInterceptRequest"); ScopedJavaLocalRef<jobject> ret = AwContentsBackgroundThreadClient::shouldInterceptRequest( - env, obj, web_request.jstring_url, web_request.is_main_frame, - web_request.has_user_gesture, web_request.jstring_method, - web_request.jstringArray_header_names, - web_request.jstringArray_header_values); + env, obj, java_web_resource_request.jurl, request.is_main_frame, + request.has_user_gesture, java_web_resource_request.jmethod, + java_web_resource_request.jheader_names, + java_web_resource_request.jheader_values); return std::unique_ptr<AwWebResourceResponse>( ret.is_null() ? nullptr : new AwWebResourceResponseImpl(ret)); } @@ -355,7 +307,7 @@ } if (!bg_thread_client_object_.is_null()) { get_response = base::Bind( - &RunShouldInterceptRequest, WebResourceRequest(request), + &RunShouldInterceptRequest, AwWebResourceRequest(*request), JavaObjectWeakGlobalRef(env, bg_thread_client_object_.obj())); } BrowserThread::PostTaskAndReplyWithResult(BrowserThread::FILE, FROM_HERE, @@ -401,69 +353,4 @@ java_object_); } -void AwContentsIoThreadClientImpl::OnReceivedError( - const net::URLRequest* request) { - DCHECK_CURRENTLY_ON(BrowserThread::IO); - if (java_object_.is_null()) - return; - - JNIEnv* env = AttachCurrentThread(); - WebResourceRequest web_request(env, request); - - int error_code = request->status().error(); - ScopedJavaLocalRef<jstring> jstring_description = ConvertUTF8ToJavaString( - env, net::ErrorToString(request->status().error())); - - Java_AwContentsIoThreadClient_onReceivedError( - env, java_object_, web_request.jstring_url, web_request.is_main_frame, - web_request.has_user_gesture, web_request.jstring_method, - web_request.jstringArray_header_names, - web_request.jstringArray_header_values, error_code, jstring_description); -} - -void AwContentsIoThreadClientImpl::OnReceivedHttpError( - const net::URLRequest* request, - const net::HttpResponseHeaders* response_headers) { - DCHECK_CURRENTLY_ON(BrowserThread::IO); - if (java_object_.is_null()) - return; - - JNIEnv* env = AttachCurrentThread(); - WebResourceRequest web_request(env, request); - - vector<string> response_header_names; - vector<string> response_header_values; - { - size_t headers_iterator = 0; - string header_name, header_value; - while (response_headers->EnumerateHeaderLines( - &headers_iterator, &header_name, &header_value)) { - response_header_names.push_back(header_name); - response_header_values.push_back(header_value); - } - } - - string mime_type, encoding; - response_headers->GetMimeTypeAndCharset(&mime_type, &encoding); - ScopedJavaLocalRef<jstring> jstring_mime_type = - ConvertUTF8ToJavaString(env, mime_type); - ScopedJavaLocalRef<jstring> jstring_encoding = - ConvertUTF8ToJavaString(env, encoding); - int status_code = response_headers->response_code(); - ScopedJavaLocalRef<jstring> jstring_reason = - ConvertUTF8ToJavaString(env, response_headers->GetStatusText()); - ScopedJavaLocalRef<jobjectArray> jstringArray_response_header_names = - ToJavaArrayOfStrings(env, response_header_names); - ScopedJavaLocalRef<jobjectArray> jstringArray_response_header_values = - ToJavaArrayOfStrings(env, response_header_values); - - Java_AwContentsIoThreadClient_onReceivedHttpError( - env, java_object_, web_request.jstring_url, web_request.is_main_frame, - web_request.has_user_gesture, web_request.jstring_method, - web_request.jstringArray_header_names, - web_request.jstringArray_header_values, jstring_mime_type, - jstring_encoding, status_code, jstring_reason, - jstringArray_response_header_names, jstringArray_response_header_values); -} - } // namespace android_webview
diff --git a/android_webview/native/aw_contents_io_thread_client_impl.h b/android_webview/native/aw_contents_io_thread_client_impl.h index 41f365e..fb33e7e5 100644 --- a/android_webview/native/aw_contents_io_thread_client_impl.h +++ b/android_webview/native/aw_contents_io_thread_client_impl.h
@@ -55,10 +55,6 @@ bool ShouldBlockFileUrls() const override; bool ShouldAcceptThirdPartyCookies() const override; bool ShouldBlockNetworkLoads() const override; - void OnReceivedError(const net::URLRequest* request) override; - void OnReceivedHttpError( - const net::URLRequest* request, - const net::HttpResponseHeaders* response_headers) override; private: bool pending_association_;
diff --git a/base/trace_event/trace_event.h b/base/trace_event/trace_event.h index 0299ddd..fe8f657 100644 --- a/base/trace_event/trace_event.h +++ b/base/trace_event/trace_event.h
@@ -55,14 +55,14 @@ #define INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE() \ UNLIKELY(*INTERNAL_TRACE_EVENT_UID(category_group_enabled) & \ - (base::trace_event::TraceCategory::ENABLED_FOR_RECORDING | \ - base::trace_event::TraceCategory::ENABLED_FOR_ETW_EXPORT | \ - base::trace_event::TraceCategory::ENABLED_FOR_FILTERING)) + (base::trace_event::TraceCategory::ENABLED_FOR_RECORDING | \ + base::trace_event::TraceCategory::ENABLED_FOR_ETW_EXPORT)) -#define INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_FILTERING_MODE( \ - category_group_enabled) \ - UNLIKELY(category_group_enabled& \ - base::trace_event::TraceCategory::ENABLED_FOR_FILTERING) +#define INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED() \ + UNLIKELY(*INTERNAL_TRACE_EVENT_UID(category_group_enabled) & \ + (base::trace_event::TraceCategory::ENABLED_FOR_RECORDING | \ + base::trace_event::TraceCategory::ENABLED_FOR_ETW_EXPORT | \ + base::trace_event::TraceCategory::ENABLED_FOR_FILTERING)) //////////////////////////////////////////////////////////////////////////////// // Implementation specific tracing API definitions. @@ -171,14 +171,6 @@ #define TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION \ base::trace_event::TraceLog::GetInstance()->UpdateTraceEventDuration -// Call EndEvent on the filter for a filtered event. -// void TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( -// const unsigned char* category_group_enabled, -// const char* name, -// base::trace_event::TraceEventHandle id) -#define TRACE_EVENT_API_END_FILTERED_EVENT \ - base::trace_event::TraceLog::GetInstance()->EndFilteredEvent - // Adds a metadata event to the trace log. The |AppendValueAsTraceFormat| method // on the convertable value will be called at flush time. // TRACE_EVENT_API_ADD_METADATA_EVENT( @@ -236,43 +228,43 @@ // Implementation detail: internal macro to create static category and add // event if the category is enabled. -#define INTERNAL_TRACE_EVENT_ADD(phase, category_group, name, flags, ...) \ - do { \ - INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ - if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ - trace_event_internal::AddTraceEvent( \ - phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ - trace_event_internal::kGlobalScope, trace_event_internal::kNoId, \ - flags, trace_event_internal::kNoId, ##__VA_ARGS__); \ - } \ - } while (0) +#define INTERNAL_TRACE_EVENT_ADD(phase, category_group, name, flags, ...) \ + do { \ + INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ + if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED()) { \ + trace_event_internal::AddTraceEvent( \ + phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ + trace_event_internal::kGlobalScope, trace_event_internal::kNoId, \ + flags, trace_event_internal::kNoId, ##__VA_ARGS__); \ + } \ + } while (0) // Implementation detail: internal macro to create static category and add begin // event if the category is enabled. Also adds the end event when the scope // ends. -#define INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, ...) \ - INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ - trace_event_internal::ScopedTracer INTERNAL_TRACE_EVENT_UID(tracer); \ - if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ - base::trace_event::TraceEventHandle h = \ - trace_event_internal::AddTraceEvent( \ - TRACE_EVENT_PHASE_COMPLETE, \ - INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ - trace_event_internal::kGlobalScope, trace_event_internal::kNoId, \ - TRACE_EVENT_FLAG_NONE, trace_event_internal::kNoId, \ - ##__VA_ARGS__); \ - INTERNAL_TRACE_EVENT_UID(tracer).Initialize( \ - INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, h); \ - } - -#define INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW( \ - category_group, name, bind_id, flow_flags, ...) \ +#define INTERNAL_TRACE_EVENT_ADD_SCOPED(category_group, name, ...) \ INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ trace_event_internal::ScopedTracer INTERNAL_TRACE_EVENT_UID(tracer); \ - if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ + if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED()) { \ + base::trace_event::TraceEventHandle h = \ + trace_event_internal::AddTraceEvent( \ + TRACE_EVENT_PHASE_COMPLETE, \ + INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ + trace_event_internal::kGlobalScope, trace_event_internal::kNoId, \ + TRACE_EVENT_FLAG_NONE, trace_event_internal::kNoId, \ + ##__VA_ARGS__); \ + INTERNAL_TRACE_EVENT_UID(tracer).Initialize( \ + INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, h); \ + } + +#define INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category_group, name, \ + bind_id, flow_flags, ...) \ + INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ + trace_event_internal::ScopedTracer INTERNAL_TRACE_EVENT_UID(tracer); \ + if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED()) { \ trace_event_internal::TraceID trace_event_bind_id((bind_id)); \ - unsigned int trace_event_flags = flow_flags | \ - trace_event_bind_id.id_flags(); \ + unsigned int trace_event_flags = \ + flow_flags | trace_event_bind_id.id_flags(); \ base::trace_event::TraceEventHandle h = \ trace_event_internal::AddTraceEvent( \ TRACE_EVENT_PHASE_COMPLETE, \ @@ -285,20 +277,20 @@ // Implementation detail: internal macro to create static category and add // event if the category is enabled. -#define INTERNAL_TRACE_EVENT_ADD_WITH_ID(phase, category_group, name, id, \ - flags, ...) \ - do { \ - INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ - if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ - trace_event_internal::TraceID trace_event_trace_id((id)); \ - unsigned int trace_event_flags = flags | \ - trace_event_trace_id.id_flags(); \ - trace_event_internal::AddTraceEvent( \ - phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), \ - name, trace_event_trace_id.scope(), trace_event_trace_id.raw_id(), \ - trace_event_flags, trace_event_internal::kNoId, ##__VA_ARGS__); \ - } \ - } while (0) +#define INTERNAL_TRACE_EVENT_ADD_WITH_ID(phase, category_group, name, id, \ + flags, ...) \ + do { \ + INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ + if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED()) { \ + trace_event_internal::TraceID trace_event_trace_id((id)); \ + unsigned int trace_event_flags = \ + flags | trace_event_trace_id.id_flags(); \ + trace_event_internal::AddTraceEvent( \ + phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ + trace_event_trace_id.scope(), trace_event_trace_id.raw_id(), \ + trace_event_flags, trace_event_internal::kNoId, ##__VA_ARGS__); \ + } \ + } while (0) // Implementation detail: internal macro to create static category and add // event if the category is enabled. @@ -306,62 +298,62 @@ timestamp, flags, ...) \ do { \ INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ - if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ + if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED()) { \ trace_event_internal::AddTraceEventWithThreadIdAndTimestamp( \ phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ trace_event_internal::kGlobalScope, trace_event_internal::kNoId, \ - TRACE_EVENT_API_CURRENT_THREAD_ID, \ - timestamp, flags | TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP, \ + TRACE_EVENT_API_CURRENT_THREAD_ID, timestamp, \ + flags | TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP, \ trace_event_internal::kNoId, ##__VA_ARGS__); \ } \ } while (0) // Implementation detail: internal macro to create static category and add // event if the category is enabled. -#define INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ - phase, category_group, name, id, thread_id, timestamp, flags, ...) \ - do { \ - INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ - if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ - trace_event_internal::TraceID trace_event_trace_id((id)); \ - unsigned int trace_event_flags = flags | \ - trace_event_trace_id.id_flags(); \ - trace_event_internal::AddTraceEventWithThreadIdAndTimestamp( \ - phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ - trace_event_trace_id.scope(), trace_event_trace_id.raw_id(), \ - thread_id, timestamp, \ - trace_event_flags | TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP, \ - trace_event_internal::kNoId, ##__VA_ARGS__); \ - } \ +#define INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \ + phase, category_group, name, id, thread_id, timestamp, flags, ...) \ + do { \ + INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ + if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED()) { \ + trace_event_internal::TraceID trace_event_trace_id((id)); \ + unsigned int trace_event_flags = \ + flags | trace_event_trace_id.id_flags(); \ + trace_event_internal::AddTraceEventWithThreadIdAndTimestamp( \ + phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ + trace_event_trace_id.scope(), trace_event_trace_id.raw_id(), \ + thread_id, timestamp, \ + trace_event_flags | TRACE_EVENT_FLAG_EXPLICIT_TIMESTAMP, \ + trace_event_internal::kNoId, ##__VA_ARGS__); \ + } \ } while (0) // The linked ID will not be mangled. -#define INTERNAL_TRACE_EVENT_ADD_LINK_IDS(category_group, name, id1, id2) \ - do { \ - INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ - if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ - trace_event_internal::TraceID source_id((id1)); \ - unsigned int source_flags = source_id.id_flags(); \ - trace_event_internal::TraceID target_id((id2)); \ - trace_event_internal::AddTraceEvent( \ - TRACE_EVENT_PHASE_LINK_IDS, \ - INTERNAL_TRACE_EVENT_UID(category_group_enabled), \ - name, source_id.scope(), source_id.raw_id(), source_flags, \ - trace_event_internal::kNoId, \ - "linked_id", target_id.AsConvertableToTraceFormat()); \ - } \ - } while (0) +#define INTERNAL_TRACE_EVENT_ADD_LINK_IDS(category_group, name, id1, id2) \ + do { \ + INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ + if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED()) { \ + trace_event_internal::TraceID source_id((id1)); \ + unsigned int source_flags = source_id.id_flags(); \ + trace_event_internal::TraceID target_id((id2)); \ + trace_event_internal::AddTraceEvent( \ + TRACE_EVENT_PHASE_LINK_IDS, \ + INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ + source_id.scope(), source_id.raw_id(), source_flags, \ + trace_event_internal::kNoId, "linked_id", \ + target_id.AsConvertableToTraceFormat()); \ + } \ + } while (0) // Implementation detail: internal macro to create static category and add // metadata event if the category is enabled. -#define INTERNAL_TRACE_EVENT_METADATA_ADD(category_group, name, ...) \ - do { \ - INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ - if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \ - TRACE_EVENT_API_ADD_METADATA_EVENT( \ - INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ - ##__VA_ARGS__); \ - } \ +#define INTERNAL_TRACE_EVENT_METADATA_ADD(category_group, name, ...) \ + do { \ + INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ + if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED()) { \ + TRACE_EVENT_API_ADD_METADATA_EVENT( \ + INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ + ##__VA_ARGS__); \ + } \ } while (0) // Implementation detail: internal macro to enter and leave a
diff --git a/build/config/features.gni b/build/config/features.gni index f8da113..79d317b2 100644 --- a/build/config/features.gni +++ b/build/config/features.gni
@@ -91,8 +91,6 @@ enable_chromevox_next = false enable_configuration_policy = !is_ios - -enable_mac_keystone = is_mac && is_chrome_branded && is_official_build # # ============================================= # PLEASE DO NOT ADD MORE FLAGS TO THIS FILE
diff --git a/build/toolchain/win/tool_wrapper.py b/build/toolchain/win/tool_wrapper.py index 281298c..4e69dea 100644 --- a/build/toolchain/win/tool_wrapper.py +++ b/build/toolchain/win/tool_wrapper.py
@@ -133,13 +133,14 @@ # non-Windows don't do that there. link = subprocess.Popen(args, shell=sys.platform == 'win32', env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - out, _ = link.communicate() - for line in out.splitlines(): + # Read output one line at a time as it shows up to avoid OOM failures when + # GBs of output is produced. + for line in link.stdout: if (not line.startswith(' Creating library ') and not line.startswith('Generating code') and not line.startswith('Finished generating code')): - print line - return link.returncode + print line, + return link.wait() def ExecLinkWithManifests(self, arch, embed_manifest, out, ldcmd, resname, mt, rc, intermediate_manifest, *manifests):
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn index 58586fc..724a7e4 100644 --- a/chrome/BUILD.gn +++ b/chrome/BUILD.gn
@@ -498,7 +498,7 @@ tweak_info_plist("chrome_app_plist") { info_plist = "app/app-Info.plist" _keystone_arg = "0" - if (enable_mac_keystone) { + if (is_chrome_branded) { _keystone_arg = "1" } args = [ @@ -761,7 +761,7 @@ "//chrome/app_shim:app_mode_loader", ] - if (enable_mac_keystone) { + if (is_chrome_branded) { sources += [ "browser/mac/keystone_promote_postflight.sh", "browser/mac/keystone_promote_preflight.sh", @@ -900,7 +900,7 @@ } } - if (enable_mac_keystone) { + if (is_chrome_branded) { action("keystone_registration_framework") { script = "//chrome/tools/build/mac/copy_keystone_framework.py"
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index 3489d39..c1162ca9 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -672,7 +672,6 @@ deps = [] } - native_lib_version_rule = "//build/util:chrome_version_json" deps += [ ":chrome_java", ":chrome_public_apk_resources",
diff --git a/chrome/android/chrome_public_apk_tmpl.gni b/chrome/android/chrome_public_apk_tmpl.gni index 5c98830..3e7f20a 100644 --- a/chrome/android/chrome_public_apk_tmpl.gni +++ b/chrome/android/chrome_public_apk_tmpl.gni
@@ -40,7 +40,8 @@ _native_lib_file = rebase_path("$root_gen_dir/CHROME_VERSION.json", root_out_dir) native_lib_version_arg = "@FileArg($_native_lib_file:full-quoted)" - + native_lib_version_rule = "//build/util:chrome_version_json" + if (is_java_debug) { enable_multidex = true } else {
diff --git a/chrome/android/java/res/menu/download_manager_menu.xml b/chrome/android/java/res/menu/download_manager_menu.xml index 24932a06..16e3669 100644 --- a/chrome/android/java/res/menu/download_manager_menu.xml +++ b/chrome/android/java/res/menu/download_manager_menu.xml
@@ -24,7 +24,7 @@ <item android:id="@+id/selection_mode_delete_menu_id" android:icon="@drawable/ic_delete_white_24dp" - android:title="@string/remove" + android:title="@string/delete" chrome:showAsAction="ifRoom" /> </group> </menu>
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActionModeCallback.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActionModeCallback.java index 2e3dbf1..c1c9447f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActionModeCallback.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActionModeCallback.java
@@ -11,6 +11,7 @@ import android.view.MenuItem; import org.chromium.base.metrics.RecordUserAction; +import org.chromium.chrome.browser.firstrun.FirstRunStatus; import org.chromium.chrome.browser.omnibox.geo.GeolocationHeader; import org.chromium.chrome.browser.search_engines.TemplateUrlService; import org.chromium.chrome.browser.tab.Tab; @@ -37,6 +38,16 @@ @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { notifyContextualActionBarVisibilityChanged(true); + + int allowedActionModes = ActionModeCallbackHelper.MENU_ITEM_PROCESS_TEXT + | ActionModeCallbackHelper.MENU_ITEM_SHARE; + // Disable options that expose additional Chrome functionality prior to the FRE being + // completed (i.e. creation of a new tab). + if (FirstRunStatus.getFirstRunFlowComplete()) { + allowedActionModes |= ActionModeCallbackHelper.MENU_ITEM_WEB_SEARCH; + } + mHelper.setAllowedMenuItems(allowedActionModes); + mHelper.onCreateActionMode(mode, menu); return true; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java index 853aabd..2a09616 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
@@ -369,7 +369,7 @@ ChromePreferenceManager preferenceManager = ChromePreferenceManager.getInstance(this); // Promos can only be shown when we start with ACTION_MAIN intent and // after FRE is complete. - if (!mIntentWithEffect && FirstRunStatus.getFirstRunFlowComplete(this)) { + if (!mIntentWithEffect && FirstRunStatus.getFirstRunFlowComplete()) { // Only show promos on the second oppurtunity. This is because we show FRE on the // first oppurtunity, and we don't want to show such content back to back. if (preferenceManager.getPromosSkippedOnFirstStart()) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/EmbedContentViewActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/EmbedContentViewActivity.java index b6f5918..73601036 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/EmbedContentViewActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/EmbedContentViewActivity.java
@@ -86,7 +86,7 @@ @Override public boolean onCreateOptionsMenu(Menu menu) { boolean retVal = super.onCreateOptionsMenu(menu); - if (!FirstRunStatus.getFirstRunFlowComplete(this)) return retVal; + if (!FirstRunStatus.getFirstRunFlowComplete()) return retVal; return true; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java index 7b1f8a2..de05f047 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java
@@ -15,6 +15,7 @@ import org.chromium.base.metrics.RecordHistogram; import org.chromium.chrome.R; +import org.chromium.chrome.browser.firstrun.FirstRunStatus; import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; import org.chromium.chrome.browser.preferences.datareduction.DataReductionProxyUma; import org.chromium.chrome.browser.search_engines.TemplateUrlService; @@ -272,6 +273,16 @@ } } + // Hide all items that could spawn additional tabs until FRE has been completed. + if (!FirstRunStatus.getFirstRunFlowComplete()) { + menu.findItem(R.id.contextmenu_open_image_in_new_tab).setVisible(false); + menu.findItem(R.id.contextmenu_open_in_other_window).setVisible(false); + menu.findItem(R.id.contextmenu_open_in_new_tab).setVisible(false); + menu.findItem(R.id.contextmenu_open_in_incognito_tab).setVisible(false); + menu.findItem(R.id.contextmenu_search_by_image).setVisible(false); + menu.findItem(R.id.menu_id_open_in_chrome).setVisible(false); + } + if (mMode == FULLSCREEN_TAB_MODE) { removeUnsupportedItems(menu, FULLSCREEN_TAB_MODE_WHITELIST); } else if (mMode == CUSTOM_TAB_MODE) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java index 0f669c0..439703c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java
@@ -260,7 +260,7 @@ UmaUtils.recordForegroundStartTime(); stopProgressionIfNotAcceptedTermsOfService(); if (!mFreProperties.getBoolean(EXTRA_USE_FRE_FLOW_SEQUENCER)) { - if (FirstRunStatus.getFirstRunFlowComplete(this)) { + if (FirstRunStatus.getFirstRunFlowComplete()) { // This is a parallel flow that needs to be refreshed/re-fired. // Signal the FRE flow completion and re-launch the original intent. completeFirstRunExperience();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java index 452f352b..84a67b82 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java
@@ -86,7 +86,7 @@ @VisibleForTesting protected boolean isFirstRunFlowComplete() { - return FirstRunStatus.getFirstRunFlowComplete(mActivity); + return FirstRunStatus.getFirstRunFlowComplete(); } @VisibleForTesting @@ -263,13 +263,13 @@ fromIntent != null && TextUtils.equals(fromIntent.getAction(), Intent.ACTION_MAIN); if (!fromChromeIcon && ToSAckedReceiver.checkAnyUserHasSeenToS(context)) return null; - final boolean baseFreComplete = FirstRunStatus.getFirstRunFlowComplete(context); + final boolean baseFreComplete = FirstRunStatus.getFirstRunFlowComplete(); if (!baseFreComplete) { if (forLightweightFre && CommandLine.getInstance().hasSwitch( ChromeSwitches.ENABLE_LIGHTWEIGHT_FIRST_RUN_EXPERIENCE)) { - if (!FirstRunStatus.shouldSkipWelcomePage(context) - && !FirstRunStatus.getLightweightFirstRunFlowComplete(context)) { + if (!FirstRunStatus.shouldSkipWelcomePage() + && !FirstRunStatus.getLightweightFirstRunFlowComplete()) { return createLightweightFirstRunIntent(context, fromChromeIcon); } } else {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunSignInProcessor.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunSignInProcessor.java index 47d230ac..b5237c5 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunSignInProcessor.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunSignInProcessor.java
@@ -58,7 +58,7 @@ SigninManager signinManager = SigninManager.get(activity.getApplicationContext()); signinManager.onFirstRunCheckDone(); - boolean firstRunFlowComplete = FirstRunStatus.getFirstRunFlowComplete(activity); + boolean firstRunFlowComplete = FirstRunStatus.getFirstRunFlowComplete(); // We skip signin and the FRE if // - FRE is disabled, or // - FRE hasn't been completed, but the user has already seen the ToS in the Setup Wizard. @@ -129,7 +129,7 @@ Log.e(TAG, "Attempt to pass-through without completed FRE"); // Things went wrong -- we want the user to go through the full FRE. - FirstRunStatus.setFirstRunFlowComplete(activity, false); + FirstRunStatus.setFirstRunFlowComplete(false); setFirstRunFlowSignInComplete(activity, false); setFirstRunFlowSignInAccountName(activity, null); setFirstRunFlowSignInSetup(activity, false); @@ -207,7 +207,7 @@ * @param data Resulting FRE properties bundle */ public static void finalizeFirstRunFlowState(Context context, Bundle data) { - FirstRunStatus.setFirstRunFlowComplete(context, true); + FirstRunStatus.setFirstRunFlowComplete(true); setFirstRunFlowSignInAccountName(context, data.getString(FirstRunActivity.RESULT_SIGNIN_ACCOUNT_NAME)); setFirstRunFlowSignInSetup( @@ -221,7 +221,7 @@ public static void updateSigninManagerFirstRunCheckDone(Context context) { SigninManager manager = SigninManager.get(context); if (manager.isSignInAllowed()) return; - if (!FirstRunStatus.getFirstRunFlowComplete(context)) return; + if (!FirstRunStatus.getFirstRunFlowComplete()) return; if (!getFirstRunFlowSignInComplete(context)) return; manager.onFirstRunCheckDone(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunStatus.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunStatus.java index e62fdea0..ad5371d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunStatus.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunStatus.java
@@ -21,10 +21,9 @@ /** * Sets the "main First Run Experience flow complete" preference. - * @param context Any context * @param isComplete Whether the main First Run Experience flow is complete */ - public static void setFirstRunFlowComplete(Context context, boolean isComplete) { + public static void setFirstRunFlowComplete(boolean isComplete) { ContextUtils.getAppSharedPreferences() .edit() .putBoolean(FIRST_RUN_FLOW_COMPLETE, isComplete) @@ -35,11 +34,9 @@ * Returns whether the main First Run Experience flow is complete. * Note: that might NOT include "intro"/"what's new" pages, but it always * includes ToS and Sign In pages if necessary. - * @param context Any context */ - public static boolean getFirstRunFlowComplete(Context context) { - return ContextUtils.getAppSharedPreferences() - .getBoolean(FIRST_RUN_FLOW_COMPLETE, false); + public static boolean getFirstRunFlowComplete() { + return ContextUtils.getAppSharedPreferences().getBoolean(FIRST_RUN_FLOW_COMPLETE, false); } /** @@ -54,16 +51,15 @@ /** * Checks whether the welcome page should be skipped from the main First Run Experience. */ - public static boolean shouldSkipWelcomePage(Context context) { + public static boolean shouldSkipWelcomePage() { return ContextUtils.getAppSharedPreferences().getBoolean(SKIP_WELCOME_PAGE, false); } /** * Sets the "lightweight First Run Experience flow complete" preference. - * @param context Any context * @param isComplete Whether the lightweight First Run Experience flow is complete */ - public static void setLightweightFirstRunFlowComplete(Context context, boolean isComplete) { + public static void setLightweightFirstRunFlowComplete(boolean isComplete) { ContextUtils.getAppSharedPreferences() .edit() .putBoolean(LIGHTWEIGHT_FIRST_RUN_FLOW_COMPLETE, isComplete) @@ -72,9 +68,8 @@ /** * Returns whether the "lightweight First Run Experience flow" is complete. - * @param context Any context */ - public static boolean getLightweightFirstRunFlowComplete(Context context) { + public static boolean getLightweightFirstRunFlowComplete() { return ContextUtils.getAppSharedPreferences().getBoolean( LIGHTWEIGHT_FIRST_RUN_FLOW_COMPLETE, false); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/LightweightFirstRunActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/LightweightFirstRunActivity.java index a0cba00a..9e03c148 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/LightweightFirstRunActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/LightweightFirstRunActivity.java
@@ -78,7 +78,7 @@ @Override public void completeFirstRunExperience() { - FirstRunStatus.setLightweightFirstRunFlowComplete(LightweightFirstRunActivity.this, true); + FirstRunStatus.setLightweightFirstRunFlowComplete(true); Intent intent = new Intent(); intent.putExtras(mFreProperties); finishAllTheActivities(getLocalClassName(), Activity.RESULT_OK, intent);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ToSAndUMAFirstRunFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ToSAndUMAFirstRunFragment.java index 870b82b9..b44518a 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ToSAndUMAFirstRunFragment.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/ToSAndUMAFirstRunFragment.java
@@ -104,6 +104,6 @@ @Override public boolean shouldSkipPageOnCreate(Context appContext) { - return FirstRunStatus.shouldSkipWelcomePage(appContext); + return FirstRunStatus.shouldSkipWelcomePage(); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ContextMenuTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ContextMenuTest.java index 89e667c..058054f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ContextMenuTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ContextMenuTest.java
@@ -12,6 +12,7 @@ import android.view.ContextMenu; import android.view.KeyEvent; +import org.chromium.base.ThreadUtils; import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Feature; @@ -21,6 +22,7 @@ import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.compositor.layouts.LayoutManager; import org.chromium.chrome.browser.download.DownloadTestBase; +import org.chromium.chrome.browser.firstrun.FirstRunStatus; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabmodel.EmptyTabModelSelectorObserver; import org.chromium.chrome.browser.tabmodel.TabModel; @@ -39,7 +41,9 @@ /** * Context menu related tests */ -@CommandLineFlags.Add(ChromeSwitches.GOOGLE_BASE_URL + "=http://example.com/") +@CommandLineFlags.Add({ + ChromeSwitches.GOOGLE_BASE_URL + "=http://example.com/", + ChromeSwitches.HERB_FLAVOR_DISABLED_SWITCH}) public class ContextMenuTest extends DownloadTestBase { private static final String TEST_PATH = "/chrome/test/data/android/contextmenu/context_menu_test.html"; @@ -61,11 +65,24 @@ mTestUrl = mTestServer.getURL(TEST_PATH); deleteTestFiles(); super.setUp(); + + ThreadUtils.runOnUiThreadBlocking(new Runnable() { + @Override + public void run() { + FirstRunStatus.setFirstRunFlowComplete(true); + } + }); } @Override protected void tearDown() throws Exception { mTestServer.stopAndDestroyServer(); + ThreadUtils.runOnUiThreadBlocking(new Runnable() { + @Override + public void run() { + FirstRunStatus.setFirstRunFlowComplete(false); + } + }); deleteTestFiles(); super.tearDown(); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationTest.java index 5df8901..7471f123 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationTest.java
@@ -33,7 +33,7 @@ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) @RetryOnFailure public void testExitFirstRunExperience() throws InterruptedException { - if (FirstRunStatus.getFirstRunFlowComplete(getActivity())) { + if (FirstRunStatus.getFirstRunFlowComplete()) { return; }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/ContextMenuLoadUrlParamsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/ContextMenuLoadUrlParamsTest.java index eb550570f..349576f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/ContextMenuLoadUrlParamsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/ContextMenuLoadUrlParamsTest.java
@@ -11,6 +11,7 @@ import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.RetryOnFailure; import org.chromium.chrome.R; +import org.chromium.chrome.browser.firstrun.FirstRunStatus; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType; import org.chromium.chrome.browser.tabmodel.TabWindowManager.TabModelSelectorFactory; @@ -74,12 +75,24 @@ } }); super.setUp(); + ThreadUtils.runOnUiThreadBlocking(new Runnable() { + @Override + public void run() { + FirstRunStatus.setFirstRunFlowComplete(true); + } + }); mTestServer = EmbeddedTestServer.createAndStartServer(getInstrumentation().getContext()); } @Override protected void tearDown() throws Exception { + ThreadUtils.runOnUiThreadBlocking(new Runnable() { + @Override + public void run() { + FirstRunStatus.setFirstRunFlowComplete(false); + } + }); mTestServer.stopAndDestroyServer(); super.tearDown(); }
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 5f2a097a..63cf820 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -5735,23 +5735,17 @@ <message name="IDS_FLAGS_WEBRTC_HW_DECODING_DESCRIPTION" desc="Description of chrome:flags option to turn off WebRTC hardware video decoding support."> Support in WebRTC for decoding video streams using platform hardware. </message> - <message name="IDS_FLAGS_WEBRTC_HW_ENCODING_NAME" desc="Name of chrome:flags option to turn off WebRTC hardware video encoding support."> - WebRTC hardware video encoding + <message name="IDS_FLAGS_WEBRTC_HW_VP8_ENCODING_NAME" desc="Name of chrome:flags option to turn off WebRTC vp8 hardware video encoding support."> + WebRTC hardware vp8 video encoding </message> - <message name="IDS_FLAGS_WEBRTC_HW_ENCODING_DESCRIPTION" desc="Description of chrome:flags option to turn off WebRTC hardware video encoding support."> - Support in WebRTC for encoding video streams using platform hardware. + <message name="IDS_FLAGS_WEBRTC_HW_VP8_ENCODING_DESCRIPTION" desc="Description of chrome:flags option to turn off WebRTC vp8 hardware video encoding support."> + Support in WebRTC for encoding vp8 video streams using platform hardware. </message> - <message name="IDS_FLAGS_WEBRTC_HW_ENCODING_ALL"> - Disable all hw encoding + <message name="IDS_FLAGS_WEBRTC_HW_H264_ENCODING_NAME" desc="Name of chrome:flags option to turn on WebRTC h264 hardware video encoding support."> + WebRTC hardware h264 video encoding </message> - <message name="IDS_FLAGS_WEBRTC_HW_ENCODING_VPX"> - Disable vpx hw encoding - </message> - <message name="IDS_FLAGS_WEBRTC_HW_ENCODING_H264"> - Disable h264 hw encoding - </message> - <message name="IDS_FLAGS_WEBRTC_HW_ENCODING_NONE"> - Disable none hw encoding + <message name="IDS_FLAGS_WEBRTC_HW_H264_ENCODING_DESCRIPTION" desc="Description of chrome:flags option to turn on WebRTC hardware h264 video encoding support."> + Support in WebRTC for encoding h264 video streams using platform hardware. </message> <message name="IDS_FLAGS_WEBRTC_STUN_ORIGIN_NAME" desc="Name of chrome:flags option to turn on Origin header for WebRTC STUN messages"> WebRTC Stun origin header @@ -11218,6 +11212,9 @@ <message name="IDS_SYNC_LOGIN_NAME_PROHIBITED" desc="The error message shown when the user tries to sign in to sync using a name that is not allowed by the admin policy"> Signing in with this username has been disabled by your administrator. </message> + <message name="IDS_SUPERVISED_USER_NOT_ALLOWED_BY_POLICY" desc="The error message shown when the user tries to use the supervised user profile when it's disabled by policy"> + Supervised users have been disabled by your administrator. + </message> <if expr="is_android"> <message name="IDS_SYNC_USER_NAME_IN_USE_ERROR" desc="Mobile: An error message shown when a user tries to sign in to sync using a user name that's already in use by another profile."> This account is already being used on this device. @@ -15695,20 +15692,6 @@ <message name="IDS_FLAGS_MEDIA_REMOTING_ENCRYPTED_DESCRIPTION" desc="Desciption for the flag to enable Media Remoting of encrypted content" translateable="false"> When Media Remoting is enabled, this flag must be enabled to allow the remoting of encrypted content. When disabled, only non-encrypted content can be remoted. </message> - - <!-- Chrome OS component updates chrome://flags strings --> - <message name="IDS_FLAGS_CROS_COMP_UPDATES_NAME" desc="Name for the flag to enable Chrome OS component flash updates" translateable="false"> - Chrome OS Flash Component Updates - </message> - <message name="IDS_FLAGS_CROS_COMP_UPDATES_DESCRIPTION" desc="Description for the flag to enable Chrome OS component flash updates" translateable="false"> - Enable Flash component updates for Chrome OS. - </message> - <message name="IDS_FLAGS_COMPONENT_FLASH_ONLY_NAME" desc="Name for the flag to use component flash only" translateable="false"> - Component Flash Only - </message> - <message name="IDS_FLAGS_COMPONENT_FLASH_ONLY_DESCRIPTION" desc="Description for the flag to use component flash only" translateable="false"> - This flag should be used only for testing Flash component updates. - </message> </messages> </release> </grit>
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index cbfee5c7..edda13d 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -616,19 +616,6 @@ switches::kSecurityChipAnimationAll}, }; -#if BUILDFLAG(ENABLE_WEBRTC) -const FeatureEntry::Choice kDisableWebRtcHWEncodingChoices[] = { - {IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", ""}, - {IDS_FLAGS_WEBRTC_HW_ENCODING_ALL, switches::kDisableWebRtcHWEncoding, ""}, - {IDS_FLAGS_WEBRTC_HW_ENCODING_VPX, switches::kDisableWebRtcHWEncoding, - switches::kDisableWebRtcHWEncodingVPx}, - {IDS_FLAGS_WEBRTC_HW_ENCODING_H264, switches::kDisableWebRtcHWEncoding, - switches::kDisableWebRtcHWEncodingH264}, - {IDS_FLAGS_WEBRTC_HW_ENCODING_NONE, switches::kDisableWebRtcHWEncoding, - switches::kDisableWebRtcHWEncodingNone}, -}; -#endif // ENABLE_WEBRTC - #if !defined(OS_ANDROID) const FeatureEntry::Choice kEnableDefaultMediaSessionChoices[] = { {IDS_FLAGS_ENABLE_DEFAULT_MEDIA_SESSION_DISABLED, "", ""}, @@ -716,9 +703,12 @@ {"disable-webrtc-hw-decoding", IDS_FLAGS_WEBRTC_HW_DECODING_NAME, IDS_FLAGS_WEBRTC_HW_DECODING_DESCRIPTION, kOsAndroid | kOsCrOS, SINGLE_DISABLE_VALUE_TYPE(switches::kDisableWebRtcHWDecoding)}, - {"disable-webrtc-hw-encoding", IDS_FLAGS_WEBRTC_HW_ENCODING_NAME, - IDS_FLAGS_WEBRTC_HW_ENCODING_DESCRIPTION, kOsAndroid | kOsCrOS, - MULTI_VALUE_TYPE(kDisableWebRtcHWEncodingChoices)}, + {"disable-webrtc-hw-vp8-encoding", IDS_FLAGS_WEBRTC_HW_VP8_ENCODING_NAME, + IDS_FLAGS_WEBRTC_HW_VP8_ENCODING_DESCRIPTION, kOsAndroid | kOsCrOS, + SINGLE_DISABLE_VALUE_TYPE(switches::kDisableWebRtcHWVP8Encoding)}, + {"enable-webrtc-hw-h264-encoding", IDS_FLAGS_WEBRTC_HW_H264_ENCODING_NAME, + IDS_FLAGS_WEBRTC_HW_H264_ENCODING_DESCRIPTION, kOsAndroid | kOsCrOS, + FEATURE_VALUE_TYPE(features::kWebRtcHWH264Encoding)}, {"enable-webrtc-stun-origin", IDS_FLAGS_WEBRTC_STUN_ORIGIN_NAME, IDS_FLAGS_WEBRTC_STUN_ORIGIN_DESCRIPTION, kOsAll, SINGLE_VALUE_TYPE(switches::kEnableWebRtcStunOrigin)}, @@ -2131,14 +2121,6 @@ IDS_FLAGS_VIDEO_FULLSCREEN_ORIENTATION_LOCK_DESCRIPTION, kOsAndroid, FEATURE_VALUE_TYPE(media::kVideoFullscreenOrientationLock)}, #endif -#if defined(OS_CHROMEOS) - {"cros-comp-updates", IDS_FLAGS_CROS_COMP_UPDATES_NAME, - IDS_FLAGS_CROS_COMP_UPDATES_DESCRIPTION, kOsCrOS, - FEATURE_VALUE_TYPE(features::kCrosCompUpdates)}, - {"component-flash-only", IDS_FLAGS_COMPONENT_FLASH_ONLY_NAME, - IDS_FLAGS_COMPONENT_FLASH_ONLY_DESCRIPTION, kOsCrOS, - FEATURE_VALUE_TYPE(features::kComponentFlashOnly)}, -#endif {"enable-nostate-prefetch", IDS_FLAGS_NOSTATE_PREFETCH, IDS_FLAGS_NOSTATE_PREFETCH_DESCRIPTION, kOsAll, FEATURE_WITH_VARIATIONS_VALUE_TYPE(prerender::kNoStatePrefetchFeature,
diff --git a/chrome/browser/android/bookmarks/bookmark_bridge.cc b/chrome/browser/android/bookmarks/bookmark_bridge.cc index b91e6c6..f56a182 100644 --- a/chrome/browser/android/bookmarks/bookmark_bridge.cc +++ b/chrome/browser/android/bookmarks/bookmark_bridge.cc
@@ -593,7 +593,7 @@ query_parser::MatchingAlgorithm::ALWAYS_PREFIX_SEARCH, &results); for (const bookmarks::BookmarkMatch& match : results) { - const BookmarkNode* node = match.node; + const BookmarkNode* node = static_cast<const BookmarkNode*>(match.node); std::vector<int> title_match_start_positions; std::vector<int> title_match_end_positions;
diff --git a/chrome/browser/chromeos/login/chrome_restart_request.cc b/chrome/browser/chromeos/login/chrome_restart_request.cc index 1063f3b..428c7ea6 100644 --- a/chrome/browser/chromeos/login/chrome_restart_request.cc +++ b/chrome/browser/chromeos/login/chrome_restart_request.cc
@@ -169,7 +169,7 @@ ::switches::kEnableWebVR, #if BUILDFLAG(ENABLE_WEBRTC) ::switches::kDisableWebRtcHWDecoding, - ::switches::kDisableWebRtcHWEncoding, + ::switches::kDisableWebRtcHWVP8Encoding, #endif ::switches::kDisableVaapiAcceleratedVideoEncode, #if defined(USE_OZONE)
diff --git a/chrome/browser/component_updater/component_patcher_operation_out_of_process.cc b/chrome/browser/component_updater/component_patcher_operation_out_of_process.cc index ba3de60..27d2795f 100644 --- a/chrome/browser/component_updater/component_patcher_operation_out_of_process.cc +++ b/chrome/browser/component_updater/component_patcher_operation_out_of_process.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/component_updater/component_patcher_operation_out_of_process.h" +#include <memory> #include <vector> #include "base/bind.h" @@ -61,7 +62,6 @@ this, base::ThreadTaskRunnerHandle::Get().get()); host->SetName(l10n_util::GetStringUTF16( IDS_UTILITY_PROCESS_COMPONENT_PATCHER_NAME)); - host->DisableSandbox(); host->Send(message.release()); } @@ -102,13 +102,25 @@ const base::FilePath& output_abs_path, base::Callback<void(int result)> callback) { host_ = new PatchHost(callback, task_runner); + IPC::PlatformFileForTransit input = IPC::TakePlatformFileForTransit( + base::File( + input_abs_path, base::File::FLAG_OPEN | base::File::FLAG_READ)); + IPC::PlatformFileForTransit patch = IPC::TakePlatformFileForTransit( + base::File( + patch_abs_path, base::File::FLAG_OPEN | base::File::FLAG_READ)); + IPC::PlatformFileForTransit output = IPC::TakePlatformFileForTransit( + base::File( + output_abs_path, + base::File::FLAG_CREATE | + base::File::FLAG_WRITE | + base::File::FLAG_EXCLUSIVE_WRITE)); std::unique_ptr<IPC::Message> patch_message; if (operation == update_client::kBsdiff) { patch_message.reset(new ChromeUtilityMsg_PatchFileBsdiff( - input_abs_path, patch_abs_path, output_abs_path)); + input, patch, output)); } else if (operation == update_client::kCourgette) { patch_message.reset(new ChromeUtilityMsg_PatchFileCourgette( - input_abs_path, patch_abs_path, output_abs_path)); + input, patch, output)); } else { NOTREACHED(); }
diff --git a/chrome/browser/component_updater/pepper_flash_component_installer.cc b/chrome/browser/component_updater/pepper_flash_component_installer.cc index 852d6ea..2814962 100644 --- a/chrome/browser/component_updater/pepper_flash_component_installer.cc +++ b/chrome/browser/component_updater/pepper_flash_component_installer.cc
@@ -45,9 +45,9 @@ #include "ppapi/shared_impl/ppapi_permissions.h" #if defined(OS_CHROMEOS) +#include "base/feature_list.h" #include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h" -#include "chrome/common/chrome_features.h" #include "chromeos/dbus/dbus_method_call_status.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/image_loader_client.h"
diff --git a/chrome/browser/media/router/media_source_helper.cc b/chrome/browser/media/router/media_source_helper.cc index 7c618b9..fa410f8 100644 --- a/chrome/browser/media/router/media_source_helper.cc +++ b/chrome/browser/media/router/media_source_helper.cc
@@ -24,6 +24,11 @@ "urn:x-org.chromium.media:source:tab_content_remoting:%d"; constexpr char kCastPresentationUrlDomain[] = "google.com"; constexpr char kCastPresentationUrlPath[] = "/cast"; + +// This value must be the same as |chrome.cast.AUTO_JOIN_PRESENTATION_ID| in the +// component extension. +constexpr char kAutoJoinPresentationId[] = "auto-join"; + } // namespace MediaSource MediaSourceForTab(int tab_id) { @@ -61,14 +66,11 @@ } bool CanConnectToMediaSource(const MediaSource& source) { - // compare host, port, scheme, and path prefix for source.url() - if (!source.url().SchemeIs(url::kHttpsScheme) || - !source.url().DomainIs(kCastPresentationUrlDomain) || - (!source.url().has_path() || - source.url().path() != kCastPresentationUrlPath)) - return false; - - return true; + // Compare host, port, scheme, and path prefix for source.url(). + return source.url().SchemeIs(url::kHttpsScheme) && + source.url().DomainIs(kCastPresentationUrlDomain) && + source.url().has_path() && + source.url().path() == kCastPresentationUrlPath; } int TabIdFromMediaSource(const MediaSource& source) { @@ -91,4 +93,8 @@ return url.is_valid() && url.SchemeIsHTTPOrHTTPS(); } +bool IsAutoJoinPresentationId(const std::string& presentation_id) { + return presentation_id == kAutoJoinPresentationId; +} + } // namespace media_router
diff --git a/chrome/browser/media/router/media_source_helper.h b/chrome/browser/media/router/media_source_helper.h index 64d6e74..6081b69 100644 --- a/chrome/browser/media/router/media_source_helper.h +++ b/chrome/browser/media/router/media_source_helper.h
@@ -44,6 +44,9 @@ // Returns true if |url| is a valid presentation URL. bool IsValidPresentationUrl(const GURL& url); +// Returns true if |presentation_id| is an ID used by auto-join requests. +bool IsAutoJoinPresentationId(const std::string& presentation_id); + } // namespace media_router #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_SOURCE_HELPER_H_
diff --git a/chrome/browser/media/router/presentation_service_delegate_impl.cc b/chrome/browser/media/router/presentation_service_delegate_impl.cc index 67d43a3..c260393 100644 --- a/chrome/browser/media/router/presentation_service_delegate_impl.cc +++ b/chrome/browser/media/router/presentation_service_delegate_impl.cc
@@ -32,6 +32,12 @@ #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" +#if !defined(OS_ANDROID) +#include "chrome/browser/profiles/profile.h" +#include "chrome/common/pref_names.h" +#include "components/prefs/pref_service.h" +#endif + DEFINE_WEB_CONTENTS_USER_DATA_KEY( media_router::PresentationServiceDelegateImpl); @@ -828,6 +834,19 @@ return; } + const url::Origin& origin = url::Origin(GetLastCommittedURLForFrame( + RenderFrameHostId(render_process_id, render_frame_id), web_contents_)); + +#if !defined(OS_ANDROID) + if (IsAutoJoinPresentationId(presentation_id) && + ShouldCancelAutoJoinForOrigin(origin)) { + error_cb.Run(content::PresentationError( + content::PRESENTATION_ERROR_SESSION_REQUEST_CANCELLED, + "Auto-join request cancelled by user preferences.")); + return; + } +#endif // !defined(OS_ANDROID) + // TODO(crbug.com/627655): Handle multiple URLs. const GURL& presentation_url = presentation_urls[0]; bool incognito = web_contents_->GetBrowserContext()->IsOffTheRecord(); @@ -836,12 +855,9 @@ base::Bind(&PresentationServiceDelegateImpl::OnJoinRouteResponse, weak_factory_.GetWeakPtr(), render_process_id, render_frame_id, presentation_url, presentation_id, success_cb, error_cb)); - router_->JoinRoute( - MediaSourceForPresentationUrl(presentation_url).id(), presentation_id, - GetLastCommittedURLForFrame( - RenderFrameHostId(render_process_id, render_frame_id), web_contents_) - .GetOrigin(), - web_contents_, route_response_callbacks, base::TimeDelta(), incognito); + router_->JoinRoute(MediaSourceForPresentationUrl(presentation_url).id(), + presentation_id, origin.GetURL(), web_contents_, + route_response_callbacks, base::TimeDelta(), incognito); } void PresentationServiceDelegateImpl::CloseConnection( @@ -977,4 +993,16 @@ render_frame_host_id, source_id); } +#if !defined(OS_ANDROID) +bool PresentationServiceDelegateImpl::ShouldCancelAutoJoinForOrigin( + const url::Origin& origin) const { + const base::ListValue* origins = + Profile::FromBrowserContext(web_contents_->GetBrowserContext()) + ->GetPrefs() + ->GetList(prefs::kMediaRouterTabMirroringSources); + return origins && + origins->Find(base::StringValue(origin.Serialize())) != origins->end(); +} +#endif // !defined(OS_ANDROID) + } // namespace media_router
diff --git a/chrome/browser/media/router/presentation_service_delegate_impl.h b/chrome/browser/media/router/presentation_service_delegate_impl.h index dfa9a4a9..1549f75 100644 --- a/chrome/browser/media/router/presentation_service_delegate_impl.h +++ b/chrome/browser/media/router/presentation_service_delegate_impl.h
@@ -30,6 +30,10 @@ struct PresentationSessionMessage; } // namespace content +namespace url { +class Origin; +} // namespace url + namespace media_router { class MediaRoute; @@ -194,6 +198,11 @@ const content::PresentationSessionInfo& new_session, const MediaRoute& route); +#if !defined(OS_ANDROID) + // Returns true if auto-join requests should be cancelled for |origin|. + bool ShouldCancelAutoJoinForOrigin(const url::Origin& origin) const; +#endif + // References to the WebContents that owns this instance, and associated // browser profile's MediaRouter instance. content::WebContents* const web_contents_;
diff --git a/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc b/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc index 2de3a32f..4d02299 100644 --- a/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc +++ b/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc
@@ -12,14 +12,17 @@ #include "chrome/browser/media/router/route_request_result.h" #include "chrome/browser/media/router/test_helper.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/common/pref_names.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/testing_profile.h" +#include "components/prefs/scoped_user_pref_update.h" #include "content/public/browser/presentation_screen_availability_listener.h" #include "content/public/browser/presentation_session.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/web_contents.h" #include "content/public/test/web_contents_tester.h" #include "testing/gmock/include/gmock/gmock.h" +#include "url/origin.h" using ::testing::_; using ::testing::Mock; @@ -473,4 +476,117 @@ render_process_id, render_frame_id, &listener)); } +#if !defined(OS_ANDROID) +TEST_F(PresentationServiceDelegateImplTest, AutoJoinRequest) { + GURL frame_url(kFrameUrl); + std::string origin(url::Origin(frame_url).Serialize()); + content::WebContentsTester::For(GetWebContents()) + ->NavigateAndCommit(frame_url); + content::RenderFrameHost* main_frame = GetWebContents()->GetMainFrame(); + ASSERT_TRUE(main_frame); + int render_process_id = main_frame->GetProcess()->GetID(); + int routing_id = main_frame->GetRoutingID(); + + MockCreatePresentationConnnectionCallbacks mock_create_connection_callbacks; + const std::string kPresentationId("auto-join"); + ASSERT_TRUE(IsAutoJoinPresentationId(kPresentationId)); + + // Set the user preference for |origin| to prefer tab mirroring. + { + ListPrefUpdate update(profile()->GetPrefs(), + prefs::kMediaRouterTabMirroringSources); + update->AppendIfNotPresent(base::MakeUnique<base::StringValue>(origin)); + } + + // Auto-join requests should be rejected. + EXPECT_CALL(mock_create_connection_callbacks, OnCreateConnectionError(_)); + EXPECT_CALL(router_, JoinRoute(_, kPresentationId, _, _, _, _, _)).Times(0); + delegate_impl_->JoinSession( + render_process_id, routing_id, presentation_urls_, kPresentationId, + base::Bind(&MockCreatePresentationConnnectionCallbacks:: + OnCreateConnectionSuccess, + base::Unretained(&mock_create_connection_callbacks)), + base::Bind( + &MockCreatePresentationConnnectionCallbacks::OnCreateConnectionError, + base::Unretained(&mock_create_connection_callbacks))); + + // Remove the user preference for |origin|. + { + ListPrefUpdate update(profile()->GetPrefs(), + prefs::kMediaRouterTabMirroringSources); + update->Remove(base::StringValue(origin), nullptr); + } + + // Auto-join requests should now go through. + EXPECT_CALL(router_, JoinRoute(_, kPresentationId, _, _, _, _, _)).Times(1); + delegate_impl_->JoinSession( + render_process_id, routing_id, presentation_urls_, kPresentationId, + base::Bind(&MockCreatePresentationConnnectionCallbacks:: + OnCreateConnectionSuccess, + base::Unretained(&mock_create_connection_callbacks)), + base::Bind( + &MockCreatePresentationConnnectionCallbacks::OnCreateConnectionError, + base::Unretained(&mock_create_connection_callbacks))); +} + +TEST_F(PresentationServiceDelegateImplIncognitoTest, AutoJoinRequest) { + GURL frame_url(kFrameUrl); + std::string origin(url::Origin(frame_url).Serialize()); + content::WebContentsTester::For(GetWebContents()) + ->NavigateAndCommit(frame_url); + content::RenderFrameHost* main_frame = GetWebContents()->GetMainFrame(); + ASSERT_TRUE(main_frame); + int render_process_id = main_frame->GetProcess()->GetID(); + int routing_id = main_frame->GetRoutingID(); + + MockCreatePresentationConnnectionCallbacks mock_create_connection_callbacks; + const std::string kPresentationId("auto-join"); + ASSERT_TRUE(IsAutoJoinPresentationId(kPresentationId)); + + // Set the user preference for |origin| to prefer tab mirroring. + { + ListPrefUpdate update(profile()->GetOffTheRecordProfile()->GetPrefs(), + prefs::kMediaRouterTabMirroringSources); + update->AppendIfNotPresent(base::MakeUnique<base::StringValue>(origin)); + } + + // Setting the pref in incognito shouldn't set it for the non-incognito + // profile. + const base::ListValue* non_incognito_origins = + profile()->GetPrefs()->GetList(prefs::kMediaRouterTabMirroringSources); + EXPECT_EQ(non_incognito_origins->Find(base::StringValue(origin)), + non_incognito_origins->end()); + + // Auto-join requests should be rejected. + EXPECT_CALL(mock_create_connection_callbacks, OnCreateConnectionError(_)); + EXPECT_CALL(router_, JoinRoute(_, kPresentationId, _, _, _, _, _)).Times(0); + delegate_impl_->JoinSession( + render_process_id, routing_id, presentation_urls_, kPresentationId, + base::Bind(&MockCreatePresentationConnnectionCallbacks:: + OnCreateConnectionSuccess, + base::Unretained(&mock_create_connection_callbacks)), + base::Bind( + &MockCreatePresentationConnnectionCallbacks::OnCreateConnectionError, + base::Unretained(&mock_create_connection_callbacks))); + + // Remove the user preference for |origin| in incognito. + { + ListPrefUpdate update(profile()->GetOffTheRecordProfile()->GetPrefs(), + prefs::kMediaRouterTabMirroringSources); + update->Remove(base::StringValue(origin), nullptr); + } + + // Auto-join requests should now go through. + EXPECT_CALL(router_, JoinRoute(_, kPresentationId, _, _, _, _, _)).Times(1); + delegate_impl_->JoinSession( + render_process_id, routing_id, presentation_urls_, kPresentationId, + base::Bind(&MockCreatePresentationConnnectionCallbacks:: + OnCreateConnectionSuccess, + base::Unretained(&mock_create_connection_callbacks)), + base::Bind( + &MockCreatePresentationConnnectionCallbacks::OnCreateConnectionError, + base::Unretained(&mock_create_connection_callbacks))); +} +#endif // !defined(OS_ANDROID) + } // namespace media_router
diff --git a/chrome/browser/net/predictor.cc b/chrome/browser/net/predictor.cc index 0ee6a62..72266b3 100644 --- a/chrome/browser/net/predictor.cc +++ b/chrome/browser/net/predictor.cc
@@ -312,9 +312,13 @@ void Predictor::DiscardAllResultsAndClearPrefsOnUIThread() { DCHECK_CURRENTLY_ON(BrowserThread::UI); - BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, - base::Bind(&Predictor::DiscardAllResults, - io_weak_factory_->GetWeakPtr())); + // The post task here is guaranteed to execute before the post task in + // ShutdownOnUIThread, because the caller has a valid profile here. Note that + // the ChromeNetBenchmarkingMessageFilter calls unsafely (an existing bug) + // into the profile, but doing so would crash before this point anyways. + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::Bind(&Predictor::DiscardAllResults, base::Unretained(this))); ClearPrefsOnUIThread(); } @@ -688,11 +692,12 @@ base::ListValue* startup_list_raw = startup_list.get(); base::ListValue* referral_list_raw = referral_list.get(); + // The first post task here is guaranteed to execute before the post task in + // ShutdownOnUIThread, because the caller has a valid profile. BrowserThread::PostTaskAndReply( BrowserThread::IO, FROM_HERE, - base::Bind(&Predictor::WriteDnsPrefetchState, - io_weak_factory_->GetWeakPtr(), startup_list_raw, - referral_list_raw), + base::Bind(&Predictor::WriteDnsPrefetchState, base::Unretained(this), + startup_list_raw, referral_list_raw), base::Bind(&Predictor::UpdatePrefsOnUIThread, ui_weak_factory_->GetWeakPtr(), base::Passed(std::move(startup_list)),
diff --git a/chrome/browser/prefs/pref_service_syncable_util.cc b/chrome/browser/prefs/pref_service_syncable_util.cc index 01f0b3d..68c2f27 100644 --- a/chrome/browser/prefs/pref_service_syncable_util.cc +++ b/chrome/browser/prefs/pref_service_syncable_util.cc
@@ -36,6 +36,7 @@ // or behavior of the user should have this property. std::vector<const char*> overlay_pref_names; overlay_pref_names.push_back(prefs::kBrowserWindowPlacement); + overlay_pref_names.push_back(prefs::kMediaRouterTabMirroringSources); overlay_pref_names.push_back(prefs::kSaveFileDefaultDirectory); #if defined(OS_ANDROID) overlay_pref_names.push_back(proxy_config::prefs::kProxy);
diff --git a/chrome/browser/resources/settings/languages_page/edit_dictionary_page.html b/chrome/browser/resources/settings/languages_page/edit_dictionary_page.html index 76cbc9e..5487b78 100644 --- a/chrome/browser/resources/settings/languages_page/edit_dictionary_page.html +++ b/chrome/browser/resources/settings/languages_page/edit_dictionary_page.html
@@ -35,7 +35,7 @@ -webkit-margin-start: 16px; } </style> - <div class="settings-box"> + <div class="settings-box first"> <iron-a11y-keys id="keys" keys="enter esc" on-keys-pressed="onKeysPress_"></iron-a11y-keys> <div class="start">
diff --git a/chrome/browser/ui/cocoa/profiles/user_manager_mac.h b/chrome/browser/ui/cocoa/profiles/user_manager_mac.h index 4f61af6..91b5c0b8 100644 --- a/chrome/browser/ui/cocoa/profiles/user_manager_mac.h +++ b/chrome/browser/ui/cocoa/profiles/user_manager_mac.h
@@ -15,7 +15,7 @@ #include "chrome/browser/profiles/profile_window.h" #include "components/signin/core/browser/signin_metrics.h" -@class ReauthDialogWindowController; +@class DialogWindowController; @class UserManagerWindowController; // Dialog widget that contains the Desktop User Manager webui. This object @@ -44,10 +44,10 @@ void LogTimeToOpen(); - void ShowReauthDialog(content::BrowserContext* browser_context, - const std::string& email, - signin_metrics::Reason reason); - void CloseReauthDialog(); + void ShowDialog(content::BrowserContext* browser_context, + const std::string& email, + const GURL& url); + void CloseDialog(); void DisplayErrorMessage(); @@ -61,7 +61,7 @@ // Controller of the window. base::scoped_nsobject<UserManagerWindowController> window_controller_; - base::scoped_nsobject<ReauthDialogWindowController> reauth_window_; + base::scoped_nsobject<DialogWindowController> reauth_window_; base::Time user_manager_started_showing_;
diff --git a/chrome/browser/ui/cocoa/profiles/user_manager_mac.mm b/chrome/browser/ui/cocoa/profiles/user_manager_mac.mm index fb60959..261283b 100644 --- a/chrome/browser/ui/cocoa/profiles/user_manager_mac.mm +++ b/chrome/browser/ui/cocoa/profiles/user_manager_mac.mm
@@ -54,23 +54,24 @@ std::vector<base::Closure>* user_manager_shown_callbacks_for_testing_ = nullptr; BOOL instance_under_construction_ = NO; -void CloseInstanceReauthDialog() { +void CloseInstanceDialog() { DCHECK(instance_); - instance_->CloseReauthDialog(); + instance_->CloseDialog(); } -// The modal dialog host the User Manager uses to display the reauth dialog. +// The modal dialog host the User Manager uses to display the dialog. class UserManagerModalHost : public web_modal::WebContentsModalDialogHost { public: UserManagerModalHost(gfx::NativeView host_view) : host_view_(host_view) {} gfx::Size GetMaximumDialogSize() override { - return switches::UsePasswordSeparatedSigninFlow() ? - gfx::Size(UserManager::kReauthDialogWidth, - UserManager::kReauthDialogHeight) : - gfx::Size(UserManager::kPasswordCombinedReauthDialogWidth, - UserManager::kPasswordCombinedReauthDialogHeight); + return switches::UsePasswordSeparatedSigninFlow() + ? gfx::Size(UserManagerProfileDialog::kDialogWidth, + UserManagerProfileDialog::kDialogHeight) + : gfx::Size( + UserManagerProfileDialog::kPasswordCombinedDialogWidth, + UserManagerProfileDialog::kPasswordCombinedDialogHeight); } ~UserManagerModalHost() override {} @@ -91,7 +92,7 @@ }; // The modal manager delegate allowing the display of constrained windows for -// the reauth dialog. +// the dialog. class UserManagerModalManagerDelegate : public web_modal::WebContentsModalDialogManagerDelegate { public: @@ -140,17 +141,16 @@ } }; -class ReauthDialogDelegate : public UserManager::BaseReauthDialogDelegate, - public ConstrainedWindowMacDelegate { +class UserManagerProfileDialogDelegate + : public UserManagerProfileDialog::BaseDialogDelegate, + public ConstrainedWindowMacDelegate { public: - ReauthDialogDelegate() { + UserManagerProfileDialogDelegate() { hotKeysWebContentsDelegate_.reset(new UserManagerWebContentsDelegate()); } - // UserManager::BaseReauthDialogDelegate: - void CloseReauthDialog() override { - CloseInstanceReauthDialog(); - } + // UserManagerProfileDialog::BaseDialogDelegate: + void CloseDialog() override { CloseInstanceDialog(); } // WebContentsDelegate::HandleKeyboardEvent: void HandleKeyboardEvent( @@ -161,48 +161,47 @@ // ConstrainedWindowMacDelegate: void OnConstrainedWindowClosed(ConstrainedWindowMac* window) override { - CloseReauthDialog(); + CloseDialog(); } private: std::unique_ptr<UserManagerWebContentsDelegate> hotKeysWebContentsDelegate_; - DISALLOW_COPY_AND_ASSIGN(ReauthDialogDelegate); + DISALLOW_COPY_AND_ASSIGN(UserManagerProfileDialogDelegate); }; } // namespace -// WindowController for the reauth dialog. -@interface ReauthDialogWindowController - : NSWindowController <NSWindowDelegate> { +// WindowController for the dialog. +@interface DialogWindowController : NSWindowController<NSWindowDelegate> { @private std::string emailAddress_; + GURL url_; content::WebContents* webContents_; - signin_metrics::Reason reason_; - std::unique_ptr<ReauthDialogDelegate> webContentsDelegate_; + std::unique_ptr<UserManagerProfileDialogDelegate> webContentsDelegate_; std::unique_ptr<ConstrainedWindowMac> constrained_window_; - std::unique_ptr<content::WebContents> reauthWebContents_; + std::unique_ptr<content::WebContents> dialogWebContents_; } - (id)initWithProfile:(Profile*)profile email:(std::string)email - reason:(signin_metrics::Reason)reason + url:(GURL)url webContents:(content::WebContents*)webContents; - (void)showURL:(const GURL&)url; - (void)close; @end -@implementation ReauthDialogWindowController +@implementation DialogWindowController - (id)initWithProfile:(Profile*)profile email:(std::string)email - reason:(signin_metrics::Reason)reason + url:(GURL)url webContents:(content::WebContents*)webContents { webContents_ = webContents; emailAddress_ = email; - reason_ = reason; + url_ = url; - NSRect frame = NSMakeRect( - 0, 0, UserManager::kReauthDialogWidth, UserManager::kReauthDialogHeight); + NSRect frame = NSMakeRect(0, 0, UserManagerProfileDialog::kDialogWidth, + UserManagerProfileDialog::kDialogHeight); base::scoped_nsobject<ConstrainedWindowCustomWindow> window( [[ConstrainedWindowCustomWindow alloc] initWithContentRect:frame @@ -210,11 +209,11 @@ if ((self = [super initWithWindow:window])) { webContents_ = webContents; - reauthWebContents_.reset(content::WebContents::Create( + dialogWebContents_.reset(content::WebContents::Create( content::WebContents::CreateParams(profile))); - window.get().contentView = reauthWebContents_->GetNativeView(); - webContentsDelegate_.reset(new ReauthDialogDelegate()); - reauthWebContents_->SetDelegate(webContentsDelegate_.get()); + window.get().contentView = dialogWebContents_->GetNativeView(); + webContentsDelegate_.reset(new UserManagerProfileDialogDelegate()); + dialogWebContents_->SetDelegate(webContentsDelegate_.get()); base::scoped_nsobject<CustomConstrainedWindowSheet> sheet( [[CustomConstrainedWindowSheet alloc] @@ -236,16 +235,13 @@ } - (void)showURL:(const GURL&)url { - reauthWebContents_->GetController().LoadURL(url, content::Referrer(), + dialogWebContents_->GetController().LoadURL(url, content::Referrer(), ui::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string()); } - (void)show { - GURL url = signin::GetReauthURLWithEmail( - signin_metrics::AccessPoint::ACCESS_POINT_USER_MANAGER, reason_, - emailAddress_); - [self showURL:url]; + [self showURL:url_]; } - (void)closeButtonClicked:(NSButton*)button { @@ -271,7 +267,7 @@ std::unique_ptr<UserManagerWebContentsDelegate> webContentsDelegate_; UserManagerMac* userManagerObserver_; // Weak. std::unique_ptr<UserManagerModalManagerDelegate> modal_manager_delegate_; - base::scoped_nsobject<ReauthDialogWindowController> reauth_window_controller_; + base::scoped_nsobject<DialogWindowController> dialog_window_controller_; } - (void)windowWillClose:(NSNotification*)notification; - (void)dealloc; @@ -281,11 +277,11 @@ - (void)show; - (void)close; - (BOOL)isVisible; -- (void)showReauthDialogWithProfile:(Profile*)profile - email:(std::string)email - reason:(signin_metrics::Reason)reason; +- (void)showDialogWithProfile:(Profile*)profile + email:(std::string)email + url:(GURL)url; - (void)displayErrorMessage; -- (void)closeReauthDialog; +- (void)closeDialog; @end @implementation UserManagerWindowController @@ -390,22 +386,22 @@ userManagerObserver_->WindowWasClosed(); } -- (void)showReauthDialogWithProfile:(Profile*)profile - email:(std::string)email - reason:(signin_metrics::Reason)reason { - reauth_window_controller_.reset([[ReauthDialogWindowController alloc] +- (void)showDialogWithProfile:(Profile*)profile + email:(std::string)email + url:(GURL)url { + dialog_window_controller_.reset([[DialogWindowController alloc] initWithProfile:profile email:email - reason:reason + url:url webContents:webContents_.get()]); } - (void)displayErrorMessage { - [reauth_window_controller_ showURL:GURL(chrome::kChromeUISigninErrorURL)]; + [dialog_window_controller_ showURL:GURL(chrome::kChromeUISigninErrorURL)]; } -- (void)closeReauthDialog { - [reauth_window_controller_ close]; +- (void)closeDialog { + [dialog_window_controller_ close]; } @end @@ -471,26 +467,6 @@ } // static -void UserManager::ShowReauthDialog(content::BrowserContext* browser_context, - const std::string& email, - signin_metrics::Reason reason) { - // This method should only be called if the user manager is already showing. - if (!IsShowing()) - return; - - instance_->ShowReauthDialog(browser_context, email, reason); -} - -// static -void UserManager::HideReauthDialog() { - // This method should only be called if the user manager is already showing. - if (!IsShowing()) - return; - - instance_->CloseReauthDialog(); -} - -// static void UserManager::AddOnUserManagerShownCallbackForTesting( const base::Closure& callback) { if (!user_manager_shown_callbacks_for_testing_) @@ -499,37 +475,71 @@ } // static -void UserManager::ShowSigninDialog(content::BrowserContext* browser_context, - const base::FilePath& profile_path) { - if (!IsShowing()) - return; - instance_->SetSigninProfilePath(profile_path); - ShowReauthDialog(browser_context, std::string(), - signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT); +base::FilePath UserManager::GetSigninProfilePath() { + return instance_->GetSigninProfilePath(); } // static -void UserManager::DisplayErrorMessage() { +void UserManagerProfileDialog::ShowReauthDialog( + content::BrowserContext* browser_context, + const std::string& email, + signin_metrics::Reason reason) { + // This method should only be called if the user manager is already showing. + if (!UserManager::IsShowing()) + return; + GURL url = signin::GetReauthURLWithEmail( + signin_metrics::AccessPoint::ACCESS_POINT_USER_MANAGER, reason, email); + instance_->ShowDialog(browser_context, email, url); +} + +// static +void UserManagerProfileDialog::ShowSigninDialog( + content::BrowserContext* browser_context, + const base::FilePath& profile_path) { + if (!UserManager::IsShowing()) + return; + instance_->SetSigninProfilePath(profile_path); + GURL url = signin::GetPromoURL( + signin_metrics::AccessPoint::ACCESS_POINT_USER_MANAGER, + signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT, true, true); + instance_->ShowDialog(browser_context, std::string(), url); +} + +// static +void UserManagerProfileDialog::ShowDialogAndDisplayErrorMessage( + content::BrowserContext* browser_context) { + if (!UserManager::IsShowing()) + return; + instance_->ShowDialog(browser_context, std::string(), + GURL(chrome::kChromeUISigninErrorURL)); +} + +// static +void UserManagerProfileDialog::DisplayErrorMessage() { DCHECK(instance_); instance_->DisplayErrorMessage(); } // static -base::FilePath UserManager::GetSigninProfilePath() { - return instance_->GetSigninProfilePath(); +void UserManagerProfileDialog::HideDialog() { + // This method should only be called if the user manager is already showing. + if (!UserManager::IsShowing()) + return; + + instance_->CloseDialog(); } -void UserManagerMac::ShowReauthDialog(content::BrowserContext* browser_context, - const std::string& email, - signin_metrics::Reason reason) { +void UserManagerMac::ShowDialog(content::BrowserContext* browser_context, + const std::string& email, + const GURL& url) { [window_controller_ - showReauthDialogWithProfile:Profile::FromBrowserContext(browser_context) - email:email - reason:reason]; + showDialogWithProfile:Profile::FromBrowserContext(browser_context) + email:email + url:url]; } -void UserManagerMac::CloseReauthDialog() { - [window_controller_ closeReauthDialog]; +void UserManagerMac::CloseDialog() { + [window_controller_ closeDialog]; } UserManagerMac::UserManagerMac(Profile* profile) { @@ -561,7 +571,7 @@ } void UserManagerMac::WindowWasClosed() { - CloseReauthDialog(); + CloseDialog(); instance_ = NULL; delete this; }
diff --git a/chrome/browser/ui/user_manager.cc b/chrome/browser/ui/user_manager.cc index dc2b0e3..3be55c0 100644 --- a/chrome/browser/ui/user_manager.cc +++ b/chrome/browser/ui/user_manager.cc
@@ -16,17 +16,18 @@ } // namespace -UserManager::BaseReauthDialogDelegate::BaseReauthDialogDelegate() +UserManagerProfileDialog::BaseDialogDelegate::BaseDialogDelegate() : guest_web_contents_(nullptr) {} -bool UserManager::BaseReauthDialogDelegate::HandleContextMenu( +bool UserManagerProfileDialog::BaseDialogDelegate::HandleContextMenu( const content::ContextMenuParams& params) { // Ignores context menu. return true; } -void UserManager::BaseReauthDialogDelegate::LoadingStateChanged( - content::WebContents* source, bool to_different_document) { +void UserManagerProfileDialog::BaseDialogDelegate::LoadingStateChanged( + content::WebContents* source, + bool to_different_document) { if (source->IsLoading() || guest_web_contents_) return;
diff --git a/chrome/browser/ui/user_manager.h b/chrome/browser/ui/user_manager.h index 1173d04..2dbf8d1b 100644 --- a/chrome/browser/ui/user_manager.h +++ b/chrome/browser/ui/user_manager.h
@@ -23,16 +23,6 @@ static constexpr int kWindowWidth = 800; static constexpr int kWindowHeight = 600; - // Dimensions of the reauth dialog displaying the old-style signin flow with - // the username and password challenge on the same form. - static constexpr int kPasswordCombinedReauthDialogHeight = 440; - static constexpr int kPasswordCombinedReauthDialogWidth = 360; - - // Dimensions of the reauth dialog displaying the password-separated signin - // flow. - static constexpr int kReauthDialogHeight = 512; - static constexpr int kReauthDialogWidth = 448; - // Shows the User Manager or re-activates an existing one, focusing the // profile given by |profile_path_to_focus|; passing an empty base::FilePath // focuses no user pod. Based on the value of |tutorial_mode|, a tutorial @@ -58,6 +48,26 @@ static void AddOnUserManagerShownCallbackForTesting( const base::Closure& callback); + // Get the path of profile that is being signed in. + static base::FilePath GetSigninProfilePath(); + + private: + DISALLOW_IMPLICIT_CONSTRUCTORS(UserManager); +}; + +// Dialog that will be displayed when a profile is selected in UserManager. +class UserManagerProfileDialog { + public: + // Dimensions of the reauth dialog displaying the old-style signin flow with + // the username and password challenge on the same form. + static constexpr int kPasswordCombinedDialogHeight = 440; + static constexpr int kPasswordCombinedDialogWidth = 360; + + // Dimensions of the reauth dialog displaying the password-separated signin + // flow. + static constexpr int kDialogHeight = 512; + static constexpr int kDialogWidth = 448; + // Shows a dialog where the user can re-authenticate the profile with the // given |email|. This is called in the following scenarios: // -From the user manager when a profile is locked and the user's password is @@ -70,26 +80,27 @@ const std::string& email, signin_metrics::Reason reason); - // Hides the reauth dialog if it is showing. - static void HideReauthDialog(); - // Shows a dialog where the user logs into their profile for the first time // via the user manager. static void ShowSigninDialog(content::BrowserContext* browser_context, const base::FilePath& profile_path); + // Show the dialog and display local sign in error message without browser. + static void ShowDialogAndDisplayErrorMessage( + content::BrowserContext* browser_context); + // Display local sign in error message without browser. static void DisplayErrorMessage(); - // Get the path of profile that is being signed in. - static base::FilePath GetSigninProfilePath(); + // Hides the dialog if it is showing. + static void HideDialog(); // Abstract base class for performing online reauthentication of profiles in // the User Manager. It is concretely implemented in UserManagerMac and // UserManagerView to specialize the closing of the UI's dialog widgets. - class BaseReauthDialogDelegate : public content::WebContentsDelegate { + class BaseDialogDelegate : public content::WebContentsDelegate { public: - BaseReauthDialogDelegate(); + BaseDialogDelegate(); // content::WebContentsDelegate: bool HandleContextMenu(const content::ContextMenuParams& params) override; @@ -98,17 +109,14 @@ void LoadingStateChanged(content::WebContents* source, bool to_different_document) override; - private: - virtual void CloseReauthDialog() = 0; + protected: + virtual void CloseDialog() = 0; // WebContents of the embedded WebView. content::WebContents* guest_web_contents_; - DISALLOW_COPY_AND_ASSIGN(BaseReauthDialogDelegate); + DISALLOW_COPY_AND_ASSIGN(BaseDialogDelegate); }; - - private: - DISALLOW_COPY_AND_ASSIGN(UserManager); }; #endif // CHROME_BROWSER_UI_USER_MANAGER_H_
diff --git a/chrome/browser/ui/views/profiles/user_manager_view.cc b/chrome/browser/ui/views/profiles/user_manager_view.cc index e3cc5d3..f5f494a 100644 --- a/chrome/browser/ui/views/profiles/user_manager_view.cc +++ b/chrome/browser/ui/views/profiles/user_manager_view.cc
@@ -55,88 +55,81 @@ bool instance_under_construction_ = false; } // namespace -// ReauthDelegate--------------------------------------------------------------- +// Delegate--------------------------------------------------------------- -ReauthDelegate::ReauthDelegate(UserManagerView* parent, - views::WebView* web_view, - const std::string& email_address, - signin_metrics::Reason reason) - : parent_(parent), - web_view_(web_view), - email_address_(email_address) { +UserManagerProfileDialogDelegate::UserManagerProfileDialogDelegate( + UserManagerView* parent, + views::WebView* web_view, + const std::string& email_address, + const GURL& url) + : parent_(parent), web_view_(web_view), email_address_(email_address) { AddChildView(web_view_); SetLayoutManager(new views::FillLayout()); web_view_->GetWebContents()->SetDelegate(this); - - // Load the re-auth URL, prepopulated with the user's email address. - // Add the index of the profile to the URL so that the inline login page - // knows which profile to load and update the credentials. - GURL url = signin::GetReauthURLWithEmail( - signin_metrics::AccessPoint::ACCESS_POINT_USER_MANAGER, reason, - email_address_); web_view_->LoadInitialURL(url); } -ReauthDelegate::~ReauthDelegate() {} +UserManagerProfileDialogDelegate::~UserManagerProfileDialogDelegate() {} -gfx::Size ReauthDelegate::GetPreferredSize() const { - return switches::UsePasswordSeparatedSigninFlow() ? - gfx::Size(UserManager::kReauthDialogWidth, - UserManager::kReauthDialogHeight) : - gfx::Size(UserManager::kPasswordCombinedReauthDialogWidth, - UserManager::kPasswordCombinedReauthDialogHeight); +gfx::Size UserManagerProfileDialogDelegate::GetPreferredSize() const { + return switches::UsePasswordSeparatedSigninFlow() + ? gfx::Size(UserManagerProfileDialog::kDialogWidth, + UserManagerProfileDialog::kDialogHeight) + : gfx::Size( + UserManagerProfileDialog::kPasswordCombinedDialogWidth, + UserManagerProfileDialog::kPasswordCombinedDialogHeight); } -void ReauthDelegate::DisplayErrorMessage() { +void UserManagerProfileDialogDelegate::DisplayErrorMessage() { web_view_->LoadInitialURL(GURL(chrome::kChromeUISigninErrorURL)); } -bool ReauthDelegate::CanResize() const { +bool UserManagerProfileDialogDelegate::CanResize() const { return true; } -bool ReauthDelegate::CanMaximize() const { +bool UserManagerProfileDialogDelegate::CanMaximize() const { return true; } -bool ReauthDelegate::CanMinimize() const { +bool UserManagerProfileDialogDelegate::CanMinimize() const { return true; } -bool ReauthDelegate::ShouldUseCustomFrame() const { +bool UserManagerProfileDialogDelegate::ShouldUseCustomFrame() const { return false; } -ui::ModalType ReauthDelegate::GetModalType() const { +ui::ModalType UserManagerProfileDialogDelegate::GetModalType() const { return ui::MODAL_TYPE_WINDOW; } -void ReauthDelegate::DeleteDelegate() { - OnReauthDialogDestroyed(); +void UserManagerProfileDialogDelegate::DeleteDelegate() { + OnDialogDestroyed(); delete this; } -base::string16 ReauthDelegate::GetWindowTitle() const { +base::string16 UserManagerProfileDialogDelegate::GetWindowTitle() const { return l10n_util::GetStringUTF16(IDS_PROFILES_GAIA_SIGNIN_TITLE); } -int ReauthDelegate::GetDialogButtons() const { +int UserManagerProfileDialogDelegate::GetDialogButtons() const { return ui::DIALOG_BUTTON_NONE; } -views::View* ReauthDelegate::GetInitiallyFocusedView() { +views::View* UserManagerProfileDialogDelegate::GetInitiallyFocusedView() { return static_cast<views::View*>(web_view_); } -void ReauthDelegate::CloseReauthDialog() { - OnReauthDialogDestroyed(); +void UserManagerProfileDialogDelegate::CloseDialog() { + OnDialogDestroyed(); GetWidget()->Close(); } -void ReauthDelegate::OnReauthDialogDestroyed() { +void UserManagerProfileDialogDelegate::OnDialogDestroyed() { if (parent_) { - parent_->OnReauthDialogDestroyed(); + parent_->OnDialogDestroyed(); parent_ = nullptr; } } @@ -209,23 +202,6 @@ } // static -void UserManager::ShowReauthDialog(content::BrowserContext* browser_context, - const std::string& email, - signin_metrics::Reason reason) { - // This method should only be called if the user manager is already showing. - if (!IsShowing()) - return; - instance_->ShowReauthDialog(browser_context, email, reason); -} - -// static -void UserManager::HideReauthDialog() { - // This method should only be called if the user manager is already showing. - if (instance_ && instance_->GetWidget()->IsVisible()) - instance_->HideReauthDialog(); -} - -// static void UserManager::AddOnUserManagerShownCallbackForTesting( const base::Closure& callback) { DCHECK(!user_manager_shown_callback_for_testing_); @@ -233,25 +209,61 @@ } // static -void UserManager::ShowSigninDialog(content::BrowserContext* browser_context, - const base::FilePath& profile_path) { - if (!IsShowing()) +base::FilePath UserManager::GetSigninProfilePath() { + return instance_->GetSigninProfilePath(); +} + +// UserManagerProfileDialog +// ------------------------------------------------------------- + +// static +void UserManagerProfileDialog::ShowReauthDialog( + content::BrowserContext* browser_context, + const std::string& email, + signin_metrics::Reason reason) { + // This method should only be called if the user manager is already showing. + if (!UserManager::IsShowing()) return; - instance_->SetSigninProfilePath(profile_path); - ShowReauthDialog(browser_context, std::string(), - signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT); + // Load the re-auth URL, prepopulated with the user's email address. + // Add the index of the profile to the URL so that the inline login page + // knows which profile to load and update the credentials. + GURL url = signin::GetReauthURLWithEmail( + signin_metrics::AccessPoint::ACCESS_POINT_USER_MANAGER, reason, email); + instance_->ShowDialog(browser_context, email, url); } // static -void UserManager::DisplayErrorMessage() { +void UserManagerProfileDialog::ShowSigninDialog( + content::BrowserContext* browser_context, + const base::FilePath& profile_path) { + if (!UserManager::IsShowing()) + return; + instance_->SetSigninProfilePath(profile_path); + GURL url = signin::GetPromoURL( + signin_metrics::AccessPoint::ACCESS_POINT_USER_MANAGER, + signin_metrics::Reason::REASON_SIGNIN_PRIMARY_ACCOUNT, true, true); + instance_->ShowDialog(browser_context, std::string(), url); +} + +void UserManagerProfileDialog::ShowDialogAndDisplayErrorMessage( + content::BrowserContext* browser_context) { + if (!UserManager::IsShowing()) + return; + instance_->ShowDialog(browser_context, std::string(), + GURL(chrome::kChromeUISigninErrorURL)); +} + +// static +void UserManagerProfileDialog::DisplayErrorMessage() { // This method should only be called if the user manager is already showing. DCHECK(instance_); instance_->DisplayErrorMessage(); } // static -base::FilePath UserManager::GetSigninProfilePath() { - return instance_->GetSigninProfilePath(); +void UserManagerProfileDialog::HideDialog() { + if (instance_ && instance_->GetWidget()->IsVisible()) + instance_->HideDialog(); } // UserManagerView ------------------------------------------------------------- @@ -265,7 +277,7 @@ } UserManagerView::~UserManagerView() { - HideReauthDialog(); + HideDialog(); } // static @@ -283,29 +295,27 @@ instance_->Init(system_profile, GURL(url)); } -void UserManagerView::ShowReauthDialog(content::BrowserContext* browser_context, - const std::string& email, - signin_metrics::Reason reason) { - HideReauthDialog(); +void UserManagerView::ShowDialog(content::BrowserContext* browser_context, + const std::string& email, + const GURL& url) { + HideDialog(); // The dialog delegate will be deleted when the widget closes. The created // WebView's lifetime is managed by the delegate. - delegate_ = new ReauthDelegate(this, - new views::WebView(browser_context), - email, - reason); + delegate_ = new UserManagerProfileDialogDelegate( + this, new views::WebView(browser_context), email, url); gfx::NativeView parent = instance_->GetWidget()->GetNativeView(); views::DialogDelegate::CreateDialogWidget(delegate_, nullptr, parent); delegate_->GetWidget()->Show(); } -void UserManagerView::HideReauthDialog() { +void UserManagerView::HideDialog() { if (delegate_) { - delegate_->CloseReauthDialog(); + delegate_->CloseDialog(); DCHECK(!delegate_); } } -void UserManagerView::OnReauthDialogDestroyed() { +void UserManagerView::OnDialogDestroyed() { delegate_ = nullptr; }
diff --git a/chrome/browser/ui/views/profiles/user_manager_view.h b/chrome/browser/ui/views/profiles/user_manager_view.h index 5ec3fd9..e140aab 100644 --- a/chrome/browser/ui/views/profiles/user_manager_view.h +++ b/chrome/browser/ui/views/profiles/user_manager_view.h
@@ -19,27 +19,28 @@ class ScopedKeepAlive; class UserManagerView; -class ReauthDelegate : public views::DialogDelegateView, - public UserManager::BaseReauthDialogDelegate { +class UserManagerProfileDialogDelegate + : public views::DialogDelegateView, + public UserManagerProfileDialog::BaseDialogDelegate { public: - ReauthDelegate(UserManagerView* parent, - views::WebView* web_view, - const std::string& email_address, - signin_metrics::Reason reason); - ~ReauthDelegate() override; + UserManagerProfileDialogDelegate(UserManagerView* parent, + views::WebView* web_view, + const std::string& email_address, + const GURL& url); + ~UserManagerProfileDialogDelegate() override; - // UserManager::BaseReauthDialogDelegate: - void CloseReauthDialog() override; + // UserManagerProfileDialog::BaseDialogDelegate + void CloseDialog() override; // Display the local error message inside login window. void DisplayErrorMessage(); private: - ReauthDelegate(); + UserManagerProfileDialogDelegate(); // Before its destruction, tells its parent container to reset its reference - // to the ReauthDelegate. - void OnReauthDialogDestroyed(); + // to the UserManagerProfileDialogDelegate. + void OnDialogDestroyed(); // views::DialogDelegate: gfx::Size GetPreferredSize() const override; @@ -57,7 +58,7 @@ views::WebView* web_view_; const std::string email_address_; - DISALLOW_COPY_AND_ASSIGN(ReauthDelegate); + DISALLOW_COPY_AND_ASSIGN(UserManagerProfileDialogDelegate); }; namespace views { @@ -85,20 +86,14 @@ // Logs how long it took the UserManager to open. void LogTimeToOpen(); - // Shows a dialog where the user can re-authenticate the profile with the - // given |email|. This is called in the following scenarios: - // -From the user manager when a profile is locked and the user's password is - // detected to have been changed. - // -From the user manager when a custodian account needs to be - // reauthenticated. - // reason| can be REASON_UNLOCK or REASON_REAUTHENTICATION to indicate - // whether this is a reauth or unlock scenario. - void ShowReauthDialog(content::BrowserContext* browser_context, - const std::string& email, - signin_metrics::Reason reason); - // Hides the reauth dialog if it is showing. - void HideReauthDialog(); + void HideDialog(); + + // Show a dialog where the user can auth the profile or see the auth error + // message. + void ShowDialog(content::BrowserContext* browser_context, + const std::string& email, + const GURL& url); // Display sign in error message that is created by Chrome but not GAIA // without browser window. @@ -110,13 +105,13 @@ base::FilePath GetSigninProfilePath(); private: - friend class ReauthDelegate; + friend class UserManagerProfileDialogDelegate; friend std::default_delete<UserManagerView>; ~UserManagerView() override; // Resets delegate_ to nullptr when delegate_ is no longer alive. - void OnReauthDialogDestroyed(); + void OnDialogDestroyed(); // Creates dialog and initializes UI. void Init(Profile* guest_profile, const GURL& url); @@ -136,7 +131,7 @@ views::WebView* web_view_; - ReauthDelegate* delegate_; + UserManagerProfileDialogDelegate* delegate_; std::unique_ptr<ScopedKeepAlive> keep_alive_; base::Time user_manager_started_showing_;
diff --git a/chrome/browser/ui/webui/profile_helper.cc b/chrome/browser/ui/webui/profile_helper.cc index 217cfaf..a026e24 100644 --- a/chrome/browser/ui/webui/profile_helper.cc +++ b/chrome/browser/ui/webui/profile_helper.cc
@@ -26,7 +26,8 @@ void ShowSigninDialog(base::FilePath signin_profile_path, Profile* system_profile, Profile::CreateStatus status) { - UserManager::ShowSigninDialog(system_profile, signin_profile_path); + UserManagerProfileDialog::ShowSigninDialog(system_profile, + signin_profile_path); } void DeleteProfileCallback(std::unique_ptr<ScopedKeepAlive> keep_alive,
diff --git a/chrome/browser/ui/webui/signin/inline_login_handler.cc b/chrome/browser/ui/webui/signin/inline_login_handler.cc index e9a1901..cac43a17 100644 --- a/chrome/browser/ui/webui/signin/inline_login_handler.cc +++ b/chrome/browser/ui/webui/signin/inline_login_handler.cc
@@ -285,5 +285,5 @@ browser->CloseModalSigninWindow(); // Does nothing if user manager is not showing. - UserManager::HideReauthDialog(); + UserManagerProfileDialog::HideDialog(); }
diff --git a/chrome/browser/ui/webui/signin/login_ui_service.cc b/chrome/browser/ui/webui/signin/login_ui_service.cc index dad71a8..80899978 100644 --- a/chrome/browser/ui/webui/signin/login_ui_service.cc +++ b/chrome/browser/ui/webui/signin/login_ui_service.cc
@@ -77,7 +77,7 @@ if (browser) browser->ShowModalSigninErrorWindow(); else - UserManager::DisplayErrorMessage(); + UserManagerProfileDialog::DisplayErrorMessage(); } else if (browser) { browser->window()->ShowAvatarBubbleFromAvatarButton( error_message.empty() ? BrowserWindow::AVATAR_BUBBLE_MODE_CONFIRM_SIGNIN
diff --git a/chrome/browser/ui/webui/signin/signin_create_profile_handler.cc b/chrome/browser/ui/webui/signin/signin_create_profile_handler.cc index 16355766..299151962 100644 --- a/chrome/browser/ui/webui/signin/signin_create_profile_handler.cc +++ b/chrome/browser/ui/webui/signin/signin_create_profile_handler.cc
@@ -429,8 +429,8 @@ } void SigninCreateProfileHandler::OpenSigninDialogForProfile(Profile* profile) { - UserManager::ShowSigninDialog(web_ui()->GetWebContents()->GetBrowserContext(), - profile->GetPath()); + UserManagerProfileDialog::ShowSigninDialog( + web_ui()->GetWebContents()->GetBrowserContext(), profile->GetPath()); } void SigninCreateProfileHandler::ShowProfileCreationError(
diff --git a/chrome/browser/ui/webui/signin/signin_error_handler.cc b/chrome/browser/ui/webui/signin/signin_error_handler.cc index 4111b6a..c42f4a03 100644 --- a/chrome/browser/ui/webui/signin/signin_error_handler.cc +++ b/chrome/browser/ui/webui/signin/signin_error_handler.cc
@@ -83,7 +83,7 @@ if (is_system_profile_) { // Avoid closing the user manager window when the error message is displayed // without browser window. - UserManager::HideReauthDialog(); + UserManagerProfileDialog::HideDialog(); } else { Browser* browser = signin::GetDesktopBrowser(web_ui()); DCHECK(browser);
diff --git a/chrome/browser/ui/webui/signin/signin_error_ui.cc b/chrome/browser/ui/webui/signin/signin_error_ui.cc index 79b2e445..49300738 100644 --- a/chrome/browser/ui/webui/signin/signin_error_ui.cc +++ b/chrome/browser/ui/webui/signin/signin_error_ui.cc
@@ -42,6 +42,9 @@ if (is_system_profile) { signin_profile = g_browser_process->profile_manager()->GetProfileByPath( UserManager::GetSigninProfilePath()); + // Sign in is completed before profile creation. + if (!signin_profile) + signin_profile = webui_profile->GetOriginalProfile(); } else { signin_profile = webui_profile; }
diff --git a/chrome/browser/ui/webui/signin/signin_supervised_user_import_handler.cc b/chrome/browser/ui/webui/signin/signin_supervised_user_import_handler.cc index d87cdb2..5cb3448a 100644 --- a/chrome/browser/ui/webui/signin/signin_supervised_user_import_handler.cc +++ b/chrome/browser/ui/webui/signin/signin_supervised_user_import_handler.cc
@@ -139,7 +139,7 @@ bool success = args->GetString(0, &email); DCHECK(success); - UserManager::ShowReauthDialog( + UserManagerProfileDialog::ShowReauthDialog( web_ui()->GetWebContents()->GetBrowserContext(), email, signin_metrics::Reason::REASON_REAUTHENTICATION); }
diff --git a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc index 22351cf..5cae011 100644 --- a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc +++ b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc
@@ -43,6 +43,8 @@ #include "chrome/browser/ui/singleton_tabs.h" #include "chrome/browser/ui/user_manager.h" #include "chrome/browser/ui/webui/profile_helper.h" +#include "chrome/browser/ui/webui/signin/login_ui_service.h" +#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" #include "chrome/common/chrome_features.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" @@ -462,11 +464,22 @@ if (!email_address_.empty()) { // In order to support the upgrade case where we have a local hash but no // password token, the user must perform a full online reauth. - UserManager::ShowReauthDialog(browser_context, email_address_, - signin_metrics::Reason::REASON_UNLOCK); + UserManagerProfileDialog::ShowReauthDialog( + browser_context, email_address_, signin_metrics::Reason::REASON_UNLOCK); + } else if (entry->IsSigninRequired() && entry->IsSupervised()) { + // Supervised profile will only be locked when force-sign-in is enabled + // and it shouldn't be unlocked. Display the error message directly via + // the system profile to avoid profile creation. + LoginUIServiceFactory::GetForProfile( + Profile::FromWebUI(web_ui())->GetOriginalProfile()) + ->DisplayLoginResult(nullptr, + l10n_util::GetStringUTF16( + IDS_SUPERVISED_USER_NOT_ALLOWED_BY_POLICY), + base::string16()); + UserManagerProfileDialog::ShowDialogAndDisplayErrorMessage(browser_context); } else { // Fresh sign in via user manager without existing email address. - UserManager::ShowSigninDialog(browser_context, profile_path); + UserManagerProfileDialog::ShowSigninDialog(browser_context, profile_path); } } @@ -691,9 +704,9 @@ // Password has changed. Go through online signin flow. DCHECK(!email_address_.empty()); oauth_client_.reset(); - UserManager::ShowReauthDialog(web_ui()->GetWebContents()->GetBrowserContext(), - email_address_, - signin_metrics::Reason::REASON_UNLOCK); + UserManagerProfileDialog::ShowReauthDialog( + web_ui()->GetWebContents()->GetBrowserContext(), email_address_, + signin_metrics::Reason::REASON_UNLOCK); } void UserManagerScreenHandler::OnNetworkError(int response_code) {
diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc index f8eeda9e..20ba8876 100644 --- a/chrome/common/chrome_content_client.cc +++ b/chrome/common/chrome_content_client.cc
@@ -26,7 +26,6 @@ #include "build/build_config.h" #include "chrome/common/child_process_logging.h" #include "chrome/common/chrome_constants.h" -#include "chrome/common/chrome_features.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/crash_keys.h" @@ -273,13 +272,6 @@ } bool GetCommandLinePepperFlash(content::PepperPluginInfo* plugin) { -#if defined(OS_CHROMEOS) - // On Chrome OS, we cannot test component flash updates reliably unless we - // guarantee that the component updated flash plugin will be used. - if (base::FeatureList::IsEnabled(features::kComponentFlashOnly)) - return false; -#endif // defined(OS_CHROMEOS) - const base::CommandLine::StringType flash_path = base::CommandLine::ForCurrentProcess()->GetSwitchValueNative( switches::kPpapiFlashPath);
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc index 4169a1a..34bec2b 100644 --- a/chrome/common/chrome_features.cc +++ b/chrome/common/chrome_features.cc
@@ -230,14 +230,6 @@ // Enables or disables emoji, handwriting and voice input on opt-in IME menu. const base::Feature kEHVInputOnImeMenu{"EmojiHandwritingVoiceInput", base::FEATURE_DISABLED_BY_DEFAULT}; - -// Enables or disables flash component updates on Chrome OS. -const base::Feature kCrosCompUpdates{"CrosCompUpdates", - base::FEATURE_DISABLED_BY_DEFAULT}; - -// Enable or disable using only the component flash plugin on Chrome OS. -const base::Feature kComponentFlashOnly{"ComponentFlashOnly", - base::FEATURE_DISABLED_BY_DEFAULT}; #endif // defined(OS_CHROMEOS) } // namespace features
diff --git a/chrome/common/chrome_features.h b/chrome/common/chrome_features.h index 1fc8eda..4155a53 100644 --- a/chrome/common/chrome_features.h +++ b/chrome/common/chrome_features.h
@@ -133,10 +133,6 @@ extern const base::Feature kQuickUnlockPin; extern const base::Feature kEHVInputOnImeMenu; - -extern const base::Feature kCrosCompUpdates; - -extern const base::Feature kComponentFlashOnly; #endif // defined(OS_CHROMEOS) // DON'T ADD RANDOM STUFF HERE. Put it in the main section above in
diff --git a/chrome/common/chrome_utility_messages.h b/chrome/common/chrome_utility_messages.h index 99af34bc..4bc2f0a 100644 --- a/chrome/common/chrome_utility_messages.h +++ b/chrome/common/chrome_utility_messages.h
@@ -144,17 +144,17 @@ // and place the output in |output_file|. The patch should use the bsdiff // algorithm (Courgette's version). IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_PatchFileBsdiff, - base::FilePath /* input_file */, - base::FilePath /* patch_file */, - base::FilePath /* output_file */) + IPC::PlatformFileForTransit /* input_file */, + IPC::PlatformFileForTransit /* patch_file */, + IPC::PlatformFileForTransit /* output_file */) // Tell the utility process to patch the given |input_file| using |patch_file| // and place the output in |output_file|. The patch should use the Courgette // algorithm. IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_PatchFileCourgette, - base::FilePath /* input_file */, - base::FilePath /* patch_file */, - base::FilePath /* output_file */) + IPC::PlatformFileForTransit /* input_file */, + IPC::PlatformFileForTransit /* patch_file */, + IPC::PlatformFileForTransit /* output_file */) #if defined(OS_CHROMEOS) // Tell the utility process to create a zip file on the given list of files.
diff --git a/chrome/installer/mac/BUILD.gn b/chrome/installer/mac/BUILD.gn index 748aca1..924478a 100644 --- a/chrome/installer/mac/BUILD.gn +++ b/chrome/installer/mac/BUILD.gn
@@ -69,7 +69,7 @@ "sign_installer_tools.sh", ] - if (enable_mac_keystone) { + if (is_chrome_branded) { sources += [ "keystone_install.sh" ] }
diff --git a/chrome/renderer/chrome_render_thread_observer.h b/chrome/renderer/chrome_render_thread_observer.h index 06a1daa..0549d02 100644 --- a/chrome/renderer/chrome_render_thread_observer.h +++ b/chrome/renderer/chrome_render_thread_observer.h
@@ -16,9 +16,6 @@ #include "components/variations/child_process_field_trial_syncer.h" #include "content/public/renderer/render_thread_observer.h" -class GURL; -struct ContentSettings; - namespace content { class ResourceDispatcherDelegate; } @@ -57,10 +54,7 @@ const std::string& group_name) override; void OnSetIsIncognitoProcess(bool is_incognito_process); - void OnSetContentSettingsForCurrentURL( - const GURL& url, const ContentSettings& content_settings); void OnSetContentSettingRules(const RendererContentSettingRules& rules); - void OnGetCacheResourceStats(); void OnSetFieldTrialGroup(const std::string& trial_name, const std::string& group_name);
diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc index 0d2d215..f364d639 100644 --- a/chrome/utility/chrome_content_utility_client.cc +++ b/chrome/utility/chrome_content_utility_client.cc
@@ -265,33 +265,26 @@ #endif // defined(OS_CHROMEOS) void ChromeContentUtilityClient::OnPatchFileBsdiff( - const base::FilePath& input_file, - const base::FilePath& patch_file, - const base::FilePath& output_file) { - if (input_file.empty() || patch_file.empty() || output_file.empty()) { - Send(new ChromeUtilityHostMsg_PatchFile_Finished(-1)); - } else { - const int patch_status = bsdiff::ApplyBinaryPatch(input_file, - patch_file, - output_file); - Send(new ChromeUtilityHostMsg_PatchFile_Finished(patch_status)); - } + const IPC::PlatformFileForTransit& input_file, + const IPC::PlatformFileForTransit& patch_file, + const IPC::PlatformFileForTransit& output_file) { + const int patch_status = bsdiff::ApplyBinaryPatch( + IPC::PlatformFileForTransitToFile(input_file), + IPC::PlatformFileForTransitToFile(patch_file), + IPC::PlatformFileForTransitToFile(output_file)); + Send(new ChromeUtilityHostMsg_PatchFile_Finished(patch_status)); ReleaseProcessIfNeeded(); } void ChromeContentUtilityClient::OnPatchFileCourgette( - const base::FilePath& input_file, - const base::FilePath& patch_file, - const base::FilePath& output_file) { - if (input_file.empty() || patch_file.empty() || output_file.empty()) { - Send(new ChromeUtilityHostMsg_PatchFile_Finished(-1)); - } else { - const int patch_status = courgette::ApplyEnsemblePatch( - input_file.value().c_str(), - patch_file.value().c_str(), - output_file.value().c_str()); - Send(new ChromeUtilityHostMsg_PatchFile_Finished(patch_status)); - } + const IPC::PlatformFileForTransit& input_file, + const IPC::PlatformFileForTransit& patch_file, + const IPC::PlatformFileForTransit& output_file) { + const int patch_status = courgette::ApplyEnsemblePatch( + IPC::PlatformFileForTransitToFile(input_file), + IPC::PlatformFileForTransitToFile(patch_file), + IPC::PlatformFileForTransitToFile(output_file)); + Send(new ChromeUtilityHostMsg_PatchFile_Finished(patch_status)); ReleaseProcessIfNeeded(); }
diff --git a/chrome/utility/chrome_content_utility_client.h b/chrome/utility/chrome_content_utility_client.h index c1c8eb7..4479489 100644 --- a/chrome/utility/chrome_content_utility_client.h +++ b/chrome/utility/chrome_content_utility_client.h
@@ -50,12 +50,12 @@ const base::FileDescriptor& dest_fd); #endif // defined(OS_CHROMEOS) - void OnPatchFileBsdiff(const base::FilePath& input_file, - const base::FilePath& patch_file, - const base::FilePath& output_file); - void OnPatchFileCourgette(const base::FilePath& input_file, - const base::FilePath& patch_file, - const base::FilePath& output_file); + void OnPatchFileBsdiff(const IPC::PlatformFileForTransit& input_file, + const IPC::PlatformFileForTransit& patch_file, + const IPC::PlatformFileForTransit& output_file); + void OnPatchFileCourgette(const IPC::PlatformFileForTransit& input_file, + const IPC::PlatformFileForTransit& patch_file, + const IPC::PlatformFileForTransit& output_file); void OnStartupPing(); #if defined(FULL_SAFE_BROWSING) void OnAnalyzeZipFileForDownloadProtection(
diff --git a/chromecast/BUILD.gn b/chromecast/BUILD.gn index 961ae91..c2ab7a3 100644 --- a/chromecast/BUILD.gn +++ b/chromecast/BUILD.gn
@@ -139,12 +139,13 @@ content_unittests_filter = { test_name = "content_unittests" + gtest_excludes = [] if (target_os == "linux" && !is_cast_desktop_build) { # DesktopCaptureDeviceTest.*: No capture device on Eureka # Disable PepperGamepadHostTest.WaitForReply (pepper not supported on Eureka) # Disable GpuDataManagerImplPrivateTest.SetGLStrings and # RenderWidgetHostTest.Background because we disable the blacklist to enable WebGL (b/16142554) - gtest_excludes = [ + gtest_excludes += [ "DOMStorageDatabaseTest.TestCanOpenAndReadWebCoreDatabase", "DesktopCaptureDeviceTest.Capture", "GamepadProviderTest.PollingAccess", @@ -153,6 +154,10 @@ "RenderWidgetHostTest.Background", ] } + if (is_cast_audio_only) { + # No way to display URL's on audio only cast devices. + gtest_excludes += [ "NavigationEntryTest.NavigationEntryURLs" ] + } } filters += [ content_unittests_filter ]
diff --git a/components/bookmarks/browser/BUILD.gn b/components/bookmarks/browser/BUILD.gn index 05e8125..756ad78 100644 --- a/components/bookmarks/browser/BUILD.gn +++ b/components/bookmarks/browser/BUILD.gn
@@ -39,6 +39,7 @@ "scoped_group_bookmark_actions.h", "startup_task_runner_service.cc", "startup_task_runner_service.h", + "titled_url_node.h", ] public_deps = [
diff --git a/components/bookmarks/browser/bookmark_index.cc b/components/bookmarks/browser/bookmark_index.cc index 14d1dedc..55d514c 100644 --- a/components/bookmarks/browser/bookmark_index.cc +++ b/components/bookmarks/browser/bookmark_index.cc
@@ -6,11 +6,6 @@ #include <stdint.h> -#include <algorithm> -#include <functional> -#include <iterator> -#include <list> - #include "base/i18n/case_conversion.h" #include "base/logging.h" #include "base/stl_util.h" @@ -18,8 +13,8 @@ #include "build/build_config.h" #include "components/bookmarks/browser/bookmark_client.h" #include "components/bookmarks/browser/bookmark_match.h" -#include "components/bookmarks/browser/bookmark_node.h" #include "components/bookmarks/browser/bookmark_utils.h" +#include "components/bookmarks/browser/titled_url_node.h" #include "components/query_parser/snippet.h" #include "third_party/icu/source/common/unicode/normalizer2.h" #include "third_party/icu/source/common/unicode/utypes.h" @@ -30,7 +25,7 @@ namespace { -using UrlNodeMap = std::unordered_map<const GURL*, const BookmarkNode*>; +using UrlNodeMap = std::unordered_map<const GURL*, const TitledUrlNode*>; using UrlTypedCountPair = std::pair<const GURL*, int>; using UrlTypedCountPairs = std::vector<UrlTypedCountPair>; @@ -57,9 +52,8 @@ unicode_normalized_text.length()); } -// Sort functor for sorting bookmark URLs by typed count. We sort in decreasing -// order of typed count so that the best matches will always be added to the -// results. +// Sort functor for UrlTypedCountPairs. We sort in decreasing order of typed +// count so that the best matches will always be added to the results. struct UrlTypedCountPairSortFunctor { bool operator()(const UrlTypedCountPair& a, const UrlTypedCountPair& b) const { @@ -67,15 +61,15 @@ } }; -// Extract the GURL stored in a BookmarkClient::UrlTypedCountPair and use it to -// look up the corresponding BookmarkNode. +// Extract the GURL stored in an UrlTypedCountPair and use it to look up the +// corresponding TitledUrlNode. class UrlTypedCountPairNodeLookupFunctor { public: explicit UrlTypedCountPairNodeLookupFunctor(UrlNodeMap& url_node_map) : url_node_map_(url_node_map) { } - const BookmarkNode* operator()(const UrlTypedCountPair& pair) const { + const TitledUrlNode* operator()(const UrlTypedCountPair& pair) const { return url_node_map_[pair.first]; } @@ -93,34 +87,29 @@ BookmarkIndex::~BookmarkIndex() { } -void BookmarkIndex::Add(const BookmarkNode* node) { - if (!node->is_url()) - return; +void BookmarkIndex::Add(const TitledUrlNode* node) { std::vector<base::string16> terms = - ExtractQueryWords(Normalize(node->GetTitle())); + ExtractQueryWords(Normalize(node->GetTitledUrlNodeTitle())); for (size_t i = 0; i < terms.size(); ++i) RegisterNode(terms[i], node); - terms = - ExtractQueryWords(CleanUpUrlForMatching(node->url(), nullptr)); + terms = ExtractQueryWords( + CleanUpUrlForMatching(node->GetTitledUrlNodeUrl(), nullptr)); for (size_t i = 0; i < terms.size(); ++i) RegisterNode(terms[i], node); } -void BookmarkIndex::Remove(const BookmarkNode* node) { - if (!node->is_url()) - return; - +void BookmarkIndex::Remove(const TitledUrlNode* node) { std::vector<base::string16> terms = - ExtractQueryWords(Normalize(node->GetTitle())); + ExtractQueryWords(Normalize(node->GetTitledUrlNodeTitle())); for (size_t i = 0; i < terms.size(); ++i) UnregisterNode(terms[i], node); - terms = - ExtractQueryWords(CleanUpUrlForMatching(node->url(), nullptr)); + terms = ExtractQueryWords( + CleanUpUrlForMatching(node->GetTitledUrlNodeUrl(), nullptr)); for (size_t i = 0; i < terms.size(); ++i) UnregisterNode(terms[i], node); } -void BookmarkIndex::GetBookmarksMatching( +void BookmarkIndex::GetResultsMatching( const base::string16& input_query, size_t max_count, query_parser::MatchingAlgorithm matching_algorithm, @@ -130,15 +119,15 @@ if (terms.empty()) return; - NodeSet matches; + TitledUrlNodeSet matches; for (size_t i = 0; i < terms.size(); ++i) { - if (!GetBookmarksMatchingTerm( - terms[i], i == 0, matching_algorithm, &matches)) { + if (!GetResultsMatchingTerm(terms[i], i == 0, matching_algorithm, + &matches)) { return; } } - Nodes sorted_nodes; + TitledUrlNodes sorted_nodes; SortMatches(matches, &sorted_nodes); // We use a QueryParser to fill in match positions for us. It's not the most @@ -153,21 +142,22 @@ // that calculates result relevance in HistoryContentsProvider::ConvertResults // will run backwards to assure higher relevance will be attributed to the // best matches. - for (Nodes::const_iterator i = sorted_nodes.begin(); + for (TitledUrlNodes::const_iterator i = sorted_nodes.begin(); i != sorted_nodes.end() && results->size() < max_count; ++i) AddMatchToResults(*i, &parser, query_nodes, results); } -void BookmarkIndex::SortMatches(const NodeSet& matches, - Nodes* sorted_nodes) const { +void BookmarkIndex::SortMatches(const TitledUrlNodeSet& matches, + TitledUrlNodes* sorted_nodes) const { sorted_nodes->reserve(matches.size()); if (client_->SupportsTypedCountForUrls()) { UrlNodeMap url_node_map; UrlTypedCountMap url_typed_count_map; for (auto node : matches) { - url_node_map.insert(std::make_pair(&node->url(), node)); - url_typed_count_map.insert(std::make_pair(&node->url(), 0)); + const GURL& url = node->GetTitledUrlNodeUrl(); + url_node_map.insert(std::make_pair(&url, node)); + url_typed_count_map.insert(std::make_pair(&url, 0)); } client_->GetTypedCountForUrls(&url_typed_count_map); @@ -189,7 +179,7 @@ } void BookmarkIndex::AddMatchToResults( - const BookmarkNode* node, + const TitledUrlNode* node, query_parser::QueryParser* parser, const query_parser::QueryNodeVector& query_nodes, std::vector<BookmarkMatch>* results) { @@ -199,15 +189,15 @@ // Check that the result matches the query. The previous search // was a simple per-word search, while the more complex matching // of QueryParser may filter it out. For example, the query - // ["thi"] will match the bookmark titled [Thinking], but since + // ["thi"] will match the title [Thinking], but since // ["thi"] is quoted we don't want to do a prefix match. query_parser::QueryWordVector title_words, url_words; const base::string16 lower_title = - base::i18n::ToLower(Normalize(node->GetTitle())); + base::i18n::ToLower(Normalize(node->GetTitledUrlNodeTitle())); parser->ExtractQueryWords(lower_title, &title_words); base::OffsetAdjuster::Adjustments adjustments; parser->ExtractQueryWords( - CleanUpUrlForMatching(node->url(), &adjustments), + CleanUpUrlForMatching(node->GetTitledUrlNodeUrl(), &adjustments), &url_words); query_parser::Snippet::MatchPositions title_matches, url_matches; for (const auto& node : query_nodes) { @@ -220,7 +210,7 @@ query_parser::QueryParser::SortAndCoalesceMatchPositions(&url_matches); } BookmarkMatch match; - if (lower_title.length() == node->GetTitle().length()) { + if (lower_title.length() == node->GetTitledUrlNodeTitle().length()) { // Only use title matches if the lowercase string is the same length // as the original string, otherwise the matches are meaningless. // TODO(mpearson): revise match positions appropriately. @@ -239,11 +229,11 @@ results->push_back(match); } -bool BookmarkIndex::GetBookmarksMatchingTerm( +bool BookmarkIndex::GetResultsMatchingTerm( const base::string16& term, bool first_term, query_parser::MatchingAlgorithm matching_algorithm, - NodeSet* matches) { + TitledUrlNodeSet* matches) { Index::const_iterator i = index_.lower_bound(term); if (i == index_.end()) return false; @@ -252,20 +242,21 @@ term, matching_algorithm)) { // Term is too short for prefix match, compare using exact match. if (i->first != term) - return false; // No bookmarks with this term. + return false; // No title/URL pairs with this term. if (first_term) { (*matches) = i->second; return true; } - *matches = base::STLSetIntersection<NodeSet>(i->second, *matches); + *matches = base::STLSetIntersection<TitledUrlNodeSet>(i->second, *matches); } else { // Loop through index adding all entries that start with term to // |prefix_matches|. - NodeSet tmp_prefix_matches; + TitledUrlNodeSet tmp_prefix_matches; // If this is the first term, then store the result directly in |matches| // to avoid calling stl intersection (which requires a copy). - NodeSet* prefix_matches = first_term ? matches : &tmp_prefix_matches; + TitledUrlNodeSet* prefix_matches = + first_term ? matches : &tmp_prefix_matches; while (i != index_.end() && i->first.size() >= term.size() && term.compare(0, term.size(), i->first, 0, term.size()) == 0) { @@ -274,14 +265,17 @@ #else // Work around a bug in the implementation of std::set::insert in the STL // used on android (http://crbug.com/367050). - for (NodeSet::const_iterator n = i->second.begin(); n != i->second.end(); + for (TitledUrlNodeSet::const_iterator n = i->second.begin(); + n != i->second.end(); ++n) prefix_matches->insert(prefix_matches->end(), *n); #endif ++i; } - if (!first_term) - *matches = base::STLSetIntersection<NodeSet>(*prefix_matches, *matches); + if (!first_term) { + *matches = + base::STLSetIntersection<TitledUrlNodeSet>(*prefix_matches, *matches); + } } return !matches->empty(); } @@ -299,16 +293,16 @@ } void BookmarkIndex::RegisterNode(const base::string16& term, - const BookmarkNode* node) { + const TitledUrlNode* node) { index_[term].insert(node); } void BookmarkIndex::UnregisterNode(const base::string16& term, - const BookmarkNode* node) { + const TitledUrlNode* node) { Index::iterator i = index_.find(term); if (i == index_.end()) { // We can get here if the node has the same term more than once. For - // example, a bookmark with the title 'foo foo' would end up here. + // example, a node with the title 'foo foo' would end up here. return; } i->second.erase(node);
diff --git a/components/bookmarks/browser/bookmark_index.h b/components/bookmarks/browser/bookmark_index.h index 1e00c8d..c6fd22ba 100644 --- a/components/bookmarks/browser/bookmark_index.h +++ b/components/bookmarks/browser/bookmark_index.h
@@ -19,7 +19,7 @@ namespace bookmarks { class BookmarkClient; -class BookmarkNode; +class TitledUrlNode; struct BookmarkMatch; // BookmarkIndex maintains an index of the titles and URLs of bookmarks for @@ -28,37 +28,38 @@ // // BookmarkIndex maintains the index (index_) as a map of sets. The map (type // Index) maps from a lower case string to the set (type NodeSet) of -// BookmarkNodes that contain that string in their title or URL. +// TitledUrlNodes that contain that string in their title or URL. class BookmarkIndex { public: BookmarkIndex(BookmarkClient* client); ~BookmarkIndex(); - // Invoked when a bookmark has been added to the model. - void Add(const BookmarkNode* node); + // Invoked when a title/URL pair has been added to the model. + void Add(const TitledUrlNode* node); - // Invoked when a bookmark has been removed from the model. - void Remove(const BookmarkNode* node); + // Invoked when a title/URL pair has been removed from the model. + void Remove(const TitledUrlNode* node); - // Returns up to |max_count| of bookmarks containing each term from the text + // Returns up to |max_count| of matches containing each term from the text // |query| in either the title or the URL. - void GetBookmarksMatching(const base::string16& query, - size_t max_count, - query_parser::MatchingAlgorithm matching_algorithm, - std::vector<BookmarkMatch>* results); + void GetResultsMatching(const base::string16& query, + size_t max_count, + query_parser::MatchingAlgorithm matching_algorithm, + std::vector<BookmarkMatch>* results); private: - typedef std::vector<const BookmarkNode*> Nodes; - typedef std::set<const BookmarkNode*> NodeSet; - typedef std::map<base::string16, NodeSet> Index; + using TitledUrlNodes = std::vector<const TitledUrlNode*>; + using TitledUrlNodeSet = std::set<const TitledUrlNode*>; + using Index = std::map<base::string16, TitledUrlNodeSet>; // Constructs |sorted_nodes| by taking the matches in |matches| and sorting // them in decreasing order of typed count (if supported by the client) and // deduping them. - void SortMatches(const NodeSet& matches, Nodes* sorted_nodes) const; + void SortMatches(const TitledUrlNodeSet& matches, + TitledUrlNodes* sorted_nodes) const; // Add |node| to |results| if the node matches the query. - void AddMatchToResults(const BookmarkNode* node, + void AddMatchToResults(const TitledUrlNode* node, query_parser::QueryParser* parser, const query_parser::QueryNodeVector& query_nodes, std::vector<BookmarkMatch>* results); @@ -66,20 +67,20 @@ // Populates |matches| for the specified term. If |first_term| is true, this // is the first term in the query. Returns true if there is at least one node // matching the term. - bool GetBookmarksMatchingTerm( + bool GetResultsMatchingTerm( const base::string16& term, bool first_term, query_parser::MatchingAlgorithm matching_algorithm, - NodeSet* matches); + TitledUrlNodeSet* matches); // Returns the set of query words from |query|. std::vector<base::string16> ExtractQueryWords(const base::string16& query); // Adds |node| to |index_|. - void RegisterNode(const base::string16& term, const BookmarkNode* node); + void RegisterNode(const base::string16& term, const TitledUrlNode* node); // Removes |node| from |index_|. - void UnregisterNode(const base::string16& term, const BookmarkNode* node); + void UnregisterNode(const base::string16& term, const TitledUrlNode* node); Index index_;
diff --git a/components/bookmarks/browser/bookmark_index_unittest.cc b/components/bookmarks/browser/bookmark_index_unittest.cc index b476d86b..50be374a 100644 --- a/components/bookmarks/browser/bookmark_index_unittest.cc +++ b/components/bookmarks/browser/bookmark_index_unittest.cc
@@ -100,7 +100,8 @@ for (size_t i = 0; i < expected_titles.size(); ++i) { bool found = false; for (size_t j = 0; j < matches.size(); ++j) { - if (ASCIIToUTF16(expected_titles[i]) == matches[j].node->GetTitle()) { + const base::string16& title = matches[j].node->GetTitledUrlNodeTitle(); + if (ASCIIToUTF16(expected_titles[i]) == title) { matches.erase(matches.begin() + j); found = true; break; @@ -532,7 +533,7 @@ base::MakeUnique<BookmarkClientMock>(typed_count_map)); for (size_t i = 0; i < arraysize(data); ++i) - // Populate the BookmarkIndex. + // Populate the bookmark index. model->AddURL( model->other_node(), i, UTF8ToUTF16(data[i].title), data[i].url); @@ -546,18 +547,18 @@ // 3. Google Docs (docs.google.com) 50 // 4. Google Maps (maps.google.com) 40 ASSERT_EQ(4U, matches.size()); - EXPECT_EQ(data[0].url, matches[0].node->url()); - EXPECT_EQ(data[3].url, matches[1].node->url()); - EXPECT_EQ(data[2].url, matches[2].node->url()); - EXPECT_EQ(data[1].url, matches[3].node->url()); + EXPECT_EQ(data[0].url, matches[0].node->GetTitledUrlNodeUrl()); + EXPECT_EQ(data[3].url, matches[1].node->GetTitledUrlNodeUrl()); + EXPECT_EQ(data[2].url, matches[2].node->GetTitledUrlNodeUrl()); + EXPECT_EQ(data[1].url, matches[3].node->GetTitledUrlNodeUrl()); matches.clear(); // Select top two matches. model->GetBookmarksMatching(ASCIIToUTF16("google"), 2, &matches); ASSERT_EQ(2U, matches.size()); - EXPECT_EQ(data[0].url, matches[0].node->url()); - EXPECT_EQ(data[3].url, matches[1].node->url()); + EXPECT_EQ(data[0].url, matches[0].node->GetTitledUrlNodeUrl()); + EXPECT_EQ(data[3].url, matches[1].node->GetTitledUrlNodeUrl()); } } // namespace
diff --git a/components/bookmarks/browser/bookmark_match.h b/components/bookmarks/browser/bookmark_match.h index ce65893..76cb0bf 100644 --- a/components/bookmarks/browser/bookmark_match.h +++ b/components/bookmarks/browser/bookmark_match.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 COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_TITLE_MATCH_H_ -#define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_TITLE_MATCH_H_ +#ifndef COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MATCH_H_ +#define COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MATCH_H_ #include <stddef.h> @@ -13,13 +13,13 @@ namespace bookmarks { -class BookmarkNode; +class TitledUrlNode; struct BookmarkMatch { // Each MatchPosition is the [begin, end) positions of a match within a // string. - typedef std::pair<size_t, size_t> MatchPosition; - typedef std::vector<MatchPosition> MatchPositions; + using MatchPosition = std::pair<size_t, size_t>; + using MatchPositions = std::vector<MatchPosition>; BookmarkMatch(); BookmarkMatch(const BookmarkMatch& other); @@ -37,7 +37,7 @@ const std::vector<size_t>& offsets); // The matching node of a query. - const BookmarkNode* node; + const TitledUrlNode* node; // Location of the matching words in the title of the node. MatchPositions title_match_positions; @@ -48,4 +48,4 @@ } // namespace bookmarks -#endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_TITLE_MATCH_H_ +#endif // COMPONENTS_BOOKMARKS_BROWSER_BOOKMARK_MATCH_H_
diff --git a/components/bookmarks/browser/bookmark_model.cc b/components/bookmarks/browser/bookmark_model.cc index a399809..a538e8d 100644 --- a/components/bookmarks/browser/bookmark_model.cc +++ b/components/bookmarks/browser/bookmark_model.cc
@@ -730,7 +730,7 @@ if (!loaded_) return; - index_->GetBookmarksMatching(text, max_count, matching_algorithm, matches); + index_->GetResultsMatching(text, max_count, matching_algorithm, matches); } void BookmarkModel::ClearStore() {
diff --git a/components/bookmarks/browser/bookmark_node.cc b/components/bookmarks/browser/bookmark_node.cc index 9574cf1..8bc1c292 100644 --- a/components/bookmarks/browser/bookmark_node.cc +++ b/components/bookmarks/browser/bookmark_node.cc
@@ -103,6 +103,14 @@ return meta_info_map_.get(); } +const base::string16& BookmarkNode::GetTitledUrlNodeTitle() const { + return GetTitle(); +} + +const GURL& BookmarkNode::GetTitledUrlNodeUrl() const { + return url_; +} + void BookmarkNode::Initialize(int64_t id) { id_ = id; type_ = url_.is_empty() ? FOLDER : URL;
diff --git a/components/bookmarks/browser/bookmark_node.h b/components/bookmarks/browser/bookmark_node.h index 84cea2b..d125c44 100644 --- a/components/bookmarks/browser/bookmark_node.h +++ b/components/bookmarks/browser/bookmark_node.h
@@ -12,6 +12,7 @@ #include "base/macros.h" #include "base/task/cancelable_task_tracker.h" #include "base/time/time.h" +#include "components/bookmarks/browser/titled_url_node.h" #include "components/favicon_base/favicon_types.h" #include "ui/base/models/tree_node_model.h" #include "ui/gfx/image/image.h" @@ -25,7 +26,7 @@ // BookmarkNode contains information about a starred entry: title, URL, favicon, // id and type. BookmarkNodes are returned from BookmarkModel. -class BookmarkNode : public ui::TreeNode<BookmarkNode> { +class BookmarkNode : public ui::TreeNode<BookmarkNode>, public TitledUrlNode { public: enum Type { URL, @@ -115,6 +116,10 @@ } int64_t sync_transaction_version() const { return sync_transaction_version_; } + // TitledUrlNode interface methods. + const base::string16& GetTitledUrlNodeTitle() const override; + const GURL& GetTitledUrlNodeUrl() const override; + // TODO(sky): Consider adding last visit time here, it'll greatly simplify // HistoryContentsProvider.
diff --git a/components/bookmarks/browser/titled_url_node.h b/components/bookmarks/browser/titled_url_node.h new file mode 100644 index 0000000..bbd6759 --- /dev/null +++ b/components/bookmarks/browser/titled_url_node.h
@@ -0,0 +1,29 @@ +// 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. + +#ifndef COMPONENTS_BOOKMARKS_BROWSER_TITLED_URL_NODE_H_ +#define COMPONENTS_BOOKMARKS_BROWSER_TITLED_URL_NODE_H_ + +#include "url/gurl.h" + +namespace bookmarks { + +// TitledUrlNode is an interface for objects like bookmarks that expose a title +// and URL. TitledUrlNodes can be added to a BookmarkIndex to quickly retrieve +// all nodes that contain a particular word in their title or URL. +class TitledUrlNode { + public: + // Returns the title for the node. + virtual const base::string16& GetTitledUrlNodeTitle() const = 0; + + // Returns the URL for the node. + virtual const GURL& GetTitledUrlNodeUrl() const = 0; + + protected: + virtual ~TitledUrlNode() {} +}; + +} // namespace bookmarks + +#endif // COMPONENTS_BOOKMARKS_BROWSER_TITLED_URL_NODE_H_
diff --git a/components/browser_sync/profile_sync_service.cc b/components/browser_sync/profile_sync_service.cc index b4a269f..5103619 100644 --- a/components/browser_sync/profile_sync_service.cc +++ b/components/browser_sync/profile_sync_service.cc
@@ -115,8 +115,30 @@ namespace browser_sync { +namespace { + typedef GoogleServiceAuthError AuthError; +// Events in ClearServerData flow to be recorded in histogram. Existing +// constants should not be deleted or reordered. New ones shold be added at the +// end, before CLEAR_SERVER_DATA_MAX. +enum ClearServerDataEvents { + // ClearServerData started after user switched to custom passphrase. + CLEAR_SERVER_DATA_STARTED, + // DataTypeManager reported that catchup configuration failed. + CLEAR_SERVER_DATA_CATCHUP_FAILED, + // ClearServerData flow restarted after browser restart. + CLEAR_SERVER_DATA_RETRIED, + // Success. + CLEAR_SERVER_DATA_SUCCEEDED, + // Client received RECET_LOCAL_SYNC_DATA after custom passphrase was enabled + // on different client. + CLEAR_SERVER_DATA_RESET_LOCAL_DATA_RECEIVED, + CLEAR_SERVER_DATA_MAX +}; + +const char kClearServerDataEventsHistogramName[] = "Sync.ClearServerDataEvents"; + const char kSyncUnrecoverableErrorHistogram[] = "Sync.UnrecoverableErrors"; const net::BackoffEntry::Policy kRequestAccessTokenBackoffPolicy = { @@ -147,18 +169,16 @@ false, }; -static const base::FilePath::CharType kSyncDataFolderName[] = +const base::FilePath::CharType kSyncDataFolderName[] = FILE_PATH_LITERAL("Sync Data"); -static const base::FilePath::CharType kLevelDBFolderName[] = +const base::FilePath::CharType kLevelDBFolderName[] = FILE_PATH_LITERAL("LevelDB"); #if defined(OS_WIN) -static const base::FilePath::CharType kLoopbackServerBackendFilename[] = +const base::FilePath::CharType kLoopbackServerBackendFilename[] = FILE_PATH_LITERAL("profile.pb"); #endif -namespace { - // Perform the actual sync data folder deletion. // This should only be called on the sync thread. void DeleteSyncDataFolder(const base::FilePath& directory_path) { @@ -387,6 +407,10 @@ if (base::FeatureList::IsEnabled( switches::kSyncClearDataOnPassphraseEncryption) && sync_prefs_.GetPassphraseEncryptionTransitionInProgress()) { + // We are restarting catchup configuration after browser restart. + UMA_HISTOGRAM_ENUMERATION(kClearServerDataEventsHistogramName, + CLEAR_SERVER_DATA_RETRIED, CLEAR_SERVER_DATA_MAX); + BeginConfigureCatchUpBeforeClear(); return; } @@ -1304,6 +1328,9 @@ case syncer::RESET_LOCAL_SYNC_DATA: ShutdownImpl(syncer::DISABLE_SYNC); startup_controller_->TryStart(); + UMA_HISTOGRAM_ENUMERATION(kClearServerDataEventsHistogramName, + CLEAR_SERVER_DATA_RESET_LOCAL_DATA_RECEIVED, + CLEAR_SERVER_DATA_MAX); break; default: NOTREACHED(); @@ -1321,6 +1348,8 @@ // At this point the user has set a custom passphrase and we have received the // updated nigori state. Time to cache the nigori state, and catch up the // active data types. + UMA_HISTOGRAM_ENUMERATION(kClearServerDataEventsHistogramName, + CLEAR_SERVER_DATA_STARTED, CLEAR_SERVER_DATA_MAX); sync_prefs_.SetNigoriSpecificsForPassphraseTransition( nigori_state.nigori_specifics); sync_prefs_.SetPassphraseEncryptionTransitionInProgress(true); @@ -1358,6 +1387,8 @@ // nigori state. ShutdownImpl(syncer::DISABLE_SYNC); startup_controller_->TryStart(); + UMA_HISTOGRAM_ENUMERATION(kClearServerDataEventsHistogramName, + CLEAR_SERVER_DATA_SUCCEEDED, CLEAR_SERVER_DATA_MAX); } void ProfileSyncService::OnConfigureDone( @@ -1371,7 +1402,7 @@ DCHECK(cached_passphrase_.empty()); if (!sync_configure_start_time_.is_null()) { - if (result.status == DataTypeManager::OK) { + if (configure_status_ == DataTypeManager::OK) { base::Time sync_configure_stop_time = base::Time::Now(); base::TimeDelta delta = sync_configure_stop_time - sync_configure_start_time_; @@ -1405,6 +1436,12 @@ // Handle unrecoverable error. if (configure_status_ != DataTypeManager::OK) { + if (catch_up_configure_in_progress_) { + // Record catchup configuration failure. + UMA_HISTOGRAM_ENUMERATION(kClearServerDataEventsHistogramName, + CLEAR_SERVER_DATA_CATCHUP_FAILED, + CLEAR_SERVER_DATA_MAX); + } // Something catastrophic had happened. We should only have one // error representing it. syncer::SyncError error = data_type_status_table_.GetUnrecoverableError();
diff --git a/components/omnibox/browser/bookmark_provider.cc b/components/omnibox/browser/bookmark_provider.cc index 5068690..1976e8d 100644 --- a/components/omnibox/browser/bookmark_provider.cc +++ b/components/omnibox/browser/bookmark_provider.cc
@@ -24,10 +24,9 @@ #include "url/url_constants.h" using bookmarks::BookmarkMatch; +using BookmarkMatches = std::vector<BookmarkMatch>; using bookmarks::BookmarkNode; -typedef std::vector<BookmarkMatch> BookmarkMatches; - namespace { // Removes leading spaces from |title| before displaying, otherwise it looks @@ -165,11 +164,11 @@ // unlikely to be what the user intends. AutocompleteMatch match(this, 0, false, AutocompleteMatchType::BOOKMARK_TITLE); - base::string16 title(bookmark_match.node->GetTitle()); + base::string16 title(bookmark_match.node->GetTitledUrlNodeTitle()); BookmarkMatch::MatchPositions new_title_match_positions = bookmark_match.title_match_positions; CorrectTitleAndMatchPositions(&title, &new_title_match_positions); - const GURL& url(bookmark_match.node->url()); + const GURL& url(bookmark_match.node->GetTitledUrlNodeUrl()); const base::string16& url_utf16 = base::UTF8ToUTF16(url.spec()); size_t inline_autocomplete_offset = URLPrefix::GetInlineAutocompleteOffset( input.text(), fixed_up_input_text, false, url_utf16); @@ -281,7 +280,8 @@ ScoringFunctor url_position_functor = for_each(bookmark_match.url_match_positions.begin(), bookmark_match.url_match_positions.end(), - ScoringFunctor(bookmark_match.node->url().spec().length())); + ScoringFunctor( + bookmark_match.node->GetTitledUrlNodeUrl().spec().length())); const double title_match_strength = title_position_functor.ScoringFactor(); const double summed_factors = title_match_strength + url_position_functor.ScoringFactor();
diff --git a/components/sync/engine_impl/sync_scheduler_impl.cc b/components/sync/engine_impl/sync_scheduler_impl.cc index fe52722f..edc26fc 100644 --- a/components/sync/engine_impl/sync_scheduler_impl.cc +++ b/components/sync/engine_impl/sync_scheduler_impl.cc
@@ -534,7 +534,6 @@ if (!CanRunJobNow(priority)) { SDVLOG(2) << "Unable to run clear server data job right now."; - RunAndReset(&pending_configure_params_->retry_task); return; }
diff --git a/components/sync/test/fake_server/fake_server.cc b/components/sync/test/fake_server/fake_server.cc index 66b720a..a7f1cc1 100644 --- a/components/sync/test/fake_server/fake_server.cc +++ b/components/sync/test/fake_server/fake_server.cc
@@ -11,6 +11,7 @@ #include "base/guid.h" #include "base/logging.h" +#include "base/memory/ptr_util.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" @@ -52,100 +53,83 @@ static const char kSyncedBookmarksFolderName[] = "Synced Bookmarks"; // A filter used during GetUpdates calls to determine what information to -// send back to the client. There is a 1:1 correspondence between any given -// GetUpdates call and an UpdateSieve instance. +// send back to the client; filtering out old entities and tracking versions to +// use in response progress markers. Note that only the GetUpdatesMessage's +// from_progress_marker is used to determine this; legacy fields are ignored. class UpdateSieve { public: + explicit UpdateSieve(const sync_pb::GetUpdatesMessage& message) + : UpdateSieve(MessageToVersionMap(message)) {} ~UpdateSieve() {} - // Factory method for creating an UpdateSieve. - static std::unique_ptr<UpdateSieve> Create( - const sync_pb::GetUpdatesMessage& get_updates_message); - - // Sets the progress markers in |get_updates_response| given the progress - // markers from the original GetUpdatesMessage and |new_version| (the latest - // version in the entries sent back). - void UpdateProgressMarkers( - int64_t new_version, + // Sets the progress markers in |get_updates_response| based on the highest + // version between request progress markers and response entities. + void SetProgressMarkers( sync_pb::GetUpdatesResponse* get_updates_response) const { - ModelTypeToVersionMap::const_iterator it; - for (it = request_from_version_.begin(); it != request_from_version_.end(); - ++it) { + for (const auto& kv : response_version_map_) { sync_pb::DataTypeProgressMarker* new_marker = get_updates_response->add_new_progress_marker(); new_marker->set_data_type_id( - GetSpecificsFieldNumberFromModelType(it->first)); - - int64_t version = std::max(new_version, it->second); - new_marker->set_token(base::Int64ToString(version)); + GetSpecificsFieldNumberFromModelType(kv.first)); + new_marker->set_token(base::Int64ToString(kv.second)); } } // Determines whether the server should send an |entity| to the client as - // part of a GetUpdatesResponse. - bool ClientWantsItem(const FakeServerEntity& entity) const { + // part of a GetUpdatesResponse. Update internal tracking of max versions as a + // side effect which will later be used to set response progress markers. + bool ClientWantsItem(const FakeServerEntity& entity) { int64_t version = entity.GetVersion(); - if (version <= min_version_) { - return false; - } else if (entity.IsDeleted()) { - return true; - } - - ModelTypeToVersionMap::const_iterator it = - request_from_version_.find(entity.model_type()); - - return it == request_from_version_.end() ? false : it->second < version; + ModelType type = entity.model_type(); + response_version_map_[type] = + std::max(response_version_map_[type], version); + auto it = request_version_map_.find(type); + return it == request_version_map_.end() ? false : it->second < version; } - // Returns the minimum version seen across all types. - int64_t GetMinVersion() const { return min_version_; } - private: typedef std::map<ModelType, int64_t> ModelTypeToVersionMap; - // Creates an UpdateSieve. - UpdateSieve(const ModelTypeToVersionMap request_from_version, - const int64_t min_version) - : request_from_version_(request_from_version), - min_version_(min_version) {} + static UpdateSieve::ModelTypeToVersionMap MessageToVersionMap( + const sync_pb::GetUpdatesMessage& get_updates_message) { + CHECK_GT(get_updates_message.from_progress_marker_size(), 0) + << "A GetUpdates request must have at least one progress marker."; + ModelTypeToVersionMap request_version_map; - // Maps data type IDs to the latest version seen for that type. - const ModelTypeToVersionMap request_from_version_; + for (int i = 0; i < get_updates_message.from_progress_marker_size(); i++) { + sync_pb::DataTypeProgressMarker marker = + get_updates_message.from_progress_marker(i); - // The minimum version seen among all data types. - const int min_version_; -}; + int64_t version = 0; + // Let the version remain zero if there is no token or an empty token (the + // first request for this type). + if (marker.has_token() && !marker.token().empty()) { + bool parsed = base::StringToInt64(marker.token(), &version); + CHECK(parsed) << "Unable to parse progress marker token."; + } -std::unique_ptr<UpdateSieve> UpdateSieve::Create( - const sync_pb::GetUpdatesMessage& get_updates_message) { - CHECK_GT(get_updates_message.from_progress_marker_size(), 0) - << "A GetUpdates request must have at least one progress marker."; - - UpdateSieve::ModelTypeToVersionMap request_from_version; - int64_t min_version = std::numeric_limits<int64_t>::max(); - for (int i = 0; i < get_updates_message.from_progress_marker_size(); i++) { - sync_pb::DataTypeProgressMarker marker = - get_updates_message.from_progress_marker(i); - - int64_t version = 0; - // Let the version remain zero if there is no token or an empty token (the - // first request for this type). - if (marker.has_token() && !marker.token().empty()) { - bool parsed = base::StringToInt64(marker.token(), &version); - CHECK(parsed) << "Unable to parse progress marker token."; + ModelType model_type = + syncer::GetModelTypeFromSpecificsFieldNumber(marker.data_type_id()); + DCHECK(request_version_map.find(model_type) == request_version_map.end()); + request_version_map[model_type] = version; } - - ModelType model_type = - syncer::GetModelTypeFromSpecificsFieldNumber(marker.data_type_id()); - request_from_version[model_type] = version; - - if (version < min_version) - min_version = version; + return request_version_map; } - return std::unique_ptr<UpdateSieve>( - new UpdateSieve(request_from_version, min_version)); -} + explicit UpdateSieve(const ModelTypeToVersionMap request_version_map) + : request_version_map_(request_version_map), + response_version_map_(request_version_map) {} + + // The largest versions the client has seen before this request, and is used + // to filter entities to send back to clients. The values in this map are not + // updated after being initially set. The presence of a type in this map is a + // proxy for the desire to receive results about this type. + const ModelTypeToVersionMap request_version_map_; + + // The largest versions seen between client and server, ultimately used to + // send progress markers back to the client. + ModelTypeToVersionMap response_version_map_; +}; // Returns whether |entity| is deleted or permanent. bool IsDeletedOrPermanent(const FakeServerEntity& entity) { @@ -338,7 +322,7 @@ // at once. response->set_changes_remaining(0); - std::unique_ptr<UpdateSieve> sieve = UpdateSieve::Create(get_updates); + auto sieve = base::MakeUnique<UpdateSieve>(get_updates); // This folder is called "Synced Bookmarks" by sync and is renamed // "Mobile Bookmarks" by the mobile client UIs. @@ -349,7 +333,6 @@ } bool send_encryption_keys_based_on_nigori = false; - int64_t max_response_version = 0; for (EntityMap::const_iterator it = entities_.begin(); it != entities_.end(); ++it) { const FakeServerEntity& entity = *it->second; @@ -357,9 +340,6 @@ sync_pb::SyncEntity* response_entity = response->add_entries(); entity.SerializeAsProto(response_entity); - max_response_version = - std::max(max_response_version, response_entity->version()); - if (entity.model_type() == syncer::NIGORI) { send_encryption_keys_based_on_nigori = response_entity->specifics().nigori().passphrase_type() == @@ -376,7 +356,7 @@ } } - sieve->UpdateProgressMarkers(max_response_version, response); + sieve->SetProgressMarkers(response); return true; }
diff --git a/content/browser/gpu/compositor_util.cc b/content/browser/gpu/compositor_util.cc index 66de1fe1..29224921 100644 --- a/content/browser/gpu/compositor_util.cc +++ b/content/browser/gpu/compositor_util.cc
@@ -118,7 +118,7 @@ #if BUILDFLAG(ENABLE_WEBRTC) {"video_encode", manager->IsFeatureBlacklisted( gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE), - command_line.HasSwitch(switches::kDisableWebRtcHWEncoding), + command_line.HasSwitch(switches::kDisableWebRtcHWVP8Encoding), "Accelerated video encode has been disabled, either via blacklist," " about:flags or the command line.", true},
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.cc b/content/browser/gpu/gpu_data_manager_impl_private.cc index 78e7c4b3..e114814 100644 --- a/content/browser/gpu/gpu_data_manager_impl_private.cc +++ b/content/browser/gpu/gpu_data_manager_impl_private.cc
@@ -28,6 +28,7 @@ #include "content/public/browser/gpu_data_manager_observer.h" #include "content/public/common/content_client.h" #include "content/public/common/content_constants.h" +#include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" #include "content/public/common/web_preferences.h" #include "gpu/command_buffer/service/gpu_preferences.h" @@ -692,8 +693,8 @@ command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); #if BUILDFLAG(ENABLE_WEBRTC) if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && - !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) - command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); + !command_line->HasSwitch(switches::kDisableWebRtcHWVP8Encoding)) + command_line->AppendSwitch(switches::kDisableWebRtcHWVP8Encoding); #endif #if defined(USE_AURA) @@ -775,11 +776,12 @@ #if BUILDFLAG(ENABLE_WEBRTC) if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && - !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) { + !command_line->HasSwitch(switches::kDisableWebRtcHWVP8Encoding) && + !base::FeatureList::IsEnabled(features::kWebRtcHWH264Encoding)) { if (gpu_preferences) { gpu_preferences->disable_web_rtc_hw_encoding = true; } else { - command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); + command_line->AppendSwitch(switches::kDisableWebRtcHWVP8Encoding); } } #endif
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc index 179b773..df3d612 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc
@@ -119,7 +119,7 @@ switches::kDisableLogging, switches::kDisableSeccompFilterSandbox, #if BUILDFLAG(ENABLE_WEBRTC) - switches::kDisableWebRtcHWEncoding, + switches::kDisableWebRtcHWVP8Encoding, #endif #if defined(OS_WIN) switches::kEnableAcceleratedVpxDecode,
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index b2d7c162..87437a0bc 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -1794,7 +1794,7 @@ #endif #if BUILDFLAG(ENABLE_WEBRTC) switches::kDisableWebRtcHWDecoding, - switches::kDisableWebRtcHWEncoding, + switches::kDisableWebRtcHWVP8Encoding, switches::kEnableWebRtcStunOrigin, switches::kEnforceWebRtcIPPermissionCheck, switches::kForceWebRtcIPHandlingPolicy,
diff --git a/content/public/browser/gpu_utils.cc b/content/public/browser/gpu_utils.cc index 7ac9c72..8605b2d5 100644 --- a/content/public/browser/gpu_utils.cc +++ b/content/public/browser/gpu_utils.cc
@@ -6,6 +6,7 @@ #include "base/command_line.h" #include "base/strings/string_number_conversions.h" +#include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" #include "gpu/command_buffer/service/gpu_switches.h" #include "gpu/config/gpu_switches.h" @@ -46,9 +47,8 @@ #endif #if BUILDFLAG(ENABLE_WEBRTC) gpu_preferences.disable_web_rtc_hw_encoding = - command_line->HasSwitch(switches::kDisableWebRtcHWEncoding) && - command_line->GetSwitchValueASCII(switches::kDisableWebRtcHWEncoding) - .empty(); + command_line->HasSwitch(switches::kDisableWebRtcHWVP8Encoding) && + !base::FeatureList::IsEnabled(features::kWebRtcHWH264Encoding); #endif #if defined(OS_WIN) uint32_t enable_accelerated_vpx_decode_val =
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index 57a6e3d..2f8c68d 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc
@@ -223,6 +223,10 @@ "WebRTC-UseGpuMemoryBufferVideoFrames", base::FEATURE_DISABLED_BY_DEFAULT}; +// Enables HW H264 encoding on Android. +const base::Feature kWebRtcHWH264Encoding{ + "WebRtcHWH264Encoding", base::FEATURE_ENABLED_BY_DEFAULT}; + // Controls whether the WebUSB API is enabled: // https://wicg.github.io/webusb const base::Feature kWebUsb{"WebUSB", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h index 099a344..3aab2f7b 100644 --- a/content/public/common/content_features.h +++ b/content/public/common/content_features.h
@@ -59,6 +59,7 @@ CONTENT_EXPORT extern const base::Feature kWebAssembly; CONTENT_EXPORT extern const base::Feature kWebGLImageChromium; CONTENT_EXPORT extern const base::Feature kWebRtcEcdsaDefault; +CONTENT_EXPORT extern const base::Feature kWebRtcHWH264Encoding; CONTENT_EXPORT extern const base::Feature kWebRtcUseGpuMemoryBufferVideoFrames; CONTENT_EXPORT extern const base::Feature kWebUsb; CONTENT_EXPORT
diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc index 41c227f..0082c78 100644 --- a/content/public/common/content_switches.cc +++ b/content/public/common/content_switches.cc
@@ -923,10 +923,7 @@ const char kDisableWebRtcEncryption[] = "disable-webrtc-encryption"; // Disables HW encode acceleration for WebRTC. -const char kDisableWebRtcHWEncoding[] = "disable-webrtc-hw-encoding"; -const char kDisableWebRtcHWEncodingVPx[] = "vpx"; -const char kDisableWebRtcHWEncodingH264[] = "h264"; -const char kDisableWebRtcHWEncodingNone[] = "none"; +const char kDisableWebRtcHWVP8Encoding[] = "disable-webrtc-hw-vp8-encoding"; // Enables Origin header in Stun messages for WebRTC. const char kEnableWebRtcStunOrigin[] = "enable-webrtc-stun-origin";
diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h index 455765f..2c0774f6 100644 --- a/content/public/common/content_switches.h +++ b/content/public/common/content_switches.h
@@ -267,10 +267,7 @@ #if BUILDFLAG(ENABLE_WEBRTC) CONTENT_EXPORT extern const char kDisableWebRtcHWDecoding[]; CONTENT_EXPORT extern const char kDisableWebRtcEncryption[]; -CONTENT_EXPORT extern const char kDisableWebRtcHWEncoding[]; -CONTENT_EXPORT extern const char kDisableWebRtcHWEncodingVPx[]; -CONTENT_EXPORT extern const char kDisableWebRtcHWEncodingH264[]; -CONTENT_EXPORT extern const char kDisableWebRtcHWEncodingNone[]; +CONTENT_EXPORT extern const char kDisableWebRtcHWVP8Encoding[]; CONTENT_EXPORT extern const char kEnableWebRtcStunOrigin[]; CONTENT_EXPORT extern const char kEnforceWebRtcIPPermissionCheck[]; CONTENT_EXPORT extern const char kForceWebRtcIPHandlingPolicy[];
diff --git a/content/renderer/media/gpu/rtc_video_encoder_factory.cc b/content/renderer/media/gpu/rtc_video_encoder_factory.cc index 4124c186..56d28bc2 100644 --- a/content/renderer/media/gpu/rtc_video_encoder_factory.cc +++ b/content/renderer/media/gpu/rtc_video_encoder_factory.cc
@@ -5,6 +5,7 @@ #include "content/renderer/media/gpu/rtc_video_encoder_factory.h" #include "base/command_line.h" +#include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" #include "content/public/common/feature_h264_with_openh264_ffmpeg.h" #include "content/renderer/media/gpu/rtc_video_encoder.h" @@ -15,15 +16,6 @@ namespace content { namespace { -bool IsCodecDisabledByCommandLine(const base::CommandLine* cmd_line, - const std::string codec_name) { - if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) - return false; - - const std::string codec_filter = - cmd_line->GetSwitchValueASCII(switches::kDisableWebRtcHWEncoding); - return codec_filter.empty() || codec_filter == codec_name; -} // Translate from media::VideoEncodeAccelerator::SupportedProfile to // one or more instances of cricket::WebRtcVideoEncoderFactory::VideoCodec @@ -38,8 +30,7 @@ const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); if (profile.profile >= media::VP8PROFILE_MIN && profile.profile <= media::VP8PROFILE_MAX) { - if (!IsCodecDisabledByCommandLine(cmd_line, - switches::kDisableWebRtcHWEncodingVPx)) { + if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWVP8Encoding)) { codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec( webrtc::kVideoCodecVP8, "VP8", width, height, fps)); } @@ -54,8 +45,7 @@ base::FeatureList::IsEnabled(kWebRtcH264WithOpenH264FFmpeg); #endif // BUILDFLAG(RTC_USE_H264) && !defined(MEDIA_DISABLE_FFMPEG) if (webrtc_h264_sw_enabled || - !IsCodecDisabledByCommandLine(cmd_line, - switches::kDisableWebRtcHWEncodingH264)) { + base::FeatureList::IsEnabled(features::kWebRtcHWH264Encoding)) { codecs->push_back(cricket::WebRtcVideoEncoderFactory::VideoCodec( webrtc::kVideoCodecH264, "H264", width, height, fps)); }
diff --git a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc index f503eeb..fab9910a 100644 --- a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc +++ b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
@@ -24,6 +24,7 @@ #include "build/build_config.h" #include "content/common/media/media_stream_messages.h" #include "content/public/common/content_client.h" +#include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" #include "content/public/common/feature_h264_with_openh264_ffmpeg.h" #include "content/public/common/features.h" @@ -238,9 +239,8 @@ if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWDecoding)) decoder_factory.reset(new RTCVideoDecoderFactory(gpu_factories)); - if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding) || - !cmd_line->GetSwitchValueASCII(switches::kDisableWebRtcHWEncoding) - .empty()) { + if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWVP8Encoding) || + base::FeatureList::IsEnabled(features::kWebRtcHWH264Encoding)) { encoder_factory.reset(new RTCVideoEncoderFactory(gpu_factories)); } }
diff --git a/content/test/gpu/generate_buildbot_json.py b/content/test/gpu/generate_buildbot_json.py index 83259fc..1ae945b 100755 --- a/content/test/gpu/generate_buildbot_json.py +++ b/content/test/gpu/generate_buildbot_json.py
@@ -1432,6 +1432,9 @@ return True def should_run_on_tester(tester_name, tester_config, test_config, is_fyi): + # TODO(jmadill): Re-enable when n5x fixed. See http://crbug.com/672502. + if 'Nexus 5X' in tester_name: + return False # Check if this config is disabled on this tester if 'disabled_tester_configs' in test_config: for dtc in test_config['disabled_tester_configs']:
diff --git a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py index 9550264..48874a3f 100644 --- a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py +++ b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
@@ -419,15 +419,10 @@ ['mac', 'amd'], bug=645298) # Mac Pro with AMD GPU - self.Fail('conformance2/textures/misc/tex-mipmap-levels.html', - ['mac', ('amd', 0x679e)], bug=483282) self.Flaky('deqp/functional/gles3/shaderindexing/mat_01.html', ['mac', ('amd', 0x679e)], bug=636648) self.Flaky('deqp/functional/gles3/shaderindexing/tmp.html', ['mac', ('amd', 0x679e)], bug=659871) - self.Fail('deqp/functional/gles3/shadertexturefunction/' + - 'texturesize.html', - ['mac', ('amd', 0x679e)], bug=640506) self.Fail('deqp/functional/gles3/uniformbuffers/random.html', ['mac', ('amd', 0x679e)], bug=618464) self.Fail('deqp/functional/gles3/shaderoperator/common_functions.html',
diff --git a/content/test/gpu/gpu_tests/webgl_conformance_expectations.py b/content/test/gpu/gpu_tests/webgl_conformance_expectations.py index efb13c7..f53da8d6 100644 --- a/content/test/gpu/gpu_tests/webgl_conformance_expectations.py +++ b/content/test/gpu/gpu_tests/webgl_conformance_expectations.py
@@ -360,9 +360,6 @@ ['mac', 'amd'], bug=642822) # Mac Intel failures - self.Flaky('conformance/textures/webgl_canvas/tex-' + - '2d-rgb-rgb-unsigned_byte.html', - ['mac', 'intel'], bug=648377) # Failed on OSX 10.10 and 10.11 self.Fail('conformance/glsl/bugs/unary-minus-operator-float-bug.html',
diff --git a/courgette/courgette.h b/courgette/courgette.h index 2dacc787..5337566 100644 --- a/courgette/courgette.h +++ b/courgette/courgette.h
@@ -7,6 +7,7 @@ #include <stddef.h> // Required to define size_t on GCC +#include "base/files/file.h" #include "base/files/file_path.h" namespace courgette { @@ -73,6 +74,15 @@ Status ApplyEnsemblePatch(SourceStream* old, SourceStream* patch, SinkStream* output); +// Applies the patch in |patch_file| to the bytes in |old_file| and writes the +// transformed ensemble to |new_file|. +// Returns C_OK unless something went wrong. +// This function first validates that the patch file has a proper header, so the +// function can be used to 'try' a patch. +Status ApplyEnsemblePatch(base::File old_file, + base::File patch_file, + base::File new_file); + // Applies the patch in |patch_file_name| to the bytes in |old_file_name| and // writes the transformed ensemble to |new_file_name|. // Returns C_OK unless something went wrong.
diff --git a/courgette/ensemble_apply.cc b/courgette/ensemble_apply.cc index 8ed9cbd9..9f4ec54 100644 --- a/courgette/ensemble_apply.cc +++ b/courgette/ensemble_apply.cc
@@ -12,6 +12,7 @@ #include <memory> #include <utility> +#include "base/files/file.h" #include "base/files/file_util.h" #include "base/files/memory_mapped_file.h" #include "base/logging.h" @@ -371,33 +372,31 @@ return C_OK; } -Status ApplyEnsemblePatch(const base::FilePath::CharType* old_file_name, - const base::FilePath::CharType* patch_file_name, - const base::FilePath::CharType* new_file_name) { - base::FilePath patch_file_path(patch_file_name); - base::MemoryMappedFile patch_file; - if (!patch_file.Initialize(patch_file_path)) +Status ApplyEnsemblePatch(base::File old_file, + base::File patch_file, + base::File new_file) { + base::MemoryMappedFile patch_file_mem; + if (!patch_file_mem.Initialize(std::move(patch_file))) return C_READ_OPEN_ERROR; // 'Dry-run' the first step of the patch process to validate format of header. SourceStream patch_header_stream; - patch_header_stream.Init(patch_file.data(), patch_file.length()); + patch_header_stream.Init(patch_file_mem.data(), patch_file_mem.length()); EnsemblePatchApplication patch_process; Status status = patch_process.ReadHeader(&patch_header_stream); if (status != C_OK) return status; // Read the old_file. - base::FilePath old_file_path(old_file_name); - base::MemoryMappedFile old_file; - if (!old_file.Initialize(old_file_path)) + base::MemoryMappedFile old_file_mem; + if (!old_file_mem.Initialize(std::move(old_file))) return C_READ_ERROR; // Apply patch on streams. SourceStream old_source_stream; SourceStream patch_source_stream; - old_source_stream.Init(old_file.data(), old_file.length()); - patch_source_stream.Init(patch_file.data(), patch_file.length()); + old_source_stream.Init(old_file_mem.data(), old_file_mem.length()); + patch_source_stream.Init(patch_file_mem.data(), patch_file_mem.length()); SinkStream new_sink_stream; status = ApplyEnsemblePatch(&old_source_stream, &patch_source_stream, &new_sink_stream); @@ -405,12 +404,10 @@ return status; // Write the patched data to |new_file_name|. - base::FilePath new_file_path(new_file_name); - int written = - base::WriteFile( - new_file_path, - reinterpret_cast<const char*>(new_sink_stream.Buffer()), - static_cast<int>(new_sink_stream.Length())); + int written = new_file.Write( + 0, + reinterpret_cast<const char*>(new_sink_stream.Buffer()), + static_cast<int>(new_sink_stream.Length())); if (written == -1) return C_WRITE_OPEN_ERROR; if (static_cast<size_t>(written) != new_sink_stream.Length()) @@ -419,4 +416,24 @@ return C_OK; } -} // namespace +Status ApplyEnsemblePatch(const base::FilePath::CharType* old_file_name, + const base::FilePath::CharType* patch_file_name, + const base::FilePath::CharType* new_file_name) { + Status result = ApplyEnsemblePatch( + base::File( + base::FilePath(old_file_name), + base::File::FLAG_OPEN | base::File::FLAG_READ), + base::File( + base::FilePath(patch_file_name), + base::File::FLAG_OPEN | base::File::FLAG_READ), + base::File( + base::FilePath(new_file_name), + base::File::FLAG_CREATE_ALWAYS | + base::File::FLAG_WRITE | + base::File::FLAG_EXCLUSIVE_WRITE)); + if (result != C_OK) + base::DeleteFile(base::FilePath(new_file_name), false); + return result; +} + +} // namespace courgette
diff --git a/courgette/third_party/bsdiff/bsdiff.h b/courgette/third_party/bsdiff/bsdiff.h index a5da4ec..c1d26c72 100644 --- a/courgette/third_party/bsdiff/bsdiff.h +++ b/courgette/third_party/bsdiff/bsdiff.h
@@ -44,6 +44,7 @@ #include <stdint.h> +#include "base/files/file.h" #include "base/files/file_util.h" namespace courgette { @@ -76,6 +77,11 @@ courgette::SourceStream* patch_stream, courgette::SinkStream* new_stream); +// As above, but simply takes base::Files. +BSDiffStatus ApplyBinaryPatch(base::File old_stream, + base::File patch_stream, + base::File new_stream); + // As above, but simply takes the file paths. BSDiffStatus ApplyBinaryPatch(const base::FilePath& old_stream, const base::FilePath& patch_stream,
diff --git a/courgette/third_party/bsdiff/bsdiff_apply.cc b/courgette/third_party/bsdiff/bsdiff_apply.cc index fca9616..8d43c5d 100644 --- a/courgette/third_party/bsdiff/bsdiff_apply.cc +++ b/courgette/third_party/bsdiff/bsdiff_apply.cc
@@ -40,6 +40,7 @@ #include <stddef.h> #include <stdint.h> +#include "base/files/file_util.h" #include "base/files/memory_mapped_file.h" #include "courgette/crc.h" #include "courgette/streams.h" @@ -189,24 +190,24 @@ return OK; } -BSDiffStatus ApplyBinaryPatch(const base::FilePath& old_file_path, - const base::FilePath& patch_file_path, - const base::FilePath& new_file_path) { +BSDiffStatus ApplyBinaryPatch(base::File old_file, + base::File patch_file, + base::File new_file) { // Set up the old stream. - base::MemoryMappedFile old_file; - if (!old_file.Initialize(old_file_path)) { + base::MemoryMappedFile old_file_mem; + if (!old_file_mem.Initialize(std::move(old_file))) { return READ_ERROR; } SourceStream old_file_stream; - old_file_stream.Init(old_file.data(), old_file.length()); + old_file_stream.Init(old_file_mem.data(), old_file_mem.length()); // Set up the patch stream. - base::MemoryMappedFile patch_file; - if (!patch_file.Initialize(patch_file_path)) { + base::MemoryMappedFile patch_file_mem; + if (!patch_file_mem.Initialize(std::move(patch_file))) { return READ_ERROR; } SourceStream patch_file_stream; - patch_file_stream.Init(patch_file.data(), patch_file.length()); + patch_file_stream.Init(patch_file_mem.data(), patch_file_mem.length()); // Set up the new stream and apply the patch. SinkStream new_sink_stream; @@ -217,12 +218,33 @@ } // Write the stream to disk. - int written = base::WriteFile( - new_file_path, reinterpret_cast<const char*>(new_sink_stream.Buffer()), + int written = new_file.Write( + 0, + reinterpret_cast<const char*>(new_sink_stream.Buffer()), static_cast<int>(new_sink_stream.Length())); if (written != static_cast<int>(new_sink_stream.Length())) return WRITE_ERROR; return OK; } +BSDiffStatus ApplyBinaryPatch(const base::FilePath& old_file_path, + const base::FilePath& patch_file_path, + const base::FilePath& new_file_path) { + BSDiffStatus result = ApplyBinaryPatch( + base::File( + old_file_path, + base::File::FLAG_OPEN | base::File::FLAG_READ), + base::File( + patch_file_path, + base::File::FLAG_OPEN | base::File::FLAG_READ), + base::File( + new_file_path, + base::File::FLAG_CREATE_ALWAYS | + base::File::FLAG_WRITE | + base::File::FLAG_EXCLUSIVE_WRITE)); + if (result != OK) + base::DeleteFile(new_file_path, false); + return result; +} + } // namespace bsdiff
diff --git a/docs/linux_build_instructions.md b/docs/linux_build_instructions.md index 0fe97e6..f4f7ec8 100644 --- a/docs/linux_build_instructions.md +++ b/docs/linux_build_instructions.md
@@ -117,7 +117,7 @@ * For more info on GN, run `gn help` on the command line or read the [quick start guide](../tools/gn/docs/quick_start.md). -### <a id=faster-builds></a>Faster builds +### <a name="faster-builds"></a>Faster builds This section contains some things you can change to speed up your builds, sorted so that the things that make the biggest difference are first.
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index bca49db..2cb8a76 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -4014,6 +4014,7 @@ 'state': 'Scissor', }, 'Viewport': { + 'impl_func': False, 'decoder_func': 'DoViewport', }, 'ResizeCHROMIUM': {
diff --git a/gpu/command_buffer/client/client_context_state.cc b/gpu/command_buffer/client/client_context_state.cc index df81f30a..1321423 100644 --- a/gpu/command_buffer/client/client_context_state.cc +++ b/gpu/command_buffer/client/client_context_state.cc
@@ -4,6 +4,8 @@ #include "gpu/command_buffer/client/client_context_state.h" +#include "base/logging.h" + namespace gpu { namespace gles2 { @@ -13,6 +15,17 @@ ClientContextState::~ClientContextState() { } +void ClientContextState::SetViewport( + GLint x, GLint y, GLsizei width, GLsizei height) { + DCHECK_LE(0, width); + DCHECK_LE(0, height); + + viewport_x = x; + viewport_y = y; + viewport_width = width; + viewport_height = height; +} + // Include the auto-generated part of this file. We split this because it means // we can easily edit the non-auto generated parts right here in this file // instead of having to edit some template or the code generator.
diff --git a/gpu/command_buffer/client/client_context_state.h b/gpu/command_buffer/client/client_context_state.h index 45cd14b..e9f5ad15 100644 --- a/gpu/command_buffer/client/client_context_state.h +++ b/gpu/command_buffer/client/client_context_state.h
@@ -26,9 +26,17 @@ // 'changed' will be true if the state was different from 'enabled. bool SetCapabilityState(GLenum cap, bool enabled, bool* changed); + // Cache the user's valid viewport. + void SetViewport(GLint x, GLint y, GLsizei width, GLsizei height); + #include "gpu/command_buffer/client/client_context_state_autogen.h" EnableFlags enable_flags; + + GLint viewport_x = 0; + GLint viewport_y = 0; + GLsizei viewport_width = 0; + GLsizei viewport_height = 0; }; } // namespace gles2
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc index 155d1ef..bce6e004 100644 --- a/gpu/command_buffer/client/gles2_implementation.cc +++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -799,6 +799,15 @@ case GL_MAX_VERTEX_UNIFORM_VECTORS: *params = capabilities_.max_vertex_uniform_vectors; return true; + case GL_MAX_VIEWPORT_DIMS: + if (capabilities_.max_viewport_width > 0 && + capabilities_.max_viewport_height > 0) { + params[0] = capabilities_.max_viewport_width; + params[1] = capabilities_.max_viewport_height; + return true; + } + // If they are not cached on the client side yet, query the service side. + return false; case GL_NUM_COMPRESSED_TEXTURE_FORMATS: *params = capabilities_.num_compressed_texture_formats; return true; @@ -842,6 +851,23 @@ *params = static_cast<GLint>(query_tracker_->CheckAndResetDisjoint()); return true; + case GL_VIEWPORT: + if (state_.viewport_width > 0 && + state_.viewport_height > 0 && + capabilities_.max_viewport_width > 0 && + capabilities_.max_viewport_height > 0) { + params[0] = state_.viewport_x; + params[1] = state_.viewport_y; + params[2] = std::min(state_.viewport_width, + capabilities_.max_viewport_width); + params[3] = std::min(state_.viewport_height, + capabilities_.max_viewport_height); + return true; + } + // If they haven't been cached on the client side, go to service side + // to query the underlying driver. + return false; + // Non-cached parameters. case GL_ALIASED_LINE_WIDTH_RANGE: case GL_ALIASED_POINT_SIZE_RANGE: @@ -874,7 +900,6 @@ case GL_IMPLEMENTATION_COLOR_READ_FORMAT: case GL_IMPLEMENTATION_COLOR_READ_TYPE: case GL_LINE_WIDTH: - case GL_MAX_VIEWPORT_DIMS: case GL_PACK_ALIGNMENT: case GL_POLYGON_OFFSET_FACTOR: case GL_POLYGON_OFFSET_FILL: @@ -909,7 +934,6 @@ case GL_STENCIL_WRITEMASK: case GL_SUBPIXEL_BITS: case GL_UNPACK_ALIGNMENT: - case GL_VIEWPORT: return false; default: break; @@ -7025,6 +7049,22 @@ cached_extensions_.clear(); } +void GLES2Implementation::Viewport(GLint x, + GLint y, + GLsizei width, + GLsizei height) { + GPU_CLIENT_SINGLE_THREAD_CHECK(); + GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glViewport(" << x << ", " << y + << ", " << width << ", " << height << ")"); + if (width < 0 || height < 0) { + SetGLError(GL_INVALID_VALUE, "glViewport", "negative width/height"); + return; + } + state_.SetViewport(x, y, width, height); + helper_->Viewport(x, y, width, height); + CheckGLError(); +} + // Include the auto-generated part of this file. We split this because it means // we can easily edit the non-auto generated parts right here in this file // instead of having to edit some template or the code generator.
diff --git a/gpu/command_buffer/client/gles2_implementation_impl_autogen.h b/gpu/command_buffer/client/gles2_implementation_impl_autogen.h index 5bc9c6bb..7f55484 100644 --- a/gpu/command_buffer/client/gles2_implementation_impl_autogen.h +++ b/gpu/command_buffer/client/gles2_implementation_impl_autogen.h
@@ -2782,25 +2782,6 @@ CheckGLError(); } -void GLES2Implementation::Viewport(GLint x, - GLint y, - GLsizei width, - GLsizei height) { - GPU_CLIENT_SINGLE_THREAD_CHECK(); - GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glViewport(" << x << ", " << y - << ", " << width << ", " << height << ")"); - if (width < 0) { - SetGLError(GL_INVALID_VALUE, "glViewport", "width < 0"); - return; - } - if (height < 0) { - SetGLError(GL_INVALID_VALUE, "glViewport", "height < 0"); - return; - } - helper_->Viewport(x, y, width, height); - CheckGLError(); -} - void GLES2Implementation::BlitFramebufferCHROMIUM(GLint srcX0, GLint srcY0, GLint srcX1,
diff --git a/gpu/command_buffer/client/gles2_implementation_unittest.cc b/gpu/command_buffer/client/gles2_implementation_unittest.cc index 33b4eda5..fbf35d2 100644 --- a/gpu/command_buffer/client/gles2_implementation_unittest.cc +++ b/gpu/command_buffer/client/gles2_implementation_unittest.cc
@@ -404,6 +404,8 @@ static const GLint kMaxVertexAttribs = 8; static const GLint kMaxVertexTextureImageUnits = 0; static const GLint kMaxVertexUniformVectors = 128; + static const GLint kMaxViewportWidth = 8192; + static const GLint kMaxViewportHeight = 6144; static const GLint kNumCompressedTextureFormats = 0; static const GLint kNumShaderBinaryFormats = 0; static const GLuint kMaxTransformFeedbackSeparateAttribs = 4; @@ -467,6 +469,8 @@ capabilities.max_vertex_attribs = kMaxVertexAttribs; capabilities.max_vertex_texture_image_units = kMaxVertexTextureImageUnits; capabilities.max_vertex_uniform_vectors = kMaxVertexUniformVectors; + capabilities.max_viewport_width = kMaxViewportWidth; + capabilities.max_viewport_height = kMaxViewportHeight; capabilities.num_compressed_texture_formats = kNumCompressedTextureFormats; capabilities.num_shader_binary_formats = kNumShaderBinaryFormats;
diff --git a/gpu/command_buffer/common/capabilities.cc b/gpu/command_buffer/common/capabilities.cc index 397962e7..2098ac64 100644 --- a/gpu/command_buffer/common/capabilities.cc +++ b/gpu/command_buffer/common/capabilities.cc
@@ -20,6 +20,8 @@ max_vertex_attribs(0), max_vertex_texture_image_units(0), max_vertex_uniform_vectors(0), + max_viewport_width(0), + max_viewport_height(0), num_compressed_texture_formats(0), num_shader_binary_formats(0), bind_generates_resource_chromium(0),
diff --git a/gpu/command_buffer/common/capabilities.h b/gpu/command_buffer/common/capabilities.h index 30cedc8d..e4ff124 100644 --- a/gpu/command_buffer/common/capabilities.h +++ b/gpu/command_buffer/common/capabilities.h
@@ -78,6 +78,9 @@ int max_vertex_attribs; int max_vertex_texture_image_units; int max_vertex_uniform_vectors; + // MAX_VIEWPORT_DIMS[2] + int max_viewport_width; + int max_viewport_height; int num_compressed_texture_formats; int num_shader_binary_formats; int bind_generates_resource_chromium;
diff --git a/gpu/command_buffer/service/gl_utils.cc b/gpu/command_buffer/service/gl_utils.cc index a89a5fa5..19683c3 100644 --- a/gpu/command_buffer/service/gl_utils.cc +++ b/gpu/command_buffer/service/gl_utils.cc
@@ -174,6 +174,12 @@ &caps->max_vertex_texture_image_units); glGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, &caps->max_vertex_uniform_vectors); + { + GLint dims[2] = {0, 0}; + glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims); + caps->max_viewport_width = dims[0]; + caps->max_viewport_height = dims[1]; + } glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &caps->num_compressed_texture_formats); glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &caps->num_shader_binary_formats);
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index efef0da..1746557 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -3552,6 +3552,12 @@ &caps.max_vertex_texture_image_units, 1); DoGetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, &caps.max_vertex_uniform_vectors, 1); + { + GLint dims[2] = {0, 0}; + DoGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims, 2); + caps.max_viewport_width = dims[0]; + caps.max_viewport_height = dims[1]; + } DoGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &caps.num_compressed_texture_formats, 1); DoGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &caps.num_shader_binary_formats,
diff --git a/gpu/config/gpu_driver_bug_list_json.cc b/gpu/config/gpu_driver_bug_list_json.cc index 2482bb6..37e3289 100644 --- a/gpu/config/gpu_driver_bug_list_json.cc +++ b/gpu/config/gpu_driver_bug_list_json.cc
@@ -19,7 +19,7 @@ { "name": "gpu driver bug list", // Please update the version number whenever you change this file. - "version": "9.23", + "version": "9.24", "entries": [ { "id": 1, @@ -1904,7 +1904,6 @@ "os": { "type": "macosx" }, - "vendor_id": "0x8086", "features": [ "reset_base_mipmap_level_before_texstorage" ]
diff --git a/media/capture/BUILD.gn b/media/capture/BUILD.gn index 5c80e201..4414910 100644 --- a/media/capture/BUILD.gn +++ b/media/capture/BUILD.gn
@@ -172,6 +172,7 @@ "content/video_capture_oracle_unittest.cc", "video/fake_video_capture_device_unittest.cc", "video/linux/camera_facing_chromeos_unittest.cc", + "video/linux/v4l2_capture_delegate_unittest.cc", "video/mac/video_capture_device_factory_mac_unittest.mm", "video/video_capture_device_unittest.cc", ]
diff --git a/media/capture/video/linux/v4l2_capture_delegate.cc b/media/capture/video/linux/v4l2_capture_delegate.cc index 8b48b8a..7277641a 100644 --- a/media/capture/video/linux/v4l2_capture_delegate.cc +++ b/media/capture/video/linux/v4l2_capture_delegate.cc
@@ -5,6 +5,7 @@ #include "media/capture/video/linux/v4l2_capture_delegate.h" #include <linux/version.h> +#include <linux/videodev2.h> #include <poll.h> #include <sys/fcntl.h> #include <sys/ioctl.h> @@ -77,6 +78,16 @@ {V4L2_PIX_FMT_JPEG, PIXEL_FORMAT_MJPEG, 1}, }; +// Maximum number of ioctl retries before giving up trying to reset controls. +const int kMaxIOCtrlRetries = 5; + +// Base id and class identifier for Controls to be reset. +static struct { + uint32_t control_base; + uint32_t class_id; +} const kControls[] = {{V4L2_CID_USER_BASE, V4L2_CID_USER_CLASS}, + {V4L2_CID_CAMERA_CLASS_BASE, V4L2_CID_CAMERA_CLASS}}; + // Fill in |format| with the given parameters. static void FillV4L2Format(v4l2_format* format, uint32_t width, @@ -134,6 +145,128 @@ return capability; } +// Determines if |control_id| is special, i.e. controls another one's state. +static bool IsSpecialControl(int control_id) { + switch (control_id) { + case V4L2_CID_AUTO_WHITE_BALANCE: + case V4L2_CID_EXPOSURE_AUTO: + case V4L2_CID_EXPOSURE_AUTO_PRIORITY: + case V4L2_CID_FOCUS_AUTO: + return true; + } + return false; +} + +// Sets all user control to their default. Some controls are enabled by another +// flag, usually having the word "auto" in the name, see IsSpecialControl(). +// These flags are preset beforehand, then set to their defaults individually +// afterwards. +static void ResetUserAndCameraControlsToDefault(int device_fd) { + // Set V4L2_CID_AUTO_WHITE_BALANCE to false first. + v4l2_control auto_white_balance = {}; + auto_white_balance.id = V4L2_CID_AUTO_WHITE_BALANCE; + auto_white_balance.value = false; + int num_retries = 0; + // Setting up the first control right after stopping streaming seems + // not to the work the first time, so retry a few times. + for (; num_retries < kMaxIOCtrlRetries && + HANDLE_EINTR(ioctl(device_fd, VIDIOC_S_CTRL, &auto_white_balance)) < 0; + ++num_retries) { + DPLOG(WARNING) << "VIDIOC_S_CTRL"; + } + if (num_retries == kMaxIOCtrlRetries) { + DLOG(ERROR) << "Cannot access device controls"; + return; + } + + std::vector<struct v4l2_ext_control> special_camera_controls; + // Set V4L2_CID_EXPOSURE_AUTO to V4L2_EXPOSURE_MANUAL. + v4l2_ext_control auto_exposure = {}; + auto_exposure.id = V4L2_CID_EXPOSURE_AUTO; + auto_exposure.value = V4L2_EXPOSURE_MANUAL; + special_camera_controls.push_back(auto_exposure); + // Set V4L2_CID_EXPOSURE_AUTO_PRIORITY to false. + v4l2_ext_control priority_auto_exposure = {}; + priority_auto_exposure.id = V4L2_CID_EXPOSURE_AUTO_PRIORITY; + priority_auto_exposure.value = false; + special_camera_controls.push_back(priority_auto_exposure); + // Set V4L2_CID_FOCUS_AUTO to false. + v4l2_ext_control auto_focus = {}; + auto_focus.id = V4L2_CID_FOCUS_AUTO; + auto_focus.value = false; + special_camera_controls.push_back(auto_focus); + + struct v4l2_ext_controls ext_controls = {}; + ext_controls.ctrl_class = V4L2_CID_CAMERA_CLASS; + ext_controls.count = special_camera_controls.size(); + ext_controls.controls = special_camera_controls.data(); + if (HANDLE_EINTR(ioctl(device_fd, VIDIOC_S_EXT_CTRLS, &ext_controls)) < 0) + DPLOG(ERROR) << "VIDIOC_S_EXT_CTRLS"; + + std::vector<struct v4l2_ext_control> camera_controls; + for (const auto& control : kControls) { + std::vector<struct v4l2_ext_control> camera_controls; + + v4l2_queryctrl range = {}; + range.id = control.control_base | V4L2_CTRL_FLAG_NEXT_CTRL; + while (0 == HANDLE_EINTR(ioctl(device_fd, VIDIOC_QUERYCTRL, &range))) { + if (V4L2_CTRL_ID2CLASS(range.id) != V4L2_CTRL_ID2CLASS(control.class_id)) + break; + range.id |= V4L2_CTRL_FLAG_NEXT_CTRL; + + if (IsSpecialControl(range.id & ~V4L2_CTRL_FLAG_NEXT_CTRL)) + continue; + + struct v4l2_ext_control ext_control = {}; + ext_control.id = range.id & ~V4L2_CTRL_FLAG_NEXT_CTRL; + ext_control.value = range.default_value; + camera_controls.push_back(ext_control); + } + + if (!camera_controls.empty()) { + struct v4l2_ext_controls ext_controls = {}; + ext_controls.ctrl_class = control.class_id; + ext_controls.count = camera_controls.size(); + ext_controls.controls = camera_controls.data(); + if (HANDLE_EINTR(ioctl(device_fd, VIDIOC_S_EXT_CTRLS, &ext_controls)) < 0) + DPLOG(ERROR) << "VIDIOC_S_EXT_CTRLS"; + } + } + + // Now set the special flags to the default values + v4l2_queryctrl range = {}; + range.id = V4L2_CID_AUTO_WHITE_BALANCE; + HANDLE_EINTR(ioctl(device_fd, VIDIOC_QUERYCTRL, &range)); + auto_white_balance.value = range.default_value; + HANDLE_EINTR(ioctl(device_fd, VIDIOC_S_CTRL, &auto_white_balance)); + + special_camera_controls.clear(); + memset(&range, 0, sizeof(struct v4l2_queryctrl)); + range.id = V4L2_CID_EXPOSURE_AUTO; + HANDLE_EINTR(ioctl(device_fd, VIDIOC_QUERYCTRL, &range)); + auto_exposure.value = range.default_value; + special_camera_controls.push_back(auto_exposure); + + memset(&range, 0, sizeof(struct v4l2_queryctrl)); + range.id = V4L2_CID_EXPOSURE_AUTO_PRIORITY; + HANDLE_EINTR(ioctl(device_fd, VIDIOC_QUERYCTRL, &range)); + priority_auto_exposure.value = range.default_value; + special_camera_controls.push_back(priority_auto_exposure); + + memset(&range, 0, sizeof(struct v4l2_queryctrl)); + range.id = V4L2_CID_FOCUS_AUTO; + HANDLE_EINTR(ioctl(device_fd, VIDIOC_QUERYCTRL, &range)); + auto_focus.value = range.default_value; + special_camera_controls.push_back(auto_focus); + + memset(&ext_controls, 0, sizeof(struct v4l2_ext_controls)); + ext_controls.ctrl_class = V4L2_CID_CAMERA_CLASS; + ext_controls.count = special_camera_controls.size(); + ext_controls.controls = special_camera_controls.data(); + if (HANDLE_EINTR(ioctl(device_fd, VIDIOC_S_EXT_CTRLS, &ext_controls)) < 0) + DPLOG(ERROR) << "VIDIOC_S_EXT_CTRLS"; +} + // Class keeping track of a SPLANE V4L2 buffer, mmap()ed on construction and // munmap()ed on destruction. class V4L2CaptureDelegate::BufferTracker @@ -355,6 +488,7 @@ if (HANDLE_EINTR(ioctl(device_fd_.get(), VIDIOC_REQBUFS, &r_buffer)) < 0) SetErrorState(FROM_HERE, "Failed to VIDIOC_REQBUFS with count = 0"); + ResetUserAndCameraControlsToDefault(device_fd_.get()); // At this point we can close the device. // This is also needed for correctly changing settings later via VIDIOC_S_FMT. device_fd_.reset();
diff --git a/media/capture/video/linux/v4l2_capture_delegate.h b/media/capture/video/linux/v4l2_capture_delegate.h index e96835fe..82896bb 100644 --- a/media/capture/video/linux/v4l2_capture_delegate.h +++ b/media/capture/video/linux/v4l2_capture_delegate.h
@@ -30,7 +30,7 @@ // capture specifics are implemented in derived classes. Created and destroyed // on the owner's thread, otherwise living and operating on |v4l2_task_runner_|. // TODO(mcasas): Make this class a non-ref-counted. -class V4L2CaptureDelegate final +class CAPTURE_EXPORT V4L2CaptureDelegate final : public base::RefCountedThreadSafe<V4L2CaptureDelegate> { public: // Retrieves the #planes for a given |fourcc|, or 0 if unknown. @@ -65,6 +65,8 @@ void SetRotation(int rotation); private: + friend class V4L2CaptureDelegateTest; + friend class base::RefCountedThreadSafe<V4L2CaptureDelegate>; ~V4L2CaptureDelegate();
diff --git a/media/capture/video/linux/v4l2_capture_delegate_unittest.cc b/media/capture/video/linux/v4l2_capture_delegate_unittest.cc new file mode 100644 index 0000000..ad67ae5 --- /dev/null +++ b/media/capture/video/linux/v4l2_capture_delegate_unittest.cc
@@ -0,0 +1,257 @@ +// 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. + +#include <sys/fcntl.h> +#include <sys/ioctl.h> + +#include "base/files/file_enumerator.h" +#include "base/run_loop.h" +#include "base/threading/thread_task_runner_handle.h" +#include "media/capture/video/linux/v4l2_capture_delegate.h" +#include "media/capture/video/video_capture_device.h" +#include "media/capture/video/video_capture_device_descriptor.h" +#include "media/capture/video_capture_types.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +using ::testing::_; + +namespace media { + +namespace { + +ACTION_P(RunClosure, closure) { + closure.Run(); +} + +// Base id and class identifiers for Controls to be modified and later tested +// agains default values. +static struct { + uint32_t control_base; + uint32_t class_id; +} const kControls[] = {{V4L2_CID_USER_BASE, V4L2_CID_USER_CLASS}, + {V4L2_CID_CAMERA_CLASS_BASE, V4L2_CID_CAMERA_CLASS}}; + +// Determines if |control_id| is special, i.e. controls another one's state. +static bool IsSpecialControl(int control_id) { + switch (control_id) { + case V4L2_CID_AUTO_WHITE_BALANCE: + case V4L2_CID_EXPOSURE_AUTO: + case V4L2_CID_EXPOSURE_AUTO_PRIORITY: + case V4L2_CID_FOCUS_AUTO: + return true; + } + return false; +} + +static void SetControlsToMaxValues(int device_fd) { + // Set V4L2_CID_AUTO_WHITE_BALANCE to false first. + v4l2_control auto_white_balance = {}; + auto_white_balance.id = V4L2_CID_AUTO_WHITE_BALANCE; + auto_white_balance.value = false; + if (HANDLE_EINTR(ioctl(device_fd, VIDIOC_S_CTRL, &auto_white_balance)) < 0) + DPLOG(ERROR) << "VIDIOC_S_CTRL"; + + std::vector<struct v4l2_ext_control> special_camera_controls; + // Set V4L2_CID_EXPOSURE_AUTO to V4L2_EXPOSURE_MANUAL. + v4l2_ext_control auto_exposure = {}; + auto_exposure.id = V4L2_CID_EXPOSURE_AUTO; + auto_exposure.value = V4L2_EXPOSURE_MANUAL; + special_camera_controls.push_back(auto_exposure); + // Set V4L2_CID_EXPOSURE_AUTO_PRIORITY to false. + v4l2_ext_control priority_auto_exposure = {}; + priority_auto_exposure.id = V4L2_CID_EXPOSURE_AUTO_PRIORITY; + priority_auto_exposure.value = false; + special_camera_controls.push_back(priority_auto_exposure); + // Set V4L2_CID_FOCUS_AUTO to false. + v4l2_ext_control auto_focus = {}; + auto_focus.id = V4L2_CID_FOCUS_AUTO; + auto_focus.value = false; + special_camera_controls.push_back(auto_focus); + + struct v4l2_ext_controls ext_controls = {}; + ext_controls.ctrl_class = V4L2_CID_CAMERA_CLASS; + ext_controls.count = special_camera_controls.size(); + ext_controls.controls = special_camera_controls.data(); + if (HANDLE_EINTR(ioctl(device_fd, VIDIOC_S_EXT_CTRLS, &ext_controls)) < 0) + DPLOG(ERROR) << "VIDIOC_S_EXT_CTRLS"; + + for (const auto& control : kControls) { + std::vector<struct v4l2_ext_control> camera_controls; + + v4l2_queryctrl range = {}; + range.id = control.control_base | V4L2_CTRL_FLAG_NEXT_CTRL; + while (0 == HANDLE_EINTR(ioctl(device_fd, VIDIOC_QUERYCTRL, &range))) { + if (V4L2_CTRL_ID2CLASS(range.id) != V4L2_CTRL_ID2CLASS(control.class_id)) + break; + range.id |= V4L2_CTRL_FLAG_NEXT_CTRL; + + if (IsSpecialControl(range.id & ~V4L2_CTRL_FLAG_NEXT_CTRL)) + continue; + DVLOG(1) << __func__ << " " << range.name << " set to " << range.maximum; + + struct v4l2_ext_control ext_control = {}; + ext_control.id = range.id & ~V4L2_CTRL_FLAG_NEXT_CTRL; + ext_control.value = range.maximum; + camera_controls.push_back(ext_control); + } + + if (!camera_controls.empty()) { + struct v4l2_ext_controls ext_controls = {}; + ext_controls.ctrl_class = control.class_id; + ext_controls.count = camera_controls.size(); + ext_controls.controls = camera_controls.data(); + if (HANDLE_EINTR(ioctl(device_fd, VIDIOC_S_EXT_CTRLS, &ext_controls)) < 0) + DPLOG(ERROR) << "VIDIOC_S_EXT_CTRLS"; + } + + range.id = control.control_base | V4L2_CTRL_FLAG_NEXT_CTRL; + while (0 == HANDLE_EINTR(ioctl(device_fd, VIDIOC_QUERYCTRL, &range))) { + if (V4L2_CTRL_ID2CLASS(range.id) != V4L2_CTRL_ID2CLASS(control.class_id)) + break; + range.id |= V4L2_CTRL_FLAG_NEXT_CTRL; + + if (IsSpecialControl(range.id & ~V4L2_CTRL_FLAG_NEXT_CTRL)) + continue; + DVLOG(1) << __func__ << " " << range.name << " set to " << range.maximum; + + v4l2_control readback = {}; + readback.id = range.id & ~V4L2_CTRL_FLAG_NEXT_CTRL; + if (HANDLE_EINTR(ioctl(device_fd, VIDIOC_G_CTRL, &readback)) < 0) + DPLOG(ERROR) << range.name << ", failed to be read."; + EXPECT_EQ(range.maximum, readback.value) << " control " << range.name + << " didnt set correctly"; + } + } +} + +static void VerifyUserControlsAreSetToDefaultValues(int device_fd) { + for (const auto& control : kControls) { + v4l2_queryctrl range = {}; + range.id = control.control_base | V4L2_CTRL_FLAG_NEXT_CTRL; + while (0 == HANDLE_EINTR(ioctl(device_fd, VIDIOC_QUERYCTRL, &range))) { + if (V4L2_CTRL_ID2CLASS(range.id) != V4L2_CTRL_ID2CLASS(control.class_id)) + break; + range.id |= V4L2_CTRL_FLAG_NEXT_CTRL; + + DVLOG(1) << __func__ << " " << range.name << ": " << range.minimum << "-" + << range.maximum << ", default: " << range.default_value; + + v4l2_control current = {}; + current.id = range.id & ~V4L2_CTRL_FLAG_NEXT_CTRL; + if (HANDLE_EINTR(ioctl(device_fd, VIDIOC_G_CTRL, ¤t)) < 0) + DPLOG(ERROR) << "control " << range.name; + + EXPECT_EQ(range.default_value, current.value); + } + } +} + +class MockVideoCaptureDeviceClient : public VideoCaptureDevice::Client { + public: + MOCK_METHOD7(OnIncomingCapturedData, + void(const uint8_t*, + int, + const VideoCaptureFormat&, + int, + base::TimeTicks, + base::TimeDelta, + int)); + MOCK_METHOD4(ReserveOutputBuffer, + std::unique_ptr<Buffer>(const gfx::Size&, + media::VideoPixelFormat, + media::VideoPixelStorage, + int)); + void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer, + const VideoCaptureFormat& frame_format, + base::TimeTicks reference_time, + base::TimeDelta timestamp) override { + DoOnIncomingCapturedBuffer(); + } + MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void)); + void OnIncomingCapturedVideoFrame( + std::unique_ptr<Buffer> buffer, + scoped_refptr<media::VideoFrame> frame) override { + DoOnIncomingCapturedVideoFrame(); + } + MOCK_METHOD0(DoOnIncomingCapturedVideoFrame, void(void)); + MOCK_METHOD4(ResurrectLastOutputBuffer, + std::unique_ptr<Buffer>(const gfx::Size&, + VideoPixelFormat, + VideoPixelStorage, + int)); + MOCK_METHOD2(OnError, + void(const tracked_objects::Location& from_here, + const std::string& reason)); + MOCK_CONST_METHOD0(GetBufferPoolUtilization, double(void)); +}; + +class V4L2CaptureDelegateTest : public ::testing::Test { + public: + V4L2CaptureDelegateTest() + : device_descriptor_("Device 0", "/dev/video0"), + delegate_(new V4L2CaptureDelegate(device_descriptor_, + base::ThreadTaskRunnerHandle::Get(), + 50)) {} + ~V4L2CaptureDelegateTest() override = default; + + base::MessageLoop loop_; + VideoCaptureDeviceDescriptor device_descriptor_; + scoped_refptr<V4L2CaptureDelegate> delegate_; +}; + +} // anonymous namespace + +TEST_F(V4L2CaptureDelegateTest, CreateAndDestroyAndVerifyControls) { + // Check that there is at least a video device, otherwise bail. + const base::FilePath path("/dev/"); + base::FileEnumerator enumerator(path, false, base::FileEnumerator::FILES, + "video*"); + if (enumerator.Next().empty()) { + DLOG(INFO) << " No devices found, skipping test"; + return; + } + + // Open device, manipulate user and camera controls, and close it. + { + base::ScopedFD device_fd( + HANDLE_EINTR(open(device_descriptor_.device_id.c_str(), O_RDWR))); + ASSERT_TRUE(device_fd.is_valid()); + + SetControlsToMaxValues(device_fd.get()); + + base::RunLoop().RunUntilIdle(); + } + + // Start and stop capturing, triggering the resetting of user and camera + // control values. + { + std::unique_ptr<MockVideoCaptureDeviceClient> client( + new MockVideoCaptureDeviceClient()); + MockVideoCaptureDeviceClient* client_ptr = client.get(); + delegate_->AllocateAndStart(320 /* width */, 240 /* height */, + 10.0 /* frame_rate */, std::move(client)); + + base::RunLoop run_loop; + base::Closure quit_closure = run_loop.QuitClosure(); + EXPECT_CALL(*client_ptr, OnIncomingCapturedData(_, _, _, _, _, _, _)) + .Times(1) + .WillOnce(RunClosure(quit_closure)); + run_loop.Run(); + + delegate_->StopAndDeAllocate(); + base::RunLoop().RunUntilIdle(); + } + + // Reopen the device and verify all user and camera controls should be back to + // their |default_value|s. + { + base::ScopedFD device_fd( + HANDLE_EINTR(open(device_descriptor_.device_id.c_str(), O_RDWR))); + ASSERT_TRUE(device_fd.is_valid()); + VerifyUserControlsAreSetToDefaultValues(device_fd.get()); + } +} + +}; // namespace media
diff --git a/media/gpu/dxva_video_decode_accelerator_win.cc b/media/gpu/dxva_video_decode_accelerator_win.cc index 6af7501..54f72f67 100644 --- a/media/gpu/dxva_video_decode_accelerator_win.cc +++ b/media/gpu/dxva_video_decode_accelerator_win.cc
@@ -20,10 +20,12 @@ #include <string.h> #include <wmcodecdsp.h> +#include "base/atomicops.h" #include "base/base_paths_win.h" #include "base/bind.h" #include "base/callback.h" #include "base/debug/alias.h" +#include "base/debug/dump_without_crashing.h" #include "base/file_version_info.h" #include "base/files/file_path.h" #include "base/location.h" @@ -33,6 +35,7 @@ #include "base/path_service.h" #include "base/single_thread_task_runner.h" #include "base/stl_util.h" +#include "base/threading/thread_local_storage.h" #include "base/threading/thread_task_runner_handle.h" #include "base/trace_event/trace_event.h" #include "base/win/scoped_co_mem.h" @@ -182,6 +185,48 @@ L"mf.dll", L"mfplat.dll", L"msmpeg2vdec.dll", }; +// Vectored exception handlers are global to the entire process, so use TLS to +// ensure only the thread with the ScopedExceptionCatcher dumps anything. +base::ThreadLocalStorage::StaticSlot g_catcher_tls_slot = TLS_INITIALIZER; + +base::subtle::Atomic32 g_dump_count; + +LONG CALLBACK VectoredCrashHandler(EXCEPTION_POINTERS* exception_pointers) { + if (g_catcher_tls_slot.Get()) { + // Only dump first time to ensure we don't spend a lot of time doing this + // if the driver continually causes exceptions. + if (base::subtle::Barrier_AtomicIncrement(&g_dump_count, 1) == 1) + base::debug::DumpWithoutCrashing(); + } + return EXCEPTION_CONTINUE_SEARCH; +} + +// The MS VP9 MFT swallows driver exceptions and later hangs because it gets +// into a weird state. Add a vectored exception handler so a dump will be +// reported. See http://crbug.com/636158 +class ScopedExceptionCatcher { + public: + explicit ScopedExceptionCatcher(bool handle_exception) { + if (handle_exception) { + DCHECK(g_catcher_tls_slot.initialized()); + g_catcher_tls_slot.Set(static_cast<void*>(this)); + handler_ = AddVectoredExceptionHandler(1, &VectoredCrashHandler); + } + } + + ~ScopedExceptionCatcher() { + if (handler_) { + g_catcher_tls_slot.Set(nullptr); + RemoveVectoredExceptionHandler(handler_); + } + } + + private: + void* handler_ = nullptr; + + DISALLOW_COPY_AND_ASSIGN(ScopedExceptionCatcher); +}; + } // namespace namespace media { @@ -1230,6 +1275,7 @@ // static void DXVAVideoDecodeAccelerator::PreSandboxInitialization() { + g_catcher_tls_slot.Initialize(nullptr); for (const wchar_t* mfdll : kMediaFoundationVideoDecoderDLLs) ::LoadLibrary(mfdll); ::LoadLibrary(L"dxva2.dll"); @@ -1744,9 +1790,13 @@ MFT_OUTPUT_DATA_BUFFER output_data_buffer = {0}; DWORD status = 0; - HRESULT hr = decoder_->ProcessOutput(0, // No flags - 1, // # of out streams to pull from - &output_data_buffer, &status); + HRESULT hr; + { + ScopedExceptionCatcher catcher(using_ms_vp9_mft_); + hr = decoder_->ProcessOutput(0, // No flags + 1, // # of out streams to pull from + &output_data_buffer, &status); + } IMFCollection* events = output_data_buffer.pEvents; if (events != NULL) { DVLOG(1) << "Got events from ProcessOuput, but discarding"; @@ -2174,8 +2224,10 @@ this); } inputs_before_decode_++; - - hr = decoder_->ProcessInput(0, sample.get(), 0); + { + ScopedExceptionCatcher catcher(using_ms_vp9_mft_); + hr = decoder_->ProcessInput(0, sample.get(), 0); + } // As per msdn if the decoder returns MF_E_NOTACCEPTING then it means that it // has enough data to produce one or more output samples. In this case the // recommended options are to
diff --git a/net/android/cellular_signal_strength_unittest.cc b/net/android/cellular_signal_strength_unittest.cc index 50510b7..c6f87972 100644 --- a/net/android/cellular_signal_strength_unittest.cc +++ b/net/android/cellular_signal_strength_unittest.cc
@@ -52,4 +52,4 @@ } // namespace -} // namespace net \ No newline at end of file +} // namespace net
diff --git a/net/android/dummy_spnego_authenticator.h b/net/android/dummy_spnego_authenticator.h index 74f95aea..a0ce00b 100644 --- a/net/android/dummy_spnego_authenticator.h +++ b/net/android/dummy_spnego_authenticator.h
@@ -141,4 +141,4 @@ } // namespace android } // namespace net -#endif // NET_ANDROID_DUMMY_SPNEGO_AUTHENTICATOR_DRIVER_H +#endif // NET_ANDROID_DUMMY_SPNEGO_AUTHENTICATOR_H_
diff --git a/net/android/keystore.h b/net/android/keystore.h index 0fca8e6c..fe2de2b 100644 --- a/net/android/keystore.h +++ b/net/android/keystore.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 NET_ANDROID_KEYSTORE_H -#define NET_ANDROID_KEYSTORE_H +#ifndef NET_ANDROID_KEYSTORE_H_ +#define NET_ANDROID_KEYSTORE_H_ #include <jni.h> #include <stdint.h> @@ -77,4 +77,4 @@ } // namespace android } // namespace net -#endif // NET_ANDROID_KEYSTORE_H +#endif // NET_ANDROID_KEYSTORE_H_
diff --git a/net/android/legacy_openssl.h b/net/android/legacy_openssl.h index 75c77b8..434dc180 100644 --- a/net/android/legacy_openssl.h +++ b/net/android/legacy_openssl.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 NET_ANDROID_LEGACY_OPENSSL_H -#define NET_ANDROID_LEGACY_OPENSSL_H +#ifndef NET_ANDROID_LEGACY_OPENSSL_H_ +#define NET_ANDROID_LEGACY_OPENSSL_H_ // This file contains a replica of the Android system OpenSSL ABI shipped in // Android 4.1.x (API level 16). The ABI may not necessarily be compatible with @@ -94,4 +94,4 @@ } // namespace android } // namespace net -#endif // NET_ANDROID_LEGACY_OPENSSL_H +#endif // NET_ANDROID_LEGACY_OPENSSL_H_
diff --git a/net/android/network_change_notifier_factory_android.h b/net/android/network_change_notifier_factory_android.h index ab4d169..17eb11b 100644 --- a/net/android/network_change_notifier_factory_android.h +++ b/net/android/network_change_notifier_factory_android.h
@@ -40,4 +40,4 @@ } // namespace net -#endif // NET_ANDROID_NETWORK_CHANGE_NOTIFIER_FACTORY_H_ +#endif // NET_ANDROID_NETWORK_CHANGE_NOTIFIER_FACTORY_ANDROID_H_
diff --git a/net/base/ip_address.h b/net/base/ip_address.h index f095384..e326e78d 100644 --- a/net/base/ip_address.h +++ b/net/base/ip_address.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 NET_BASE_IP_ADDRESS_NET_H_ -#define NET_BASE_IP_ADDRESS_NET_H_ +#ifndef NET_BASE_IP_ADDRESS_H_ +#define NET_BASE_IP_ADDRESS_H_ #include <stddef.h> #include <stdint.h> @@ -205,4 +205,4 @@ } // namespace net -#endif // NET_BASE_IP_ADDRESS_NET_H_ +#endif // NET_BASE_IP_ADDRESS_H_
diff --git a/net/base/linked_hash_map.h b/net/base/linked_hash_map.h index 8397243..e12fd12a 100644 --- a/net/base/linked_hash_map.h +++ b/net/base/linked_hash_map.h
@@ -12,8 +12,8 @@ // Iterators should be stable in the face of mutations, except for an // iterator pointing to an element that was just deleted. -#ifndef UTIL_GTL_LINKED_HASH_MAP_H_ -#define UTIL_GTL_LINKED_HASH_MAP_H_ +#ifndef NET_BASE_LINKED_HASH_MAP_H_ +#define NET_BASE_LINKED_HASH_MAP_H_ #include <stddef.h> @@ -261,4 +261,4 @@ } // namespace net -#endif // UTIL_GTL_LINKED_HASH_MAP_H_ +#endif // NET_BASE_LINKED_HASH_MAP_H_
diff --git a/net/base/load_timing_info.cc b/net/base/load_timing_info.cc index f3301fb2..875acdd 100644 --- a/net/base/load_timing_info.cc +++ b/net/base/load_timing_info.cc
@@ -20,4 +20,3 @@ LoadTimingInfo::~LoadTimingInfo() {} } // namespace net -
diff --git a/net/base/logging_network_change_observer.h b/net/base/logging_network_change_observer.h index 503cb4f..1d0d61e 100644 --- a/net/base/logging_network_change_observer.h +++ b/net/base/logging_network_change_observer.h
@@ -54,4 +54,4 @@ } // namespace net -#endif // NET_BASE_LOGGING_NETWORK_CHANGE_OBSERVER_H_ \ No newline at end of file +#endif // NET_BASE_LOGGING_NETWORK_CHANGE_OBSERVER_H_
diff --git a/net/base/net_error_details.h b/net/base/net_error_details.h index c08f96e1..5d10d11c5 100644 --- a/net/base/net_error_details.h +++ b/net/base/net_error_details.h
@@ -41,4 +41,4 @@ } // namespace net -#endif +#endif // NET_BASE_NET_ERROR_DETAILS_H_
diff --git a/net/base/openssl_private_key_store_memory.cc b/net/base/openssl_private_key_store_memory.cc index 5b86b152..a5b5067 100644 --- a/net/base/openssl_private_key_store_memory.cc +++ b/net/base/openssl_private_key_store_memory.cc
@@ -71,4 +71,3 @@ } } // namespace net -
diff --git a/net/base/port_util.h b/net/base/port_util.h index 99a1ec48..d1cc5fe 100644 --- a/net/base/port_util.h +++ b/net/base/port_util.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 NET_BASE_NET_PORT_UTIL_ -#define NET_BASE_NET_PORT_UTIL_ +#ifndef NET_BASE_PORT_UTIL_H_ +#define NET_BASE_PORT_UTIL_H_ #include <stddef.h> @@ -45,4 +45,4 @@ } // namespace net -#endif // NET_BASE_NET_PORT_UTIL_ +#endif // NET_BASE_PORT_UTIL_H_
diff --git a/net/base/sdch_observer.h b/net/base/sdch_observer.h index b2311de8..927e88d 100644 --- a/net/base/sdch_observer.h +++ b/net/base/sdch_observer.h
@@ -56,4 +56,4 @@ } // namespace net -#endif // NET_BASE_SDCH_MANAGER_H_ +#endif // NET_BASE_SDCH_OBSERVER_H_
diff --git a/net/base/sys_addrinfo.h b/net/base/sys_addrinfo.h index 78f491c..1799fc2d 100644 --- a/net/base/sys_addrinfo.h +++ b/net/base/sys_addrinfo.h
@@ -15,6 +15,9 @@ // Prefer including this file instead of directly writing the #if / #else, // since it avoids duplicating the platform-specific selections. +#ifndef NET_BASE_SYS_ADDRINFO_H_ +#define NET_BASE_SYS_ADDRINFO_H_ + #include "build/build_config.h" #if defined(OS_WIN) @@ -24,3 +27,5 @@ #include <netinet/in.h> #include <sys/socket.h> #endif + +#endif // NET_BASE_SYS_ADDRINFO_H_
diff --git a/net/base/test_data_stream.cc b/net/base/test_data_stream.cc index 6672804..b7764215 100644 --- a/net/base/test_data_stream.cc +++ b/net/base/test_data_stream.cc
@@ -65,4 +65,3 @@ } } // namespace net -
diff --git a/net/base/test_proxy_delegate.cc b/net/base/test_proxy_delegate.cc index bfaa28e..66fd1a9 100644 --- a/net/base/test_proxy_delegate.cc +++ b/net/base/test_proxy_delegate.cc
@@ -101,4 +101,4 @@ return alternative_proxy_server_; } -} // namespace net \ No newline at end of file +} // namespace net
diff --git a/net/base/test_proxy_delegate.h b/net/base/test_proxy_delegate.h index 33a60be..3739953 100644 --- a/net/base/test_proxy_delegate.h +++ b/net/base/test_proxy_delegate.h
@@ -102,4 +102,4 @@ } // namespace net -#endif // NET_BASE_TEST_PROXY_DELEGATE_H_ \ No newline at end of file +#endif // NET_BASE_TEST_PROXY_DELEGATE_H_
diff --git a/net/cert/cert_net_fetcher.h b/net/cert/cert_net_fetcher.h index 074fc5b..56a7494 100644 --- a/net/cert/cert_net_fetcher.h +++ b/net/cert/cert_net_fetcher.h
@@ -82,4 +82,4 @@ } // namespace net -#endif // NET_CERT_NET_CERT_NET_FETCHER_H_ +#endif // NET_CERT_CERT_NET_FETCHER_H_
diff --git a/net/cert/cert_verify_proc_whitelist.h b/net/cert/cert_verify_proc_whitelist.h index 47ce983..f1582c9 100644 --- a/net/cert/cert_verify_proc_whitelist.h +++ b/net/cert/cert_verify_proc_whitelist.h
@@ -44,4 +44,4 @@ } // namespace net -#endif // NET_CERT_CERT_VERIFY_PROC_WHITELIST +#endif // NET_CERT_CERT_VERIFY_PROC_WHITELIST_H_
diff --git a/net/cert/ct_known_logs.cc b/net/cert/ct_known_logs.cc index a6598897..cca1fbe 100644 --- a/net/cert/ct_known_logs.cc +++ b/net/cert/ct_known_logs.cc
@@ -92,4 +92,3 @@ } // namespace ct } // namespace net -
diff --git a/net/cert/ct_log_verifier_util.h b/net/cert/ct_log_verifier_util.h index 9894afe5..2e62d1a7 100644 --- a/net/cert/ct_log_verifier_util.h +++ b/net/cert/ct_log_verifier_util.h
@@ -27,4 +27,4 @@ } // namespace net -#endif +#endif // NET_CERT_CT_LOG_VERIFIER_UTIL_H_
diff --git a/net/cert/ct_policy_enforcer.h b/net/cert/ct_policy_enforcer.h index c732cee..7111970e 100644 --- a/net/cert/ct_policy_enforcer.h +++ b/net/cert/ct_policy_enforcer.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 NET_CERT_CT_POLICY_ENFORCER_H -#define NET_CERT_CT_POLICY_ENFORCER_H +#ifndef NET_CERT_CT_POLICY_ENFORCER_H_ +#define NET_CERT_CT_POLICY_ENFORCER_H_ #include <stddef.h> #include <vector> @@ -105,4 +105,4 @@ } // namespace net -#endif // NET_CERT_CT_POLICY_ENFORCER_H +#endif // NET_CERT_CT_POLICY_ENFORCER_H_
diff --git a/net/cert/ct_policy_status.h b/net/cert/ct_policy_status.h index cc38585d6..c86e681 100644 --- a/net/cert/ct_policy_status.h +++ b/net/cert/ct_policy_status.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 NET_CERT_CT_POLICY_STATUS_H -#define NET_CERT_CT_POLICY_STATUS_H +#ifndef NET_CERT_CT_POLICY_STATUS_H_ +#define NET_CERT_CT_POLICY_STATUS_H_ namespace net { @@ -54,4 +54,4 @@ } // namespace net -#endif // NET_CERT_CT_POLICY_STATUS_H +#endif // NET_CERT_CT_POLICY_STATUS_H_
diff --git a/net/cert/ct_serialization_unittest.cc b/net/cert/ct_serialization_unittest.cc index 6056ea3..be84d8f 100644 --- a/net/cert/ct_serialization_unittest.cc +++ b/net/cert/ct_serialization_unittest.cc
@@ -259,4 +259,3 @@ } } // namespace net -
diff --git a/net/cert/internal/nist_pkits_unittest.h b/net/cert/internal/nist_pkits_unittest.h index 47fd462..6a454020 100644 --- a/net/cert/internal/nist_pkits_unittest.h +++ b/net/cert/internal/nist_pkits_unittest.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 NET_CERT_INTERNAL_NIST_PKITS_UNITTEST_H -#define NET_CERT_INTERNAL_NIST_PKITS_UNITTEST_H +#ifndef NET_CERT_INTERNAL_NIST_PKITS_UNITTEST_H_ +#define NET_CERT_INTERNAL_NIST_PKITS_UNITTEST_H_ #include "net/cert/internal/test_helpers.h" #include "testing/gtest/include/gtest/gtest.h" @@ -33,4 +33,4 @@ // Inline the generated test code: #include "net/third_party/nist-pkits/pkits_testcases-inl.h" -#endif // NET_CERT_INTERNAL_NIST_PKITS_UNITTEST_H +#endif // NET_CERT_INTERNAL_NIST_PKITS_UNITTEST_H_
diff --git a/net/cert/nss_cert_database_chromeos.h b/net/cert/nss_cert_database_chromeos.h index 4eb27a7..fa440575 100644 --- a/net/cert/nss_cert_database_chromeos.h +++ b/net/cert/nss_cert_database_chromeos.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 NET_CERT_NSS_CERT_DATABASE_CHROMEOS_ -#define NET_CERT_NSS_CERT_DATABASE_CHROMEOS_ +#ifndef NET_CERT_NSS_CERT_DATABASE_CHROMEOS_H_ +#define NET_CERT_NSS_CERT_DATABASE_CHROMEOS_H_ #include "base/callback.h" #include "base/macros.h" @@ -51,4 +51,4 @@ } // namespace net -#endif // NET_CERT_NSS_CERT_DATABASE_CHROMEOS_ +#endif // NET_CERT_NSS_CERT_DATABASE_CHROMEOS_H_
diff --git a/net/cert/nss_profile_filter_chromeos.cc b/net/cert/nss_profile_filter_chromeos.cc index adb5def..71eeab2 100644 --- a/net/cert/nss_profile_filter_chromeos.cc +++ b/net/cert/nss_profile_filter_chromeos.cc
@@ -158,4 +158,3 @@ } } // namespace net -
diff --git a/net/cert/ocsp_revocation_status.h b/net/cert/ocsp_revocation_status.h index 945104f..c20dd2e 100644 --- a/net/cert/ocsp_revocation_status.h +++ b/net/cert/ocsp_revocation_status.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 NET_CERT_OCSP_REVOCATION_STATUS_H -#define NET_CERT_OCSP_REVOCATION_STATUS_H +#ifndef NET_CERT_OCSP_REVOCATION_STATUS_H_ +#define NET_CERT_OCSP_REVOCATION_STATUS_H_ namespace net { @@ -15,4 +15,4 @@ } // namespace net -#endif // NET_CERT_OCSP_REVOCATION_STATUS_H +#endif // NET_CERT_OCSP_REVOCATION_STATUS_H_
diff --git a/net/cert/ocsp_verify_result.h b/net/cert/ocsp_verify_result.h index a2b8494..a4dc71e 100644 --- a/net/cert/ocsp_verify_result.h +++ b/net/cert/ocsp_verify_result.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 NET_CERT_OCSP_VERIFY_RESULT_H -#define NET_CERT_OCSP_VERIFY_RESULT_H +#ifndef NET_CERT_OCSP_VERIFY_RESULT_H_ +#define NET_CERT_OCSP_VERIFY_RESULT_H_ #include <string> @@ -65,4 +65,4 @@ } // namespace net -#endif // NET_CERT_OCSP_VERIFY_RESULT_H +#endif // NET_CERT_OCSP_VERIFY_RESULT_H_
diff --git a/net/cert/signed_tree_head.h b/net/cert/signed_tree_head.h index 2d65192..2b97f744 100644 --- a/net/cert/signed_tree_head.h +++ b/net/cert/signed_tree_head.h
@@ -61,4 +61,4 @@ } // namespace net -#endif +#endif // NET_CERT_SIGNED_TREE_HEAD_H_
diff --git a/net/cert/test_keychain_search_list_mac.h b/net/cert/test_keychain_search_list_mac.h index d0faffdb..4ae25729 100644 --- a/net/cert/test_keychain_search_list_mac.h +++ b/net/cert/test_keychain_search_list_mac.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 NET_CERT_KEYCHAIN_SEARCH_LIST_MAC_H_ -#define NET_CERT_KEYCHAIN_SEARCH_LIST_MAC_H_ +#ifndef NET_CERT_TEST_KEYCHAIN_SEARCH_LIST_MAC_H_ +#define NET_CERT_TEST_KEYCHAIN_SEARCH_LIST_MAC_H_ #include <CoreServices/CoreServices.h> #include <Security/Security.h> @@ -43,4 +43,4 @@ } // namespace net -#endif // NET_CERT_KEYCHAIN_SEARCH_LIST_MAC_H_ +#endif // NET_CERT_TEST_KEYCHAIN_SEARCH_LIST_MAC_H_
diff --git a/net/cert/x509_certificate_net_log_param.h b/net/cert/x509_certificate_net_log_param.h index 01b46f95..a6721ab4 100644 --- a/net/cert/x509_certificate_net_log_param.h +++ b/net/cert/x509_certificate_net_log_param.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 NET_BASE_X509_CERT_NET_LOG_PARAM_H_ -#define NET_BASE_X509_CERT_NET_LOG_PARAM_H_ +#ifndef NET_CERT_X509_CERTIFICATE_NET_LOG_PARAM_H_ +#define NET_CERT_X509_CERTIFICATE_NET_LOG_PARAM_H_ #include <memory> @@ -23,4 +23,4 @@ } // namespace net -#endif // NET_BASE_X509_CERT_NET_LOG_PARAM_H_ +#endif // NET_CERT_X509_CERTIFICATE_NET_LOG_PARAM_H_
diff --git a/net/cert_net/cert_net_fetcher_impl.h b/net/cert_net/cert_net_fetcher_impl.h index 625c523..d4add24 100644 --- a/net/cert_net/cert_net_fetcher_impl.h +++ b/net/cert_net/cert_net_fetcher_impl.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 NET_CERT_NET_CERT_NET_FETCHER_H_ -#define NET_CERT_NET_CERT_NET_FETCHER_H_ +#ifndef NET_CERT_NET_CERT_NET_FETCHER_IMPL_H_ +#define NET_CERT_NET_CERT_NET_FETCHER_IMPL_H_ #include <memory> @@ -25,4 +25,4 @@ } // namespace net -#endif // NET_CERT_NET_CERT_NET_FETCHER_H_ +#endif // NET_CERT_NET_CERT_NET_FETCHER_IMPL_H_
diff --git a/net/cookies/parsed_cookie.h b/net/cookies/parsed_cookie.h index aed76350..ccb30d8e 100644 --- a/net/cookies/parsed_cookie.h +++ b/net/cookies/parsed_cookie.h
@@ -153,4 +153,4 @@ } // namespace net -#endif // NET_COOKIES_COOKIE_MONSTER_H_ +#endif // NET_COOKIES_PARSED_COOKIE_H_
diff --git a/net/der/encode_values.h b/net/der/encode_values.h index d3fa08a..48a68fa0 100644 --- a/net/der/encode_values.h +++ b/net/der/encode_values.h
@@ -26,4 +26,4 @@ } // namespace net -#endif // NET_DER_ENCODE_VALUES_H +#endif // NET_DER_ENCODE_VALUES_H_
diff --git a/net/disk_cache/net_log_parameters.h b/net/disk_cache/net_log_parameters.h index 86c5c3c..d8bbe930 100644 --- a/net/disk_cache/net_log_parameters.h +++ b/net/disk_cache/net_log_parameters.h
@@ -64,4 +64,4 @@ } // namespace disk_cache -#endif // NET_DISK_CACHE_NET_LOG_CACHE_PARAMETERS_H_ +#endif // NET_DISK_CACHE_NET_LOG_PARAMETERS_H_
diff --git a/net/disk_cache/simple/simple_net_log_parameters.h b/net/disk_cache/simple/simple_net_log_parameters.h index ac9d003..39b105a 100644 --- a/net/disk_cache/simple/simple_net_log_parameters.h +++ b/net/disk_cache/simple/simple_net_log_parameters.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 NET_DISK_CACHE_SIMPLE_NET_LOG_PARAMETERS_H_ -#define NET_DISK_CACHE_SIMPLE_NET_LOG_PARAMETERS_H_ +#ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_NET_LOG_PARAMETERS_H_ +#define NET_DISK_CACHE_SIMPLE_SIMPLE_NET_LOG_PARAMETERS_H_ #include "net/log/net_log_parameters_callback.h" @@ -29,4 +29,4 @@ } // namespace disk_cache -#endif // NET_DISK_CACHE_SIMPLE_NET_LOG_PARAMETERS_H_ +#endif // NET_DISK_CACHE_SIMPLE_SIMPLE_NET_LOG_PARAMETERS_H_
diff --git a/net/dns/address_sorter_posix.cc b/net/dns/address_sorter_posix.cc index 965543c0..e354de2 100644 --- a/net/dns/address_sorter_posix.cc +++ b/net/dns/address_sorter_posix.cc
@@ -397,4 +397,3 @@ } } // namespace net -
diff --git a/net/dns/address_sorter_win.cc b/net/dns/address_sorter_win.cc index 71ad0c0..18e8721 100644 --- a/net/dns/address_sorter_win.cc +++ b/net/dns/address_sorter_win.cc
@@ -147,4 +147,3 @@ } } // namespace net -
diff --git a/net/dns/dns_client.cc b/net/dns/dns_client.cc index 109c3af..883eb01c 100644 --- a/net/dns/dns_client.cc +++ b/net/dns/dns_client.cc
@@ -103,4 +103,3 @@ } } // namespace net -
diff --git a/net/dns/dns_client.h b/net/dns/dns_client.h index 303d68e..7809a910 100644 --- a/net/dns/dns_client.h +++ b/net/dns/dns_client.h
@@ -61,4 +61,3 @@ } // namespace net #endif // NET_DNS_DNS_CLIENT_H_ -
diff --git a/net/dns/dns_config_service.cc b/net/dns/dns_config_service.cc index 0f83947..1a7a59d 100644 --- a/net/dns/dns_config_service.cc +++ b/net/dns/dns_config_service.cc
@@ -233,4 +233,3 @@ } } // namespace net -
diff --git a/net/dns/dns_config_service_unittest.cc b/net/dns/dns_config_service_unittest.cc index 99c29e5..35183096 100644 --- a/net/dns/dns_config_service_unittest.cc +++ b/net/dns/dns_config_service_unittest.cc
@@ -244,4 +244,3 @@ } } // namespace net -
diff --git a/net/dns/dns_config_service_win.h b/net/dns/dns_config_service_win.h index 47a1c05..96870e9f1 100644 --- a/net/dns/dns_config_service_win.h +++ b/net/dns/dns_config_service_win.h
@@ -148,4 +148,3 @@ } // namespace net #endif // NET_DNS_DNS_CONFIG_SERVICE_WIN_H_ -
diff --git a/net/dns/dns_config_service_win_unittest.cc b/net/dns/dns_config_service_win_unittest.cc index 5975e88a..091c090a 100644 --- a/net/dns/dns_config_service_win_unittest.cc +++ b/net/dns/dns_config_service_win_unittest.cc
@@ -443,4 +443,3 @@ } // namespace } // namespace net -
diff --git a/net/dns/dns_config_watcher_mac.h b/net/dns/dns_config_watcher_mac.h index d3e9924..3ff44d90 100644 --- a/net/dns/dns_config_watcher_mac.h +++ b/net/dns/dns_config_watcher_mac.h
@@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef NET_DNS_DNS_CONFIG_WATCHER_MAC_H_ +#define NET_DNS_DNS_CONFIG_WATCHER_MAC_H_ + #include "base/callback_forward.h" #include "net/dns/dns_config_service_posix.h" #include "net/dns/notify_watcher_mac.h" @@ -24,3 +27,5 @@ } // namespace internal } // namespace net + +#endif // NET_DNS_DNS_CONFIG_WATCHER_MAC_H_
diff --git a/net/dns/dns_hosts.cc b/net/dns/dns_hosts.cc index 568a9ce..7d457113 100644 --- a/net/dns/dns_hosts.cc +++ b/net/dns/dns_hosts.cc
@@ -215,4 +215,3 @@ } } // namespace net -
diff --git a/net/dns/dns_hosts.h b/net/dns/dns_hosts.h index e55772b7e..423258b 100644 --- a/net/dns/dns_hosts.h +++ b/net/dns/dns_hosts.h
@@ -75,4 +75,3 @@ } // namespace net #endif // NET_DNS_DNS_HOSTS_H_ -
diff --git a/net/dns/dns_hosts_unittest.cc b/net/dns/dns_hosts_unittest.cc index 7272201..e2729f6e 100644 --- a/net/dns/dns_hosts_unittest.cc +++ b/net/dns/dns_hosts_unittest.cc
@@ -183,4 +183,3 @@ } // namespace } // namespace net -
diff --git a/net/dns/dns_transaction.h b/net/dns/dns_transaction.h index f81cc55..cd56fc4 100644 --- a/net/dns/dns_transaction.h +++ b/net/dns/dns_transaction.h
@@ -77,4 +77,3 @@ } // namespace net #endif // NET_DNS_DNS_TRANSACTION_H_ -
diff --git a/net/dns/fuzzed_host_resolver.h b/net/dns/fuzzed_host_resolver.h index 4a302858..cc14578b 100644 --- a/net/dns/fuzzed_host_resolver.h +++ b/net/dns/fuzzed_host_resolver.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 NET_DNS_FUZZED_HOST_RESOLVER_ -#define NET_DNS_FUZZED_HOST_RESOLVER_ +#ifndef NET_DNS_FUZZED_HOST_RESOLVER_H_ +#define NET_DNS_FUZZED_HOST_RESOLVER_H_ #include <stdint.h> @@ -78,4 +78,4 @@ } // namespace net -#endif // NET_DNS_FUZZED_HOST_RESOLVER_ +#endif // NET_DNS_FUZZED_HOST_RESOLVER_H_
diff --git a/net/dns/serial_worker.cc b/net/dns/serial_worker.cc index 8a715f3..7ac87cc 100644 --- a/net/dns/serial_worker.cc +++ b/net/dns/serial_worker.cc
@@ -97,4 +97,3 @@ } } // namespace net -
diff --git a/net/dns/serial_worker.h b/net/dns/serial_worker.h index c48a61b..14398a8e 100644 --- a/net/dns/serial_worker.h +++ b/net/dns/serial_worker.h
@@ -94,4 +94,3 @@ } // namespace net #endif // NET_DNS_SERIAL_WORKER_H_ -
diff --git a/net/dns/serial_worker_unittest.cc b/net/dns/serial_worker_unittest.cc index 1c544db..1f940fe 100644 --- a/net/dns/serial_worker_unittest.cc +++ b/net/dns/serial_worker_unittest.cc
@@ -164,4 +164,3 @@ } // namespace } // namespace net -
diff --git a/net/ftp/ftp_directory_listing_parser_unittest.h b/net/ftp/ftp_directory_listing_parser_unittest.h index e01fc8c..34fded67 100644 --- a/net/ftp/ftp_directory_listing_parser_unittest.h +++ b/net/ftp/ftp_directory_listing_parser_unittest.h
@@ -75,4 +75,3 @@ } // namespace net #endif // NET_FTP_FTP_DIRECTORY_LISTING_PARSER_UNITTEST_H_ -
diff --git a/net/ftp/ftp_network_session.cc b/net/ftp/ftp_network_session.cc index 65dd218a..37a7cbe 100644 --- a/net/ftp/ftp_network_session.cc +++ b/net/ftp/ftp_network_session.cc
@@ -12,4 +12,3 @@ FtpNetworkSession::~FtpNetworkSession() {} } // namespace net -
diff --git a/net/http/failing_http_transaction_factory.h b/net/http/failing_http_transaction_factory.h index 47156a2..0830d57 100644 --- a/net/http/failing_http_transaction_factory.h +++ b/net/http/failing_http_transaction_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 NET_FAILING_HTTP_TRANSACTION_FACTORY_H_ -#define NET_FAILING_HTTP_TRANSACTION_FACTORY_H_ +#ifndef NET_HTTP_FAILING_HTTP_TRANSACTION_FACTORY_H_ +#define NET_HTTP_FAILING_HTTP_TRANSACTION_FACTORY_H_ #include <memory> @@ -40,4 +40,4 @@ } // namespace net -#endif // NET_FAILING_HTTP_TRANSACTION_FACTORY_H_ +#endif // NET_HTTP_FAILING_HTTP_TRANSACTION_FACTORY_H_
diff --git a/net/http/http_auth_challenge_tokenizer.h b/net/http/http_auth_challenge_tokenizer.h index ef5bf12c..fe8f6b0 100644 --- a/net/http/http_auth_challenge_tokenizer.h +++ b/net/http/http_auth_challenge_tokenizer.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 NET_HTTP_HTTP_AUTH_CHALLENGE_TOKENIZER_ -#define NET_HTTP_HTTP_AUTH_CHALLENGE_TOKENIZER_ +#ifndef NET_HTTP_HTTP_AUTH_CHALLENGE_TOKENIZER_H_ +#define NET_HTTP_HTTP_AUTH_CHALLENGE_TOKENIZER_H_ #include <string> @@ -59,4 +59,4 @@ } // namespace net -#endif // NET_HTTP_HTTP_AUTH_CHALLENGE_TOKENIZER_ +#endif // NET_HTTP_HTTP_AUTH_CHALLENGE_TOKENIZER_H_
diff --git a/net/http/http_cache_lookup_manager.h b/net/http/http_cache_lookup_manager.h index b377290..45cfa00 100644 --- a/net/http/http_cache_lookup_manager.h +++ b/net/http/http_cache_lookup_manager.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 NET_HTTP_CACHE_LOOKUP_MANAGER_H_ -#define NET_HTTP_CACHE_LOOKUP_MANAGER_H_ +#ifndef NET_HTTP_HTTP_CACHE_LOOKUP_MANAGER_H_ +#define NET_HTTP_HTTP_CACHE_LOOKUP_MANAGER_H_ #include "net/base/net_export.h" #include "net/http/http_cache.h" @@ -60,4 +60,4 @@ } // namespace net -#endif // NET_HTTP_CACHE_LOOKUP_MANAGER_H_ +#endif // NET_HTTP_HTTP_CACHE_LOOKUP_MANAGER_H_
diff --git a/net/http/http_log_util.h b/net/http/http_log_util.h index 3b8103c..ead8e7b 100644 --- a/net/http/http_log_util.h +++ b/net/http/http_log_util.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 NET_HTTP_HTTP_LOG_UTIL_ -#define NET_HTTP_HTTP_LOG_UTIL_ +#ifndef NET_HTTP_HTTP_LOG_UTIL_H_ +#define NET_HTTP_HTTP_LOG_UTIL_H_ #include <string> @@ -39,4 +39,4 @@ } // namespace net -#endif // NET_HTTP_HTTP_LOG_UTIL_ +#endif // NET_HTTP_HTTP_LOG_UTIL_H_
diff --git a/net/http/http_transaction_test_util.h b/net/http/http_transaction_test_util.h index 718fe272..e936ac9d 100644 --- a/net/http/http_transaction_test_util.h +++ b/net/http/http_transaction_test_util.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 NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ -#define NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ +#ifndef NET_HTTP_HTTP_TRANSACTION_TEST_UTIL_H_ +#define NET_HTTP_HTTP_TRANSACTION_TEST_UTIL_H_ #include "net/http/http_transaction.h" @@ -355,4 +355,4 @@ } // namespace net -#endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ +#endif // NET_HTTP_HTTP_TRANSACTION_TEST_UTIL_H_
diff --git a/net/http/mock_gssapi_library_posix.cc b/net/http/mock_gssapi_library_posix.cc index ce21159..2e4c3c11 100644 --- a/net/http/mock_gssapi_library_posix.cc +++ b/net/http/mock_gssapi_library_posix.cc
@@ -480,4 +480,3 @@ } // namespace test } // namespace net -
diff --git a/net/http/mock_gssapi_library_posix.h b/net/http/mock_gssapi_library_posix.h index 07f2542..8fc2336b 100644 --- a/net/http/mock_gssapi_library_posix.h +++ b/net/http/mock_gssapi_library_posix.h
@@ -180,4 +180,3 @@ } // namespace net #endif // NET_HTTP_MOCK_GSSAPI_LIBRARY_POSIX_H_ -
diff --git a/net/log/bounded_file_net_log_observer.h b/net/log/bounded_file_net_log_observer.h index 8724aae..8925551c 100644 --- a/net/log/bounded_file_net_log_observer.h +++ b/net/log/bounded_file_net_log_observer.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 BOUNDED_FILE_NET_LOG_OBSERVER_H_ -#define BOUNDED_FILE_NET_LOG_OBSERVER_H_ +#ifndef NET_LOG_BOUNDED_FILE_NET_LOG_OBSERVER_H_ +#define NET_LOG_BOUNDED_FILE_NET_LOG_OBSERVER_H_ #include <queue> @@ -132,4 +132,4 @@ } // namespace net -#endif // BOUNDED_FILE_NET_LOG_OBSERVER_H_ +#endif // NET_LOG_BOUNDED_FILE_NET_LOG_OBSERVER_H_
diff --git a/net/log/write_to_file_net_log_observer.h b/net/log/write_to_file_net_log_observer.h index 35d17fa..2ef4189 100644 --- a/net/log/write_to_file_net_log_observer.h +++ b/net/log/write_to_file_net_log_observer.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 WRITE_TO_FILE_NET_LOG_OBSERVER_H_ -#define WRITE_TO_FILE_NET_LOG_OBSERVER_H_ +#ifndef NET_LOG_WRITE_TO_FILE_NET_LOG_OBSERVER_H_ +#define NET_LOG_WRITE_TO_FILE_NET_LOG_OBSERVER_H_ #include <stdio.h> @@ -90,4 +90,4 @@ } // namespace net -#endif // WRITE_TO_FILE_NET_LOG_OBSERVER_H_ +#endif // NET_LOG_WRITE_TO_FILE_NET_LOG_OBSERVER_H_
diff --git a/net/nqe/cached_network_quality.cc b/net/nqe/cached_network_quality.cc index bcdd885..9b78de2 100644 --- a/net/nqe/cached_network_quality.cc +++ b/net/nqe/cached_network_quality.cc
@@ -44,4 +44,4 @@ } // namespace nqe -} // namespace net \ No newline at end of file +} // namespace net
diff --git a/net/nqe/cached_network_quality.h b/net/nqe/cached_network_quality.h index 0f6720c..9f437da9 100644 --- a/net/nqe/cached_network_quality.h +++ b/net/nqe/cached_network_quality.h
@@ -64,4 +64,4 @@ } // namespace net -#endif // NET_NQE_CACHED_NETWORK_QUALITY_H_ \ No newline at end of file +#endif // NET_NQE_CACHED_NETWORK_QUALITY_H_
diff --git a/net/nqe/effective_connection_type.cc b/net/nqe/effective_connection_type.cc index 94908d4..ea1fec4 100644 --- a/net/nqe/effective_connection_type.cc +++ b/net/nqe/effective_connection_type.cc
@@ -71,4 +71,4 @@ return false; } -} // namespace net \ No newline at end of file +} // namespace net
diff --git a/net/nqe/effective_connection_type_unittest.cc b/net/nqe/effective_connection_type_unittest.cc index f5dffba9..841a911 100644 --- a/net/nqe/effective_connection_type_unittest.cc +++ b/net/nqe/effective_connection_type_unittest.cc
@@ -50,4 +50,4 @@ } // namespace -} // namespace net \ No newline at end of file +} // namespace net
diff --git a/net/nqe/network_id.h b/net/nqe/network_id.h index ee8a5445..78b4588 100644 --- a/net/nqe/network_id.h +++ b/net/nqe/network_id.h
@@ -105,4 +105,4 @@ } // namespace nqe } // namespace net -#endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ \ No newline at end of file +#endif // NET_NQE_NETWORK_ID_H_
diff --git a/net/nqe/network_qualities_prefs_manager_unittest.cc b/net/nqe/network_qualities_prefs_manager_unittest.cc index 51bb8c5..a171bb0 100644 --- a/net/nqe/network_qualities_prefs_manager_unittest.cc +++ b/net/nqe/network_qualities_prefs_manager_unittest.cc
@@ -270,4 +270,4 @@ } // namespace -} // namespace net \ No newline at end of file +} // namespace net
diff --git a/net/nqe/network_quality.cc b/net/nqe/network_quality.cc index 6c572dc..293d4cb 100644 --- a/net/nqe/network_quality.cc +++ b/net/nqe/network_quality.cc
@@ -57,4 +57,4 @@ } // namespace internal } // namespace nqe -} // namespace net \ No newline at end of file +} // namespace net
diff --git a/net/nqe/network_quality.h b/net/nqe/network_quality.h index 9a7dbe46..a4c5f84 100644 --- a/net/nqe/network_quality.h +++ b/net/nqe/network_quality.h
@@ -96,4 +96,4 @@ } // namespace nqe } // namespace net -#endif // NET_NQE_NETWORK_QUALITY_H_ \ No newline at end of file +#endif // NET_NQE_NETWORK_QUALITY_H_
diff --git a/net/nqe/network_quality_estimator_params.cc b/net/nqe/network_quality_estimator_params.cc index ace6eae..d5b7c10 100644 --- a/net/nqe/network_quality_estimator_params.cc +++ b/net/nqe/network_quality_estimator_params.cc
@@ -365,4 +365,4 @@ } // namespace nqe -} // namespace net \ No newline at end of file +} // namespace net
diff --git a/net/nqe/network_quality_estimator_params.h b/net/nqe/network_quality_estimator_params.h index cb6a7cea..fc97e72 100644 --- a/net/nqe/network_quality_estimator_params.h +++ b/net/nqe/network_quality_estimator_params.h
@@ -73,4 +73,4 @@ } // namespace net -#endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_PARAMS_H_ \ No newline at end of file +#endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_PARAMS_H_
diff --git a/net/nqe/network_quality_estimator_test_util.h b/net/nqe/network_quality_estimator_test_util.h index ba6e66f..6bb0f962 100644 --- a/net/nqe/network_quality_estimator_test_util.h +++ b/net/nqe/network_quality_estimator_test_util.h
@@ -226,4 +226,4 @@ } // namespace net -#endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_TEST_UTIL_H_ \ No newline at end of file +#endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_TEST_UTIL_H_
diff --git a/net/nqe/network_quality_observation.h b/net/nqe/network_quality_observation.h index 5349338d..bbca25f 100644 --- a/net/nqe/network_quality_observation.h +++ b/net/nqe/network_quality_observation.h
@@ -50,4 +50,4 @@ } // namespace net -#endif // NET_NQE_NETWORK_QUALITY_OBSERVATION_H_ \ No newline at end of file +#endif // NET_NQE_NETWORK_QUALITY_OBSERVATION_H_
diff --git a/net/nqe/network_quality_observation_source.h b/net/nqe/network_quality_observation_source.h index 82b333ce..e4a8454 100644 --- a/net/nqe/network_quality_observation_source.h +++ b/net/nqe/network_quality_observation_source.h
@@ -52,4 +52,4 @@ } // namespace net -#endif // NET_NQE_NETWORK_QUALITY_OBSERVATION_SOURCE_H_ \ No newline at end of file +#endif // NET_NQE_NETWORK_QUALITY_OBSERVATION_SOURCE_H_
diff --git a/net/nqe/network_quality_store_unittest.cc b/net/nqe/network_quality_store_unittest.cc index 5a17e63..be4945e6 100644 --- a/net/nqe/network_quality_store_unittest.cc +++ b/net/nqe/network_quality_store_unittest.cc
@@ -186,4 +186,4 @@ } // namespace -} // namespace net \ No newline at end of file +} // namespace net
diff --git a/net/nqe/observation_buffer.h b/net/nqe/observation_buffer.h index b9339a8..8c7cde3 100644 --- a/net/nqe/observation_buffer.h +++ b/net/nqe/observation_buffer.h
@@ -275,4 +275,4 @@ } // namespace net -#endif // NET_NQE_OBSERVATION_BUFFER_H_ \ No newline at end of file +#endif // NET_NQE_OBSERVATION_BUFFER_H_
diff --git a/net/nqe/observation_buffer_unittest.cc b/net/nqe/observation_buffer_unittest.cc index 5838fc9..63f6b859 100644 --- a/net/nqe/observation_buffer_unittest.cc +++ b/net/nqe/observation_buffer_unittest.cc
@@ -509,4 +509,4 @@ } // namespace nqe -} // namespace net \ No newline at end of file +} // namespace net
diff --git a/net/nqe/socket_watcher.h b/net/nqe/socket_watcher.h index 25528f4..09b8a393 100644 --- a/net/nqe/socket_watcher.h +++ b/net/nqe/socket_watcher.h
@@ -67,4 +67,4 @@ } // namespace net -#endif // NET_NQE_SOCKET_WATCHER_H_ \ No newline at end of file +#endif // NET_NQE_SOCKET_WATCHER_H_
diff --git a/net/nqe/throughput_analyzer.cc b/net/nqe/throughput_analyzer.cc index 716613f..6785d14 100644 --- a/net/nqe/throughput_analyzer.cc +++ b/net/nqe/throughput_analyzer.cc
@@ -296,4 +296,4 @@ } // namespace nqe -} // namespace net \ No newline at end of file +} // namespace net
diff --git a/net/nqe/throughput_analyzer.h b/net/nqe/throughput_analyzer.h index a93be45..e94102b 100644 --- a/net/nqe/throughput_analyzer.h +++ b/net/nqe/throughput_analyzer.h
@@ -184,4 +184,4 @@ } // namespace net -#endif // NET_NQE_THROUGHPUT_ANALYZER_H_ \ No newline at end of file +#endif // NET_NQE_THROUGHPUT_ANALYZER_H_
diff --git a/net/nqe/weighted_observation.h b/net/nqe/weighted_observation.h index 287442a0..334039f 100644 --- a/net/nqe/weighted_observation.h +++ b/net/nqe/weighted_observation.h
@@ -52,4 +52,4 @@ } // namespace net -#endif // NET_NQE_WEIGHTED_OBSERVATION_H_ \ No newline at end of file +#endif // NET_NQE_WEIGHTED_OBSERVATION_H_
diff --git a/net/proxy/dhcp_proxy_script_fetcher.h b/net/proxy/dhcp_proxy_script_fetcher.h index 2d33e2f..a85234d 100644 --- a/net/proxy/dhcp_proxy_script_fetcher.h +++ b/net/proxy/dhcp_proxy_script_fetcher.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 NET_PROXY_DHCP_SCRIPT_FETCHER_H_ -#define NET_PROXY_DHCP_SCRIPT_FETCHER_H_ +#ifndef NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_H_ +#define NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_H_ #include "base/compiler_specific.h" #include "base/macros.h" @@ -97,4 +97,4 @@ } // namespace net -#endif // NET_PROXY_DHCP_SCRIPT_FETCHER_H_ +#endif // NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_H_
diff --git a/net/proxy/dhcp_proxy_script_fetcher_factory.h b/net/proxy/dhcp_proxy_script_fetcher_factory.h index 46d3845c..bad2d9d 100644 --- a/net/proxy/dhcp_proxy_script_fetcher_factory.h +++ b/net/proxy/dhcp_proxy_script_fetcher_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 NET_PROXY_DHCP_SCRIPT_FETCHER_FACTORY_H_ -#define NET_PROXY_DHCP_SCRIPT_FETCHER_FACTORY_H_ +#ifndef NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_FACTORY_H_ +#define NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_FACTORY_H_ #include <memory> @@ -68,4 +68,4 @@ } // namespace net -#endif // NET_PROXY_DHCP_SCRIPT_FETCHER_FACTORY_H_ +#endif // NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_FACTORY_H_
diff --git a/net/proxy/dhcpcsvc_init_win.h b/net/proxy/dhcpcsvc_init_win.h index 39bdf24c..ec72d41 100644 --- a/net/proxy/dhcpcsvc_init_win.h +++ b/net/proxy/dhcpcsvc_init_win.h
@@ -1,8 +1,9 @@ // Copyright (c) 2011 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_PROXY_DHCPCSVC_INIT_WIN_H -#define NET_PROXY_DHCPCSVC_INIT_WIN_H + +#ifndef NET_PROXY_DHCPCSVC_INIT_WIN_H_ +#define NET_PROXY_DHCPCSVC_INIT_WIN_H_ namespace net { @@ -16,4 +17,4 @@ } // namespace net -#endif // NET_PROXY_DHCPCSVC_INIT_WIN_H +#endif // NET_PROXY_DHCPCSVC_INIT_WIN_H_
diff --git a/net/quic/chromium/crypto/channel_id_chromium.h b/net/quic/chromium/crypto/channel_id_chromium.h index fa842969f..2c9869c 100644 --- a/net/quic/chromium/crypto/channel_id_chromium.h +++ b/net/quic/chromium/crypto/channel_id_chromium.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 NET_QUIC_CRYPTO_CHANNEL_ID_CHROMIUM_H_ -#define NET_QUIC_CRYPTO_CHANNEL_ID_CHROMIUM_H_ +#ifndef NET_QUIC_CHROMIUM_CRYPTO_CHANNEL_ID_CHROMIUM_H_ +#define NET_QUIC_CHROMIUM_CRYPTO_CHANNEL_ID_CHROMIUM_H_ #include <map> #include <memory> @@ -63,4 +63,4 @@ } // namespace net -#endif // NET_QUIC_CRYPTO_CHANNEL_ID_CHROMIUM_H_ +#endif // NET_QUIC_CHROMIUM_CRYPTO_CHANNEL_ID_CHROMIUM_H_
diff --git a/net/quic/chromium/mock_quic_data.h b/net/quic/chromium/mock_quic_data.h index 69eab08e..c58ce2e 100644 --- a/net/quic/chromium/mock_quic_data.h +++ b/net/quic/chromium/mock_quic_data.h
@@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef NET_QUIC_CHROMIUM_MOCK_QUIC_DATA_H_ +#define NET_QUIC_CHROMIUM_MOCK_QUIC_DATA_H_ + #include "net/quic/core/quic_packets.h" #include "net/socket/socket_test_util.h" @@ -62,3 +65,5 @@ } // namespace test } // namespace net + +#endif // NET_QUIC_CHROMIUM_MOCK_QUIC_DATA_H_
diff --git a/net/quic/core/quic_sustained_bandwidth_recorder.h b/net/quic/core/quic_sustained_bandwidth_recorder.h index ec25dd42..fcc92c5 100644 --- a/net/quic/core/quic_sustained_bandwidth_recorder.h +++ b/net/quic/core/quic_sustained_bandwidth_recorder.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 NET_QUIC_QUIC_SUSTAINED_BANDWIDTH_RECORDER_H_ -#define NET_QUIC_QUIC_SUSTAINED_BANDWIDTH_RECORDER_H_ +#ifndef NET_QUIC_CORE_QUIC_SUSTAINED_BANDWIDTH_RECORDER_H_ +#define NET_QUIC_CORE_QUIC_SUSTAINED_BANDWIDTH_RECORDER_H_ #include <stdint.h> @@ -91,4 +91,4 @@ } // namespace net -#endif // NET_QUIC_QUIC_SUSTAINED_BANDWIDTH_RECORDER_H_ +#endif // NET_QUIC_CORE_QUIC_SUSTAINED_BANDWIDTH_RECORDER_H_
diff --git a/net/quic/platform/impl/quic_export_impl.h b/net/quic/platform/impl/quic_export_impl.h index cc25f732..cbf2ea47 100644 --- a/net/quic/platform/impl/quic_export_impl.h +++ b/net/quic/platform/impl/quic_export_impl.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef NET_QUIC_PLATFORM_IMPL_QUIC_EXPORT_H_ -#define NET_QUIC_PLATFORM_IMPL_QUIC_EXPORT_H_ +#ifndef NET_QUIC_PLATFORM_IMPL_QUIC_EXPORT_IMPL_H_ +#define NET_QUIC_PLATFORM_IMPL_QUIC_EXPORT_IMPL_H_ #include "net/base/net_export.h" #define QUIC_EXPORT NET_EXPORT #define QUIC_EXPORT_PRIVATE NET_EXPORT_PRIVATE -#endif // NET_QUIC_PLATFORM_IMPL_QUIC_EXPORT_H_ +#endif // NET_QUIC_PLATFORM_IMPL_QUIC_EXPORT_IMPL_H_
diff --git a/net/spdy/hpack/hpack_constants.h b/net/spdy/hpack/hpack_constants.h index 8718ffe..fdfb0d12 100644 --- a/net/spdy/hpack/hpack_constants.h +++ b/net/spdy/hpack/hpack_constants.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 NET_SPDY_HPACK_CONSTANTS_H_ -#define NET_SPDY_HPACK_CONSTANTS_H_ +#ifndef NET_SPDY_HPACK_HPACK_CONSTANTS_H_ +#define NET_SPDY_HPACK_HPACK_CONSTANTS_H_ #include <stddef.h> #include <stdint.h> @@ -90,4 +90,4 @@ } // namespace net -#endif // NET_SPDY_HPACK_CONSTANTS_H_ +#endif // NET_SPDY_HPACK_HPACK_CONSTANTS_H_
diff --git a/net/spdy/hpack/hpack_entry.h b/net/spdy/hpack/hpack_entry.h index de3f9fe..12d3f068 100644 --- a/net/spdy/hpack/hpack_entry.h +++ b/net/spdy/hpack/hpack_entry.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 NET_SPDY_HPACK_ENTRY_H_ -#define NET_SPDY_HPACK_ENTRY_H_ +#ifndef NET_SPDY_HPACK_HPACK_ENTRY_H_ +#define NET_SPDY_HPACK_HPACK_ENTRY_H_ #include <stddef.h> @@ -104,4 +104,4 @@ } // namespace net -#endif // NET_SPDY_HPACK_ENTRY_H_ +#endif // NET_SPDY_HPACK_HPACK_ENTRY_H_
diff --git a/net/spdy/hpack/hpack_header_table.h b/net/spdy/hpack/hpack_header_table.h index 3fb8036a..ca0318a 100644 --- a/net/spdy/hpack/hpack_header_table.h +++ b/net/spdy/hpack/hpack_header_table.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 NET_SPDY_HPACK_HEADER_TABLE_H_ -#define NET_SPDY_HPACK_HEADER_TABLE_H_ +#ifndef NET_SPDY_HPACK_HPACK_HEADER_TABLE_H_ +#define NET_SPDY_HPACK_HPACK_HEADER_TABLE_H_ #include <cstddef> #include <deque> @@ -173,4 +173,4 @@ } // namespace net -#endif // NET_SPDY_HPACK_HEADER_TABLE_H_ +#endif // NET_SPDY_HPACK_HPACK_HEADER_TABLE_H_
diff --git a/net/spdy/hpack/hpack_huffman_table.h b/net/spdy/hpack/hpack_huffman_table.h index c02e175e..96c3950 100644 --- a/net/spdy/hpack/hpack_huffman_table.h +++ b/net/spdy/hpack/hpack_huffman_table.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 NET_SPDY_HPACK_HUFFMAN_TABLE_H_ -#define NET_SPDY_HPACK_HUFFMAN_TABLE_H_ +#ifndef NET_SPDY_HPACK_HPACK_HUFFMAN_TABLE_H_ +#define NET_SPDY_HPACK_HPACK_HUFFMAN_TABLE_H_ #include <stdint.h> @@ -129,4 +129,4 @@ } // namespace net -#endif // NET_SPDY_HPACK_HUFFMAN_TABLE_H_ +#endif // NET_SPDY_HPACK_HPACK_HUFFMAN_TABLE_H_
diff --git a/net/spdy/hpack/hpack_input_stream.h b/net/spdy/hpack/hpack_input_stream.h index af26c94..95791bb 100644 --- a/net/spdy/hpack/hpack_input_stream.h +++ b/net/spdy/hpack/hpack_input_stream.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 NET_SPDY_HPACK_INPUT_STREAM_H_ -#define NET_SPDY_HPACK_INPUT_STREAM_H_ +#ifndef NET_SPDY_HPACK_HPACK_INPUT_STREAM_H_ +#define NET_SPDY_HPACK_HPACK_INPUT_STREAM_H_ #include <stddef.h> #include <stdint.h> @@ -110,4 +110,4 @@ } // namespace net -#endif // NET_SPDY_HPACK_INPUT_STREAM_H_ +#endif // NET_SPDY_HPACK_HPACK_INPUT_STREAM_H_
diff --git a/net/spdy/hpack/hpack_output_stream.h b/net/spdy/hpack/hpack_output_stream.h index 4451a88..41dfd7d4 100644 --- a/net/spdy/hpack/hpack_output_stream.h +++ b/net/spdy/hpack/hpack_output_stream.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 NET_SPDY_HPACK_OUTPUT_STREAM_H_ -#define NET_SPDY_HPACK_OUTPUT_STREAM_H_ +#ifndef NET_SPDY_HPACK_HPACK_OUTPUT_STREAM_H_ +#define NET_SPDY_HPACK_HPACK_OUTPUT_STREAM_H_ #include <stddef.h> #include <stdint.h> @@ -72,4 +72,4 @@ } // namespace net -#endif // NET_SPDY_HPACK_OUTPUT_STREAM_H_ +#endif // NET_SPDY_HPACK_HPACK_OUTPUT_STREAM_H_
diff --git a/net/spdy/hpack/hpack_static_table.h b/net/spdy/hpack/hpack_static_table.h index ad220974..9239134 100644 --- a/net/spdy/hpack/hpack_static_table.h +++ b/net/spdy/hpack/hpack_static_table.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 NET_SPDY_HPACK_STATIC_TABLE_H_ -#define NET_SPDY_HPACK_STATIC_TABLE_H_ +#ifndef NET_SPDY_HPACK_HPACK_STATIC_TABLE_H_ +#define NET_SPDY_HPACK_HPACK_STATIC_TABLE_H_ #include <stddef.h> @@ -50,4 +50,4 @@ } // namespace net -#endif // NET_SPDY_HPACK_STATIC_TABLE_H_ +#endif // NET_SPDY_HPACK_HPACK_STATIC_TABLE_H_
diff --git a/net/spdy/http2_priority_dependencies.h b/net/spdy/http2_priority_dependencies.h index fbf099c..cfd2106 100644 --- a/net/spdy/http2_priority_dependencies.h +++ b/net/spdy/http2_priority_dependencies.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 NET_HTTP2_PRIORITY_DEPENDENCIES_H_ -#define NET_HTTP2_PRIORITY_DEPENDENCIES_H_ +#ifndef NET_SPDY_HTTP2_PRIORITY_DEPENDENCIES_H_ +#define NET_SPDY_HTTP2_PRIORITY_DEPENDENCIES_H_ #include <list> #include <map> @@ -58,4 +58,4 @@ } // namespace net -#endif // NET_HTTP2_PRIORITY_DEPENDENCIES_H_ +#endif // NET_SPDY_HTTP2_PRIORITY_DEPENDENCIES_H_
diff --git a/net/spdy/server_push_delegate.h b/net/spdy/server_push_delegate.h index 52e52946..7e9c3db8 100644 --- a/net/spdy/server_push_delegate.h +++ b/net/spdy/server_push_delegate.h
@@ -34,4 +34,4 @@ } // namespace net -#endif // NET_SPDY_PUSH_DELEGATE_H_ +#endif // NET_SPDY_SERVER_PUSH_DELEGATE_H_
diff --git a/net/spdy/spdy_read_queue.h b/net/spdy/spdy_read_queue.h index 87fc0ab..769c2c6 100644 --- a/net/spdy/spdy_read_queue.h +++ b/net/spdy/spdy_read_queue.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 NET_SPDY_SPDY_BUFFER_QUEUE_H_ -#define NET_SPDY_SPDY_BUFFER_QUEUE_H_ +#ifndef NET_SPDY_SPDY_READ_QUEUE_H_ +#define NET_SPDY_SPDY_READ_QUEUE_H_ #include <cstddef> #include <deque> @@ -50,4 +50,4 @@ } // namespace net -#endif // NET_SPDY_SPDY_BUFFER_QUEUE_H_ +#endif // NET_SPDY_SPDY_READ_QUEUE_H_
diff --git a/net/spdy/spdy_session_key.h b/net/spdy/spdy_session_key.h index b1da297d..31d61a3e 100644 --- a/net/spdy/spdy_session_key.h +++ b/net/spdy/spdy_session_key.h
@@ -58,4 +58,3 @@ } // namespace net #endif // NET_SPDY_SPDY_SESSION_KEY_H_ -
diff --git a/net/ssl/ssl_client_session_cache.h b/net/ssl/ssl_client_session_cache.h index 8133010c..4a82010b 100644 --- a/net/ssl/ssl_client_session_cache.h +++ b/net/ssl/ssl_client_session_cache.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 NET_SSL_SSL_CLIENT_SESSION_CACHE_H -#define NET_SSL_SSL_CLIENT_SESSION_CACHE_H +#ifndef NET_SSL_SSL_CLIENT_SESSION_CACHE_H_ +#define NET_SSL_SSL_CLIENT_SESSION_CACHE_H_ #include <stddef.h> #include <time.h> @@ -94,4 +94,4 @@ } // namespace net -#endif // NET_SSL_SSL_CLIENT_SESSION_CACHE_H +#endif // NET_SSL_SSL_CLIENT_SESSION_CACHE_H_
diff --git a/net/ssl/ssl_platform_key_mac.cc b/net/ssl/ssl_platform_key_mac.cc index 439e06b..4000c61 100644 --- a/net/ssl/ssl_platform_key_mac.cc +++ b/net/ssl/ssl_platform_key_mac.cc
@@ -221,8 +221,10 @@ const CSSM_KEY* cssm_key; OSStatus status = SecKeyGetCSSMKey(private_key.get(), &cssm_key); - if (status != noErr) + if (status != noErr) { + OSSTATUS_LOG(WARNING, status); return nullptr; + } SSLPrivateKey::Type key_type; size_t max_length;
diff --git a/net/ssl/ssl_platform_key_util.cc b/net/ssl/ssl_platform_key_util.cc index 3e646983..6c76220 100644 --- a/net/ssl/ssl_platform_key_util.cc +++ b/net/ssl/ssl_platform_key_util.cc
@@ -71,7 +71,8 @@ return false; } - switch (EVP_PKEY_id(key.get())) { + int key_type = EVP_PKEY_id(key.get()); + switch (key_type) { case EVP_PKEY_RSA: *out_type = SSLPrivateKey::Type::RSA; break; @@ -90,12 +91,14 @@ *out_type = SSLPrivateKey::Type::ECDSA_P384; break; default: + LOG(ERROR) << "Unsupported curve type " << curve; return false; } break; } default: + LOG(ERROR) << "Unsupported key type " << key_type; return false; }
diff --git a/net/ssl/test_ssl_private_key.h b/net/ssl/test_ssl_private_key.h index 15e4f91..8508b77a 100644 --- a/net/ssl/test_ssl_private_key.h +++ b/net/ssl/test_ssl_private_key.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 NET_SSL_TEST_SSL_PLATFORM_KEY_H_ -#define NET_SSL_TEST_SSL_PLATFORM_KEY_H_ +#ifndef NET_SSL_TEST_SSL_PRIVATE_KEY_H_ +#define NET_SSL_TEST_SSL_PRIVATE_KEY_H_ #include "base/memory/ref_counted.h" #include "net/base/net_export.h" @@ -20,4 +20,4 @@ } // namespace net -#endif // NET_SSL_TEST_SSL_PLATFORM_KEY_H_ +#endif // NET_SSL_TEST_SSL_PRIVATE_KEY_H_
diff --git a/net/test/ct_test_util.h b/net/test/ct_test_util.h index 7a52bec..d39079690 100644 --- a/net/test/ct_test_util.h +++ b/net/test/ct_test_util.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 NET_CERT_CT_TEST_UTIL_H_ -#define NET_CERT_CT_TEST_UTIL_H_ +#ifndef NET_TEST_CT_TEST_UTIL_H_ +#define NET_TEST_CT_TEST_UTIL_H_ #include <stddef.h> #include <stdint.h> @@ -132,4 +132,4 @@ } // namespace net -#endif // NET_CERT_CT_TEST_UTIL_H_ +#endif // NET_TEST_CT_TEST_UTIL_H_
diff --git a/net/test/spawned_test_server/local_test_server_win.cc b/net/test/spawned_test_server/local_test_server_win.cc index 6f325e0..65d554e 100644 --- a/net/test/spawned_test_server/local_test_server_win.cc +++ b/net/test/spawned_test_server/local_test_server_win.cc
@@ -164,4 +164,3 @@ } } // namespace net -
diff --git a/net/test/spawned_test_server/remote_test_server.cc b/net/test/spawned_test_server/remote_test_server.cc index 1baab8c..17dc21e 100644 --- a/net/test/spawned_test_server/remote_test_server.cc +++ b/net/test/spawned_test_server/remote_test_server.cc
@@ -248,4 +248,3 @@ } } // namespace net -
diff --git a/net/test/spawned_test_server/remote_test_server.h b/net/test/spawned_test_server/remote_test_server.h index 788f68d..224c0cd 100644 --- a/net/test/spawned_test_server/remote_test_server.h +++ b/net/test/spawned_test_server/remote_test_server.h
@@ -69,4 +69,3 @@ } // namespace net #endif // NET_TEST_SPAWNED_TEST_SERVER_REMOTE_TEST_SERVER_H_ -
diff --git a/net/test/spawned_test_server/spawned_test_server.h b/net/test/spawned_test_server/spawned_test_server.h index 9bf5831d..aa4e37a 100644 --- a/net/test/spawned_test_server/spawned_test_server.h +++ b/net/test/spawned_test_server/spawned_test_server.h
@@ -24,4 +24,3 @@ } // namespace net #endif // NET_TEST_SPAWNED_TEST_SERVER_SPAWNED_TEST_SERVER_H_ -
diff --git a/net/test/test_certificate_data.h b/net/test/test_certificate_data.h index a2e26a5..8c77e2f 100644 --- a/net/test/test_certificate_data.h +++ b/net/test/test_certificate_data.h
@@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef NET_TEST_TEST_CERTIFICATE_DATA_H_ +#define NET_TEST_TEST_CERTIFICATE_DATA_H_ + #include <stdint.h> namespace { @@ -782,3 +785,5 @@ 0x6C, 0x69, 0x65, 0x6E, 0x74, 0x20, 0x43, 0x41, 0x20, 0x76, 0x31}; } // namespace + +#endif // NET_TEST_TEST_CERTIFICATE_DATA_H_
diff --git a/net/test/url_request/url_request_hanging_read_job.h b/net/test/url_request/url_request_hanging_read_job.h index 62213f2..f5eba1e 100644 --- a/net/test/url_request/url_request_hanging_read_job.h +++ b/net/test/url_request/url_request_hanging_read_job.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 NET_URL_REQUEST_URL_REQUEST_HANGING_READ_JOB_H_ -#define NET_URL_REQUEST_URL_REQUEST_HANGING_READ_JOB_H_ +#ifndef NET_TEST_URL_REQUEST_URL_REQUEST_HANGING_READ_JOB_H_ +#define NET_TEST_URL_REQUEST_URL_REQUEST_HANGING_READ_JOB_H_ #include "base/macros.h" #include "base/memory/weak_ptr.h" @@ -44,4 +44,4 @@ } // namespace net -#endif // NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_ +#endif // NET_TEST_URL_REQUEST_URL_REQUEST_HANGING_READ_JOB_H_
diff --git a/net/test/url_request/url_request_mock_data_job.h b/net/test/url_request/url_request_mock_data_job.h index 27f3a095..0324201c 100644 --- a/net/test/url_request/url_request_mock_data_job.h +++ b/net/test/url_request/url_request_mock_data_job.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 NET_URL_REQUEST_URL_REQUEST_MOCK_DATA_JOB_H_ -#define NET_URL_REQUEST_URL_REQUEST_MOCK_DATA_JOB_H_ +#ifndef NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_DATA_JOB_H_ +#define NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_DATA_JOB_H_ #include <stddef.h> @@ -71,4 +71,4 @@ } // namespace net -#endif // NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_ +#endif // NET_TEST_URL_REQUEST_URL_REQUEST_MOCK_DATA_JOB_H_
diff --git a/net/tools/dns_fuzz_stub/dns_fuzz_stub.cc b/net/tools/dns_fuzz_stub/dns_fuzz_stub.cc index ed2a7579..5a89bf0 100644 --- a/net/tools/dns_fuzz_stub/dns_fuzz_stub.cc +++ b/net/tools/dns_fuzz_stub/dns_fuzz_stub.cc
@@ -218,4 +218,3 @@ return ret; } -
diff --git a/net/tools/quic/quic_http_response_cache.h b/net/tools/quic/quic_http_response_cache.h index 3a1857c..9ca5430 100644 --- a/net/tools/quic/quic_http_response_cache.h +++ b/net/tools/quic/quic_http_response_cache.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 NET_TOOLS_QUIC_QUIC_IN_MEMORY_CACHE_H_ -#define NET_TOOLS_QUIC_QUIC_IN_MEMORY_CACHE_H_ +#ifndef NET_TOOLS_QUIC_QUIC_HTTP_RESPONSE_CACHE_H_ +#define NET_TOOLS_QUIC_QUIC_HTTP_RESPONSE_CACHE_H_ #include <list> #include <map> @@ -218,4 +218,4 @@ } // namespace net -#endif // NET_TOOLS_QUIC_QUIC_IN_MEMORY_CACHE_H_ +#endif // NET_TOOLS_QUIC_QUIC_HTTP_RESPONSE_CACHE_H_
diff --git a/net/url_request/http_user_agent_settings.h b/net/url_request/http_user_agent_settings.h index 776e060..487f235 100644 --- a/net/url_request/http_user_agent_settings.h +++ b/net/url_request/http_user_agent_settings.h
@@ -32,4 +32,3 @@ } // namespace net #endif // NET_URL_REQUEST_HTTP_USER_AGENT_SETTINGS_H_ -
diff --git a/net/url_request/static_http_user_agent_settings.cc b/net/url_request/static_http_user_agent_settings.cc index dd74f96..84f82c4 100644 --- a/net/url_request/static_http_user_agent_settings.cc +++ b/net/url_request/static_http_user_agent_settings.cc
@@ -25,4 +25,3 @@ } } // namespace net -
diff --git a/net/url_request/static_http_user_agent_settings.h b/net/url_request/static_http_user_agent_settings.h index 991af6af6..f6d90bdf 100644 --- a/net/url_request/static_http_user_agent_settings.h +++ b/net/url_request/static_http_user_agent_settings.h
@@ -36,4 +36,3 @@ } // namespace net #endif // NET_URL_REQUEST_STATIC_HTTP_USER_AGENT_SETTINGS_H_ -
diff --git a/testing/buildbot/chromium.gpu.fyi.json b/testing/buildbot/chromium.gpu.fyi.json index 9922392..1087293 100644 --- a/testing/buildbot/chromium.gpu.fyi.json +++ b/testing/buildbot/chromium.gpu.fyi.json
@@ -351,434 +351,8 @@ ] }, "Android Release (Nexus 5X)": { - "gtest_tests": [ - { - "args": [ - "--enable-xml-result-parsing" - ], - "name": "angle_deqp_gles2_gles_tests", - "override_isolate_target": "angle_deqp_gles2_tests", - "swarming": { - "can_use_on_swarming_builders": true, - "cipd_packages": [ - { - "cipd_package": "infra/tools/luci/logdog/butler/${platform}", - "location": "bin", - "revision": "git_revision:3ff24775a900b675866fbcacf2a8f98a18b2a16a" - } - ], - "dimension_sets": [ - { - "device_os": "M", - "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": "angle_deqp_gles2_tests", - "use_xvfb": false - }, - { - "override_isolate_target": "angle_end2end_tests", - "swarming": { - "can_use_on_swarming_builders": true, - "cipd_packages": [ - { - "cipd_package": "infra/tools/luci/logdog/butler/${platform}", - "location": "bin", - "revision": "git_revision:3ff24775a900b675866fbcacf2a8f98a18b2a16a" - } - ], - "dimension_sets": [ - { - "device_os": "M", - "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": "angle_end2end_tests", - "use_xvfb": false - }, - { - "override_isolate_target": "angle_unittests", - "swarming": { - "can_use_on_swarming_builders": true, - "cipd_packages": [ - { - "cipd_package": "infra/tools/luci/logdog/butler/${platform}", - "location": "bin", - "revision": "git_revision:3ff24775a900b675866fbcacf2a8f98a18b2a16a" - } - ], - "dimension_sets": [ - { - "device_os": "M", - "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": "angle_unittests", - "use_xvfb": false - }, - { - "override_isolate_target": "gl_tests", - "swarming": { - "can_use_on_swarming_builders": true, - "cipd_packages": [ - { - "cipd_package": "infra/tools/luci/logdog/butler/${platform}", - "location": "bin", - "revision": "git_revision:3ff24775a900b675866fbcacf2a8f98a18b2a16a" - } - ], - "dimension_sets": [ - { - "device_os": "M", - "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": "gl_tests", - "use_xvfb": false - }, - { - "override_isolate_target": "gl_unittests", - "swarming": { - "can_use_on_swarming_builders": true, - "cipd_packages": [ - { - "cipd_package": "infra/tools/luci/logdog/butler/${platform}", - "location": "bin", - "revision": "git_revision:3ff24775a900b675866fbcacf2a8f98a18b2a16a" - } - ], - "dimension_sets": [ - { - "device_os": "M", - "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": "gl_unittests", - "use_xvfb": false - } - ], - "isolated_scripts": [ - { - "args": [ - "context_lost", - "--show-stdout", - "--browser=android-chromium", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "name": "context_lost_tests", - "override_compile_targets": [ - "telemetry_gpu_integration_test_run" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "M", - "device_type": "bullhead", - "os": "Android" - } - ] - } - }, - { - "args": [ - "depth_capture", - "--show-stdout", - "--browser=android-chromium", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "name": "depth_capture_tests", - "override_compile_targets": [ - "telemetry_gpu_integration_test_run" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "M", - "device_type": "bullhead", - "os": "Android" - } - ] - } - }, - { - "args": [ - "gpu_process", - "--show-stdout", - "--browser=android-chromium", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_test", - "name": "gpu_process_launch_tests", - "override_compile_targets": [ - "telemetry_gpu_test_run" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "M", - "device_type": "bullhead", - "os": "Android" - } - ] - } - }, - { - "args": [ - "gpu_rasterization", - "--show-stdout", - "--browser=android-chromium", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_test", - "name": "gpu_rasterization_tests", - "override_compile_targets": [ - "telemetry_gpu_test_run" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "M", - "device_type": "bullhead", - "os": "Android" - } - ] - } - }, - { - "args": [ - "hardware_accelerated_feature", - "--show-stdout", - "--browser=android-chromium", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_test", - "name": "hardware_accelerated_feature_tests", - "override_compile_targets": [ - "telemetry_gpu_test_run" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "M", - "device_type": "bullhead", - "os": "Android" - } - ] - } - }, - { - "args": [ - "maps", - "--show-stdout", - "--browser=android-chromium", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc", - "--os-type", - "android", - "--build-revision", - "${got_revision}", - "--test-machine-name", - "${buildername}" - ], - "isolate_name": "telemetry_gpu_test", - "name": "maps_pixel_test", - "override_compile_targets": [ - "telemetry_gpu_test_run" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "M", - "device_type": "bullhead", - "os": "Android" - } - ] - } - }, - { - "args": [ - "pixel", - "--show-stdout", - "--browser=android-chromium", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc", - "--refimg-cloud-storage-bucket", - "chromium-gpu-archive/reference-images", - "--os-type", - "android", - "--build-revision", - "${got_revision}", - "--test-machine-name", - "${buildername}" - ], - "isolate_name": "telemetry_gpu_integration_test", - "name": "pixel_test", - "non_precommit_args": [ - "--upload-refimg-to-cloud-storage" - ], - "override_compile_targets": [ - "telemetry_gpu_integration_test_run" - ], - "precommit_args": [ - "--download-refimg-from-cloud-storage" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "M", - "device_type": "bullhead", - "os": "Android" - } - ] - } - }, - { - "args": [ - "screenshot_sync", - "--show-stdout", - "--browser=android-chromium", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_test", - "name": "screenshot_sync_tests", - "override_compile_targets": [ - "telemetry_gpu_test_run" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "M", - "device_type": "bullhead", - "os": "Android" - } - ] - } - }, - { - "args": [ - "trace_test", - "--show-stdout", - "--browser=android-chromium", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_test", - "name": "trace_test", - "override_compile_targets": [ - "telemetry_gpu_test_run" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "M", - "device_type": "bullhead", - "os": "Android" - } - ] - } - }, - { - "args": [ - "webgl_conformance", - "--show-stdout", - "--browser=android-chromium", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "name": "webgl_conformance_tests", - "override_compile_targets": [ - "telemetry_gpu_integration_test_run" - ], - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "device_os": "M", - "device_type": "bullhead", - "os": "Android" - } - ] - } - } - ] + "gtest_tests": [], + "isolated_scripts": [] }, "Android Release (Nexus 6)": { "gtest_tests": [
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=SlimmingPaintInvalidation b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=SlimmingPaintInvalidation deleted file mode 100644 index c42f151..0000000 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=SlimmingPaintInvalidation +++ /dev/null
@@ -1,6 +0,0 @@ -# Expectations for SlimmingPaintInvalidation feature - -# These tests run in virtual/spinvalidation suite. -Bug(none) paint/invalidation [ Skip ] - -crbug.com/648274 fast/multicol/span/abspos-containing-block-outside-spanner.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2 b/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2 index f93adfb..819718f6 100644 --- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2 +++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2
@@ -465,6 +465,7 @@ Bug(none) fast/block/float/relative-painted-twice.html [ Failure ] Bug(none) fast/block/float/shrink-to-avoid-float-complexity.html [ Failure ] Bug(none) fast/block/float/width-update-after-clear.html [ Failure ] +crbug.com/667946 fast/block/float/float-change-composited-scrolling.html [ Failure ] Bug(none) fast/block/margin-collapse/103.html [ Failure ] Bug(none) fast/block/margin-collapse/104.html [ Failure ] Bug(none) fast/block/margin-collapse/empty-clear-blocks.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/RandomOrderExpectations b/third_party/WebKit/LayoutTests/RandomOrderExpectations index 7e6f20b8..d9e8734d 100644 --- a/third_party/WebKit/LayoutTests/RandomOrderExpectations +++ b/third_party/WebKit/LayoutTests/RandomOrderExpectations
@@ -20,7 +20,7 @@ crbug.com/663849 fast/events/mouse-cursor.html [ Pass Failure ] crbug.com/663851 fast/events/onload-re-entry.html [ Pass Failure ] crbug.com/663853 fast/scroll-behavior/main-frame-interrupted-scroll.html [ Pass Failure ] -crbug.com/671478 [ Windows ] fast/table/percent-height-replaced-content-in-cell.html [ Pass Failure ] +crbug.com/671478 [ Win ] fast/table/percent-height-replaced-content-in-cell.html [ Pass Failure ] crbug.com/663855 fast/text/ellipsis-ltr-text-in-rtl-flow-underline-composition.html [ Pass Failure ] crbug.com/663855 fast/text/ellipsis-rtl-text-in-ltr-flow.html [ Pass Failure ] crbug.com/663855 fast/text/ellipsis-rtl-text-in-rtl-flow.html [ Pass Failure ] @@ -49,7 +49,7 @@ crbug.com/663874 http/tests/fetch/window/thorough/redirect-password-other-https.html [ Pass Failure ] crbug.com/663874 http/tests/fetch/window/thorough/scheme-blob.html [ Pass Failure ] crbug.com/663874 http/tests/fetch/window/thorough/scheme-data-other-https.html [ Pass Failure ] -crbug.com/671480 [ Windows ] http/tests/inspector/file-system-project-mapping.html [ Pass Failure ] +crbug.com/671480 [ Win ] http/tests/inspector/file-system-project-mapping.html [ Pass Failure ] crbug.com/663876 http/tests/loading/doc-write-sync-third-party-script-block-effectively-2g.html [ Pass Failure ] crbug.com/663877 http/tests/media/video-load-suspend.html [ Pass Failure ] crbug.com/663879 http/tests/misc/script-no-store.html [ Pass Failure ] @@ -64,7 +64,7 @@ crbug.com/664839 http/tests/security/link-crossorigin-preload-no-cors.html [ Pass Failure ] crbug.com/664839 http/tests/security/same-origin-css.html [ Pass Failure ] crbug.com/664839 http/tests/security/same-origin-css-in-quirks.html [ Pass Failure ] -crbug.com/671475 [ Windows ] http/tests/security/suborigins/suborigin-invalid-options.html [ Pass Failure ] +crbug.com/671475 [ Win ] http/tests/security/suborigins/suborigin-invalid-options.html [ Pass Failure ] crbug.com/664839 http/tests/security/webgl-remote-read-remote-image-allowed.html [ Pass Failure ] crbug.com/664839 http/tests/security/webgl-remote-read-remote-image-allowed-with-credentials.html [ Pass Failure ] crbug.com/664840 http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_script_types.html [ Pass Failure ] @@ -88,7 +88,7 @@ crbug.com/663874 virtual/mojo-loading/http/tests/fetch/window/thorough/redirect-password-other-https.html [ Pass Failure ] crbug.com/663874 virtual/mojo-loading/http/tests/fetch/window/thorough/scheme-blob.html [ Pass Failure ] crbug.com/663874 virtual/mojo-loading/http/tests/fetch/window/thorough/scheme-data-other-https.html [ Pass Failure ] -crbug.com/671477 [ Windows ] virtual/mojo-loading/http/tests/inspector/debugger/fetch-breakpoints.html [ Pass Failure ] +crbug.com/671477 [ Win ] virtual/mojo-loading/http/tests/inspector/debugger/fetch-breakpoints.html [ Pass Failure ] crbug.com/663876 virtual/mojo-loading/http/tests/loading/doc-write-sync-third-party-script-block-effectively-2g.html [ Pass Failure ] crbug.com/663877 virtual/mojo-loading/http/tests/media/video-load-suspend.html [ Pass Failure ] crbug.com/663879 virtual/mojo-loading/http/tests/misc/script-no-store.html [ Pass Failure ] @@ -108,9 +108,11 @@ crbug.com/664840 virtual/mojo-loading/http/tests/w3c/webperf/submission/Google/resource-timing/html/test_resource_script_types.html [ Pass Failure ] crbug.com/664841 virtual/mojo-loading/http/tests/workers/worker-document-domain-security.html [ Pass Failure ] crbug.com/664841 virtual/mojo-loading/http/tests/workers/worker-performance-timeline.html [ Pass Failure ] +crbug.com/673003 [ Win ] virtual/spinvalidation/paint/invalidation/svg/marker-viewBox-changes.svg [ Pass Failure ] +crbug.com/673003 [ Win ] virtual/spinvalidation/paint/invalidation/outline-clip-change.html [ Pass Failure ] crbug.com/664843 inspector/elements/styles-4/styles-update-from-js.html [ Pass Failure ] crbug.com/664842 inspector-protocol/heap-profiler/heap-snapshot-with-active-dom-object.html [ Pass Failure ] -crbug.com/672204 [ Windows ] media/avtrack/video-track-selected.html [ Pass Failure ] +crbug.com/672204 [ Win ] media/avtrack/video-track-selected.html [ Pass Failure ] crbug.com/664844 media/track/track-cue-rendering-tree-is-removed-properly.html [ Pass Failure ] crbug.com/664844 media/track/track-default-attribute.html [ Pass Failure ] crbug.com/664844 media/track/track-kind-user-preference.html [ Pass Failure ]
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index d6cdb29..163c789 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -91,6 +91,13 @@ crbug.com/626748 virtual/spinvalidation/paint/invalidation/table/cached-change-row-border-color.html [ Skip ] crbug.com/626748 virtual/spinvalidation/paint/invalidation/table/cached-change-tbody-border-color.html [ Skip ] +# SlimmingPaintInvalidation failures (not including the skipped spinvalidation +# tests which fail because of the same reasons as the base tests). +# Skip SlimmingPaintInvalidation tests except paint/invalidation/ and +# individually listed tests. +crbug.com/646176 virtual/spinvalidation/ [ Skip ] +crbug.com/646176 virtual/spinvalidation/paint/invalidation/ [ Pass ] + crbug.com/645667 virtual/spinvalidation/paint/invalidation/outline-clip-change.html [ Crash Failure ] crbug.com/645667 virtual/spinvalidation/paint/invalidation/filter-repaint-accelerated-on-accelerated-filter.html [ Crash ] crbug.com/645667 virtual/spinvalidation/paint/invalidation/position-change-keeping-geometry.html [ Crash ] @@ -101,6 +108,10 @@ crbug.com/645667 virtual/spinvalidation/paint/invalidation/compositing/clipping-should-not-repaint-composited-descendants.html [ Crash ] crbug.com/645667 virtual/spinvalidation/paint/invalidation/filter-repaint-on-accelerated-layer.html [ Crash ] +crbug.com/672989 virtual/spinvalidation/fast/multicol/span/abspos-containing-block-outside-spanner.html [ Failure ] + +# --- End SlimmingPaintInvalidation Tests --- + # Very slight rendering changes caused by Skia rect clipping change. crbug.com/627844 virtual/gpu/fast/canvas/canvas-createImageBitmap-colorClamping.html [ Pass Failure ]
diff --git a/third_party/WebKit/LayoutTests/VirtualTestSuites b/third_party/WebKit/LayoutTests/VirtualTestSuites index 5af15c2..cb50a79 100644 --- a/third_party/WebKit/LayoutTests/VirtualTestSuites +++ b/third_party/WebKit/LayoutTests/VirtualTestSuites
@@ -337,7 +337,22 @@ }, { "prefix": "spinvalidation", - "base": "paint/invalidation", + "base": "compositing", + "args": ["--enable-blink-features=SlimmingPaintInvalidation"] + }, + { + "prefix": "spinvalidation", + "base": "fast", + "args": ["--enable-blink-features=SlimmingPaintInvalidation"] + }, + { + "prefix": "spinvalidation", + "base": "paint", + "args": ["--enable-blink-features=SlimmingPaintInvalidation"] + }, + { + "prefix": "spinvalidation", + "base": "svg", "args": ["--enable-blink-features=SlimmingPaintInvalidation"] } ]
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-iframe-eval-expected.txt b/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-iframe-eval-expected.txt index b84c360d..a7febd3 100644 --- a/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-iframe-eval-expected.txt +++ b/third_party/WebKit/LayoutTests/http/tests/inspector/extensions-iframe-eval-expected.txt
@@ -6,7 +6,7 @@ RUNNING TEST: extension_testEvalInIFrame Evaluate: "/inspector/resources/extensions-frame-eval.html" (exception: undefined) RUNNING TEST: extension_testEvalInIFrameBadOption -log: Extension server error: Object not found: bogus +error: Extension server error: Object not found: bogus Evaluate: undefined (exception: [object Object]) All tests done.
diff --git a/third_party/WebKit/LayoutTests/inspector/extensions/extensions-panel-expected.txt b/third_party/WebKit/LayoutTests/inspector/extensions/extensions-panel-expected.txt index 81b716c..f1e00c8 100644 --- a/third_party/WebKit/LayoutTests/inspector/extensions/extensions-panel-expected.txt +++ b/third_party/WebKit/LayoutTests/inspector/extensions/extensions-panel-expected.txt
@@ -36,9 +36,9 @@ Showing .../missing.txt Showing resource .../extensions/resources/missing.txt in panel network), line: undefined Showing not-found.html -log: Extension server error: Object not found: not-found.html +error: Extension server error: Object not found: not-found.html Showing javascript:console.error('oh no!') -log: Extension server error: Object not found: javascript:console.error('oh no!') +error: Extension server error: Object not found: javascript:console.error('oh no!') RUNNING TEST: extension_testSearch Panel searched: {
diff --git a/third_party/WebKit/LayoutTests/inspector/extensions/extensions-resources-expected.txt b/third_party/WebKit/LayoutTests/inspector/extensions/extensions-resources-expected.txt index 2de58f8..80460674 100644 --- a/third_party/WebKit/LayoutTests/inspector/extensions/extensions-resources-expected.txt +++ b/third_party/WebKit/LayoutTests/inspector/extensions/extensions-resources-expected.txt
@@ -45,7 +45,7 @@ 1 : "" } RUNNING TEST: extension_testOnContentCommitted -log: Extension server error: Object does not support requested operation: Resource is not editable +error: Extension server error: Object does not support requested operation: Resource is not editable content committed for resource .../audits-style1.css (type: stylesheet), new content: div.test { width: 220px; height: 42px; } Revision content: div.test { width: 220px; height: 42px; } RUNNING TEST: extension_testOnResourceAdded
diff --git a/third_party/WebKit/LayoutTests/virtual/spinvalidation/paint/invalidation/README.txt b/third_party/WebKit/LayoutTests/virtual/spinvalidation/compositing/README.txt similarity index 100% copy from third_party/WebKit/LayoutTests/virtual/spinvalidation/paint/invalidation/README.txt copy to third_party/WebKit/LayoutTests/virtual/spinvalidation/compositing/README.txt
diff --git a/third_party/WebKit/LayoutTests/virtual/spinvalidation/paint/invalidation/README.txt b/third_party/WebKit/LayoutTests/virtual/spinvalidation/fast/README.txt similarity index 100% copy from third_party/WebKit/LayoutTests/virtual/spinvalidation/paint/invalidation/README.txt copy to third_party/WebKit/LayoutTests/virtual/spinvalidation/fast/README.txt
diff --git a/third_party/WebKit/LayoutTests/virtual/spinvalidation/paint/invalidation/README.txt b/third_party/WebKit/LayoutTests/virtual/spinvalidation/paint/README.txt similarity index 100% rename from third_party/WebKit/LayoutTests/virtual/spinvalidation/paint/invalidation/README.txt rename to third_party/WebKit/LayoutTests/virtual/spinvalidation/paint/README.txt
diff --git a/third_party/WebKit/LayoutTests/virtual/spinvalidation/paint/invalidation/README.txt b/third_party/WebKit/LayoutTests/virtual/spinvalidation/svg/README.txt similarity index 100% copy from third_party/WebKit/LayoutTests/virtual/spinvalidation/paint/invalidation/README.txt copy to third_party/WebKit/LayoutTests/virtual/spinvalidation/svg/README.txt
diff --git a/third_party/WebKit/Source/bindings/core/v8/TraceWrapperMember.h b/third_party/WebKit/Source/bindings/core/v8/TraceWrapperMember.h index 39b2560..660f519 100644 --- a/third_party/WebKit/Source/bindings/core/v8/TraceWrapperMember.h +++ b/third_party/WebKit/Source/bindings/core/v8/TraceWrapperMember.h
@@ -39,8 +39,7 @@ */ TraceWrapperMember(const TraceWrapperMember& other) { *this = other; } - template <typename U> - TraceWrapperMember& operator=(const TraceWrapperMember<U>& other) { + TraceWrapperMember& operator=(const TraceWrapperMember& other) { DCHECK(other.m_parent); m_parent = other.m_parent; Member<T>::operator=(other); @@ -48,16 +47,14 @@ return *this; } - template <typename U> - TraceWrapperMember& operator=(const Member<U>& other) { + TraceWrapperMember& operator=(const Member<T>& other) { DCHECK(!traceWrapperMemberIsNotInitialized()); Member<T>::operator=(other); ScriptWrappableVisitor::writeBarrier(m_parent, other); return *this; } - template <typename U> - TraceWrapperMember& operator=(U* other) { + TraceWrapperMember& operator=(T* other) { DCHECK(!traceWrapperMemberIsNotInitialized()); Member<T>::operator=(other); ScriptWrappableVisitor::writeBarrier(m_parent, other); @@ -121,7 +118,7 @@ HeapVector<TraceWrapperMember<T>> temp; temp.reserveCapacity(a.size()); for (auto item : a) { - temp.push_back(TraceWrapperMember<T>(nullptr, item.get())); + temp.push_back(TraceWrapperMember<T>(item.parent(), item.get())); } a.clear(); a.reserveCapacity(b.size());
diff --git a/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializerTest.cpp b/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializerTest.cpp index 26b1d6f..820ce0d69c 100644 --- a/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializerTest.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializerTest.cpp
@@ -396,9 +396,12 @@ // Check that the pixel at (3, 3) is red. uint8_t pixel[4] = {}; - ASSERT_TRUE(newImageBitmap->bitmapImage()->imageForCurrentFrame()->readPixels( - SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kPremul_SkAlphaType), - &pixel, 4, 3, 3)); + ASSERT_TRUE( + newImageBitmap->bitmapImage() + ->imageForCurrentFrame(ColorBehavior::transformToTargetForTesting()) + ->readPixels(SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, + kPremul_SkAlphaType), + &pixel, 4, 3, 3)); ASSERT_THAT(pixel, ::testing::ElementsAre(255, 0, 0, 255)); } @@ -432,9 +435,12 @@ // Check that the pixels are opaque red and green, respectively. uint8_t pixels[8] = {}; - ASSERT_TRUE(newImageBitmap->bitmapImage()->imageForCurrentFrame()->readPixels( - SkImageInfo::Make(2, 1, kRGBA_8888_SkColorType, kPremul_SkAlphaType), - &pixels, 8, 0, 0)); + ASSERT_TRUE( + newImageBitmap->bitmapImage() + ->imageForCurrentFrame(ColorBehavior::transformToTargetForTesting()) + ->readPixels(SkImageInfo::Make(2, 1, kRGBA_8888_SkColorType, + kPremul_SkAlphaType), + &pixels, 8, 0, 0)); ASSERT_THAT(pixels, ::testing::ElementsAre(255, 0, 0, 255, 0, 255, 0, 255)); } @@ -498,8 +504,8 @@ // Check that the pixel at (3, 3) is red. uint8_t pixel[4] = {}; - sk_sp<SkImage> newImage = - newImageBitmap->bitmapImage()->imageForCurrentFrame(); + sk_sp<SkImage> newImage = newImageBitmap->bitmapImage()->imageForCurrentFrame( + ColorBehavior::transformToTargetForTesting()); ASSERT_TRUE(newImage->readPixels( SkImageInfo::Make(1, 1, kRGBA_8888_SkColorType, kPremul_SkAlphaType), &pixel, 4, 3, 3));
diff --git a/third_party/WebKit/Source/core/fetch/BUILD.gn b/third_party/WebKit/Source/core/fetch/BUILD.gn index 87979fa..6f1887b 100644 --- a/third_party/WebKit/Source/core/fetch/BUILD.gn +++ b/third_party/WebKit/Source/core/fetch/BUILD.gn
@@ -41,6 +41,7 @@ "ResourceLoader.h", "ResourceLoaderOptions.h", "ResourceLoadingLog.h", + "ResourceStatus.h", "SubstituteData.h", "UniqueIdentifier.cpp", "UniqueIdentifier.h",
diff --git a/third_party/WebKit/Source/core/fetch/Resource.cpp b/third_party/WebKit/Source/core/fetch/Resource.cpp index 5d93a5a9b..623946b 100644 --- a/third_party/WebKit/Source/core/fetch/Resource.cpp +++ b/third_party/WebKit/Source/core/fetch/Resource.cpp
@@ -301,6 +301,12 @@ resource->finishPendingClients(); } +constexpr Resource::Status Resource::NotStarted; +constexpr Resource::Status Resource::Pending; +constexpr Resource::Status Resource::Cached; +constexpr Resource::Status Resource::LoadError; +constexpr Resource::Status Resource::DecodeError; + Resource::Resource(const ResourceRequest& request, Type type, const ResourceLoaderOptions& options)
diff --git a/third_party/WebKit/Source/core/fetch/Resource.h b/third_party/WebKit/Source/core/fetch/Resource.h index 17136ed6..25e4147 100644 --- a/third_party/WebKit/Source/core/fetch/Resource.h +++ b/third_party/WebKit/Source/core/fetch/Resource.h
@@ -28,6 +28,7 @@ #include "core/fetch/CachedMetadataHandler.h" #include "core/fetch/IntegrityMetadata.h" #include "core/fetch/ResourceLoaderOptions.h" +#include "core/fetch/ResourceStatus.h" #include "platform/MemoryCoordinator.h" #include "platform/SharedBuffer.h" #include "platform/Timer.h" @@ -83,13 +84,14 @@ }; static const int kLastResourceType = Manifest + 1; - enum Status { - NotStarted, - Pending, // load in progress - Cached, // load completed successfully - LoadError, - DecodeError - }; + using Status = ResourceStatus; + + // TODO(hiroshige): Remove the following declarations. + static constexpr Status NotStarted = ResourceStatus::NotStarted; + static constexpr Status Pending = ResourceStatus::Pending; + static constexpr Status Cached = ResourceStatus::Cached; + static constexpr Status LoadError = ResourceStatus::LoadError; + static constexpr Status DecodeError = ResourceStatus::DecodeError; // Whether a resource client for a preload should mark the preload as // referenced.
diff --git a/third_party/WebKit/Source/core/fetch/ResourceStatus.h b/third_party/WebKit/Source/core/fetch/ResourceStatus.h new file mode 100644 index 0000000..6864d66 --- /dev/null +++ b/third_party/WebKit/Source/core/fetch/ResourceStatus.h
@@ -0,0 +1,20 @@ +// 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. + +#ifndef ResourceStatus_h +#define ResourceStatus_h + +namespace blink { + +enum class ResourceStatus { + NotStarted, + Pending, // load in progress + Cached, // load completed successfully + LoadError, + DecodeError +}; + +} // namespace blink + +#endif
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp index fc8f3772..196f5626 100644 --- a/third_party/WebKit/Source/core/frame/FrameView.cpp +++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -2951,12 +2951,6 @@ frameView.lifecycle().advanceTo(DocumentLifecycle::InPrePaint); }); - // TODO(chrishtr): merge this into the actual pre-paint tree walk. - if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) - forAllNonThrottledFrameViews([](FrameView& frameView) { - CompositingInputsUpdater(frameView.layoutView()->layer()).update(); - }); - if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) PrePaintTreeWalk().walk(*this);
diff --git a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp index 776800c..64d6a684 100644 --- a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp +++ b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp
@@ -300,7 +300,10 @@ static_cast<unsigned>(info.width()) * info.bytesPerPixel())); } - sk_sp<SkImage> skiaImage = image->imageForCurrentFrame(); + // TODO(ccameron): Canvas should operate in sRGB and not display space. + // https://crbug.com/667431 + sk_sp<SkImage> skiaImage = + image->imageForCurrentFrame(ColorBehavior::transformToGlobalTarget()); // Attempt to get raw unpremultiplied image data, executed only when skiaImage // is premultiplied. if ((((!parsedOptions.premultiplyAlpha && !skiaImage->isOpaque()) || @@ -398,7 +401,10 @@ return; // In the case where the source image is lazy-decoded, m_image may not be in // a decoded state, we trigger it here. - sk_sp<SkImage> skImage = m_image->imageForCurrentFrame(); + // TODO(ccameron): Canvas should operate in sRGB and not display space. + // https://crbug.com/667431 + sk_sp<SkImage> skImage = + m_image->imageForCurrentFrame(ColorBehavior::transformToGlobalTarget()); SkPixmap pixmap; if (!skImage->isTextureBacked() && !skImage->peekPixels(&pixmap)) { sk_sp<SkSurface> surface = @@ -489,8 +495,11 @@ return; if (isPremultiplyAlphaReverted) { parsedOptions.premultiplyAlpha = false; - m_image = StaticBitmapImage::create( - premulSkImageToUnPremul(m_image->imageForCurrentFrame().get())); + // TODO(ccameron): Canvas should operate in sRGB and not display space. + // https://crbug.com/667431 + m_image = StaticBitmapImage::create(premulSkImageToUnPremul( + m_image->imageForCurrentFrame(ColorBehavior::transformToGlobalTarget()) + .get())); } if (!m_image) return; @@ -806,8 +815,12 @@ (format == RGBAColorType) ? kRGBA_8888_SkColorType : kN32_SkColorType, (alphaOp == PremultiplyAlpha) ? kPremul_SkAlphaType : kUnpremul_SkAlphaType); - RefPtr<Uint8Array> dstPixels = - copySkImageData(m_image->imageForCurrentFrame().get(), info); + // TODO(ccameron): Canvas should operate in sRGB and not display space. + // https://crbug.com/667431 + RefPtr<Uint8Array> dstPixels = copySkImageData( + m_image->imageForCurrentFrame(ColorBehavior::transformToGlobalTarget()) + .get(), + info); return dstPixels.release(); }
diff --git a/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp b/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp index 964d9b8b..1e9a96f 100644 --- a/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp +++ b/third_party/WebKit/Source/core/frame/ImageBitmapTest.cpp
@@ -102,16 +102,24 @@ ImageBitmap* imageBitmapOutsideCrop = ImageBitmap::create( imageElement, cropRect, &(imageElement->document()), defaultOptions); - ASSERT_EQ(imageBitmapNoCrop->bitmapImage()->imageForCurrentFrame(), - imageElement->cachedImage()->getImage()->imageForCurrentFrame()); - ASSERT_NE(imageBitmapInteriorCrop->bitmapImage()->imageForCurrentFrame(), - imageElement->cachedImage()->getImage()->imageForCurrentFrame()); - ASSERT_NE(imageBitmapExteriorCrop->bitmapImage()->imageForCurrentFrame(), - imageElement->cachedImage()->getImage()->imageForCurrentFrame()); + ASSERT_EQ(imageBitmapNoCrop->bitmapImage()->imageForCurrentFrame( + ColorBehavior::transformToTargetForTesting()), + imageElement->cachedImage()->getImage()->imageForCurrentFrame( + ColorBehavior::transformToTargetForTesting())); + ASSERT_NE(imageBitmapInteriorCrop->bitmapImage()->imageForCurrentFrame( + ColorBehavior::transformToTargetForTesting()), + imageElement->cachedImage()->getImage()->imageForCurrentFrame( + ColorBehavior::transformToTargetForTesting())); + ASSERT_NE(imageBitmapExteriorCrop->bitmapImage()->imageForCurrentFrame( + ColorBehavior::transformToTargetForTesting()), + imageElement->cachedImage()->getImage()->imageForCurrentFrame( + ColorBehavior::transformToTargetForTesting())); StaticBitmapImage* emptyImage = imageBitmapOutsideCrop->bitmapImage(); - ASSERT_NE(emptyImage->imageForCurrentFrame(), - imageElement->cachedImage()->getImage()->imageForCurrentFrame()); + ASSERT_NE(emptyImage->imageForCurrentFrame( + ColorBehavior::transformToTargetForTesting()), + imageElement->cachedImage()->getImage()->imageForCurrentFrame( + ColorBehavior::transformToTargetForTesting())); } // Verifies that ImageBitmaps constructed from HTMLImageElements hold a @@ -127,8 +135,10 @@ IntRect(0, 0, m_image->width(), m_image->height()); ImageBitmap* imageBitmap = ImageBitmap::create( image, cropRect, &(image->document()), defaultOptions); - ASSERT_EQ(imageBitmap->bitmapImage()->imageForCurrentFrame(), - originalImageResource->getImage()->imageForCurrentFrame()); + ASSERT_EQ(imageBitmap->bitmapImage()->imageForCurrentFrame( + ColorBehavior::transformToTargetForTesting()), + originalImageResource->getImage()->imageForCurrentFrame( + ColorBehavior::transformToTargetForTesting())); ImageResource* newImageResource = ImageResource::create(StaticBitmapImage::create(m_image2).get()); @@ -136,23 +146,37 @@ // The ImageBitmap should contain the same data as the original cached image { - ASSERT_EQ(imageBitmap->bitmapImage()->imageForCurrentFrame(), - originalImageResource->getImage()->imageForCurrentFrame()); - SkImage* image1 = imageBitmap->bitmapImage()->imageForCurrentFrame().get(); + ASSERT_EQ(imageBitmap->bitmapImage()->imageForCurrentFrame( + ColorBehavior::transformToTargetForTesting()), + originalImageResource->getImage()->imageForCurrentFrame( + ColorBehavior::transformToTargetForTesting())); + SkImage* image1 = + imageBitmap->bitmapImage() + ->imageForCurrentFrame(ColorBehavior::transformToTargetForTesting()) + .get(); ASSERT_NE(image1, nullptr); SkImage* image2 = - originalImageResource->getImage()->imageForCurrentFrame().get(); + originalImageResource->getImage() + ->imageForCurrentFrame(ColorBehavior::transformToTargetForTesting()) + .get(); ASSERT_NE(image2, nullptr); ASSERT_EQ(image1, image2); } { - ASSERT_NE(imageBitmap->bitmapImage()->imageForCurrentFrame(), - newImageResource->getImage()->imageForCurrentFrame()); - SkImage* image1 = imageBitmap->bitmapImage()->imageForCurrentFrame().get(); + ASSERT_NE(imageBitmap->bitmapImage()->imageForCurrentFrame( + ColorBehavior::transformToTargetForTesting()), + newImageResource->getImage()->imageForCurrentFrame( + ColorBehavior::transformToTargetForTesting())); + SkImage* image1 = + imageBitmap->bitmapImage() + ->imageForCurrentFrame(ColorBehavior::transformToTargetForTesting()) + .get(); ASSERT_NE(image1, nullptr); SkImage* image2 = - newImageResource->getImage()->imageForCurrentFrame().get(); + newImageResource->getImage() + ->imageForCurrentFrame(ColorBehavior::transformToTargetForTesting()) + .get(); ASSERT_NE(image2, nullptr); ASSERT_NE(image1, image2); }
diff --git a/third_party/WebKit/Source/core/html/AutoplayUmaHelper.cpp b/third_party/WebKit/Source/core/html/AutoplayUmaHelper.cpp index 99241a2..0ab3aad 100644 --- a/third_party/WebKit/Source/core/html/AutoplayUmaHelper.cpp +++ b/third_party/WebKit/Source/core/html/AutoplayUmaHelper.cpp
@@ -10,6 +10,7 @@ #include "core/frame/Settings.h" #include "core/html/HTMLMediaElement.h" #include "platform/Histogram.h" +#include "public/platform/Platform.h" #include "wtf/CurrentTime.h" namespace blink { @@ -94,6 +95,61 @@ m_element->addEventListener(EventTypeNames::playing, this, false); } +void AutoplayUmaHelper::recordCrossOriginAutoplayResult( + CrossOriginAutoplayResult result) { + if (!m_element->isHTMLVideoElement()) + return; + if (!m_element->isInCrossOriginFrame()) + return; + + // Record each metric only once per element, since the metric focuses on the + // site distribution. If a page calls play() multiple times, it will be + // recorded only once. + if (m_recordedCrossOriginAutoplayResults.count(result)) + return; + + switch (result) { + case CrossOriginAutoplayResult::AutoplayAllowed: + // Record metric + Platform::current()->recordRapporURL( + "Media.Autoplay.CrossOrigin.Allowed.ChildFrame", + m_element->document().url()); + Platform::current()->recordRapporURL( + "Media.Autoplay.CrossOrigin.Allowed.TopLevelFrame", + m_element->document().topDocument().url()); + m_recordedCrossOriginAutoplayResults.insert(result); + break; + case CrossOriginAutoplayResult::AutoplayBlocked: + Platform::current()->recordRapporURL( + "Media.Autoplay.CrossOrigin.Blocked.ChildFrame", + m_element->document().url()); + Platform::current()->recordRapporURL( + "Media.Autoplay.CrossOrigin.Blocked.TopLevelFrame", + m_element->document().topDocument().url()); + m_recordedCrossOriginAutoplayResults.insert(result); + break; + case CrossOriginAutoplayResult::PlayedWithGesture: + // Record this metric only when the video has been blocked from autoplay + // previously. This is to record the sites having videos that are blocked + // to autoplay but the user starts the playback by gesture. + if (!m_recordedCrossOriginAutoplayResults.count( + CrossOriginAutoplayResult::AutoplayBlocked)) { + return; + } + Platform::current()->recordRapporURL( + "Media.Autoplay.CrossOrigin.PlayedWithGestureAfterBlock.ChildFrame", + m_element->document().url()); + Platform::current()->recordRapporURL( + "Media.Autoplay.CrossOrigin.PlayedWithGestureAfterBlock." + "TopLevelFrame", + m_element->document().topDocument().url()); + m_recordedCrossOriginAutoplayResults.insert(result); + break; + default: + NOTREACHED(); + } +} + void AutoplayUmaHelper::recordAutoplayUnmuteStatus( AutoplayUnmuteActionStatus status) { DEFINE_STATIC_LOCAL(
diff --git a/third_party/WebKit/Source/core/html/AutoplayUmaHelper.h b/third_party/WebKit/Source/core/html/AutoplayUmaHelper.h index 706dd561..aafa273 100644 --- a/third_party/WebKit/Source/core/html/AutoplayUmaHelper.h +++ b/third_party/WebKit/Source/core/html/AutoplayUmaHelper.h
@@ -10,6 +10,8 @@ #include "core/events/EventListener.h" #include "platform/heap/Handle.h" +#include <set> + namespace blink { // These values are used for histograms. Do not reorder. @@ -38,6 +40,12 @@ AutoplayBlockedReasonMax = 3 }; +enum class CrossOriginAutoplayResult { + AutoplayAllowed, + AutoplayBlocked, + PlayedWithGesture, +}; + class Document; class ElementVisibilityObserver; class HTMLMediaElement; @@ -57,6 +65,7 @@ void onAutoplayInitiated(AutoplaySource); + void recordCrossOriginAutoplayResult(CrossOriginAutoplayResult); void recordAutoplayUnmuteStatus(AutoplayUnmuteActionStatus); void didMoveToNewDocument(Document& oldDocument); @@ -115,6 +124,8 @@ // Whether an autoplaying muted video is visible. bool m_isVisible; + std::set<CrossOriginAutoplayResult> m_recordedCrossOriginAutoplayResults; + // The observer is used to observer an autoplaying muted video changing it's // visibility, which is used for offscreen duration UMA. The UMA is pending // for recording as long as this observer is non-null.
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp index 8971ed62..97e8f79d 100644 --- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
@@ -508,7 +508,10 @@ FloatSize()); if (status != NormalSourceImageStatus) return; - sk_sp<SkImage> image = sourceImage->imageForCurrentFrame(); + // TODO(ccameron): Canvas should produce sRGB images. + // https://crbug.com/672299 + sk_sp<SkImage> image = sourceImage->imageForCurrentFrame( + ColorBehavior::transformToGlobalTarget()); for (CanvasDrawListener* listener : m_listeners) { if (listener->needsNewFrame()) { listener->sendNewFrame(image); @@ -638,7 +641,10 @@ if (hasImageBuffer()) { snapshot = buffer()->newSkImageSnapshot(PreferNoAcceleration, reason); } else if (placeholderFrame()) { - snapshot = placeholderFrame()->imageForCurrentFrame(); + // TODO(ccameron): Canvas should produce sRGB images. + // https://crbug.com/672299 + snapshot = placeholderFrame()->imageForCurrentFrame( + ColorBehavior::transformToGlobalTarget()); } if (snapshot) { @@ -1225,6 +1231,8 @@ return m_context->getImage(hint, reason); sk_sp<SkImage> skImage; + // TODO(ccameron): Canvas should produce sRGB images. + // https://crbug.com/672299 if (m_context->is3d()) { // Because WebGL sources always require making a copy of the back buffer, we // use paintRenderingResultsToCanvas instead of getImage in order to keep a @@ -1232,7 +1240,8 @@ renderingContext()->paintRenderingResultsToCanvas(BackBuffer); skImage = hasImageBuffer() ? buffer()->newSkImageSnapshot(hint, reason) - : createTransparentImage(size())->imageForCurrentFrame(); + : createTransparentImage(size())->imageForCurrentFrame( + ColorBehavior::transformToGlobalTarget()); } else { if (ExpensiveCanvasHeuristicParameters:: DisableAccelerationToAvoidReadbacks && @@ -1241,8 +1250,11 @@ hasImageBuffer()) buffer()->disableAcceleration(); RefPtr<blink::Image> image = renderingContext()->getImage(hint, reason); - skImage = image ? image->imageForCurrentFrame() - : createTransparentImage(size())->imageForCurrentFrame(); + skImage = image + ? image->imageForCurrentFrame( + ColorBehavior::transformToGlobalTarget()) + : createTransparentImage(size())->imageForCurrentFrame( + ColorBehavior::transformToGlobalTarget()); } if (skImage) {
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp index 76f30eb3..ecaa0dcc8 100644 --- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -394,6 +394,7 @@ m_fragmentEndTime(std::numeric_limits<double>::quiet_NaN()), m_pendingActionFlags(0), m_lockedPendingUserGesture(false), + m_lockedPendingUserGestureIfCrossOriginExperimentEnabled(true), m_playing(false), m_shouldDelayLoadEvent(false), m_haveFiredLoadedData(false), @@ -422,6 +423,8 @@ BLINK_MEDIA_LOG << "HTMLMediaElement(" << (void*)this << ")"; m_lockedPendingUserGesture = computeLockedPendingUserGesture(document); + m_lockedPendingUserGestureIfCrossOriginExperimentEnabled = + isDocumentCrossOrigin(document); LocalFrame* frame = document.frame(); if (frame) { @@ -468,9 +471,8 @@ computeLockedPendingUserGesture(oldDocument); bool newDocumentRequiresUserGesture = computeLockedPendingUserGesture(document()); - if (newDocumentRequiresUserGesture && !oldDocumentRequiresUserGesture) { + if (newDocumentRequiresUserGesture && !oldDocumentRequiresUserGesture) m_lockedPendingUserGesture = true; - } if (m_shouldDelayLoadEvent) { document().incrementLoadEventDelayCount(); @@ -483,6 +485,9 @@ oldDocument.incrementLoadEventDelayCount(); } + if (isDocumentCrossOrigin(document()) && !isDocumentCrossOrigin(oldDocument)) + m_lockedPendingUserGestureIfCrossOriginExperimentEnabled = true; + removeElementFromDocumentMap(this, &oldDocument); addElementToDocumentMap(this, &document()); @@ -1330,6 +1335,10 @@ !origin->taintsCanvas(currentSrc())); } +bool HTMLMediaElement::isInCrossOriginFrame() const { + return isDocumentCrossOrigin(document()); +} + void HTMLMediaElement::startProgressEventTimer() { if (m_progressEventTimer.isActive()) return; @@ -1691,6 +1700,13 @@ m_autoplayUmaHelper->onAutoplayInitiated(AutoplaySource::Attribute); if (!isGestureNeededForPlayback()) { + if (isGestureNeededForPlaybackIfCrossOriginExperimentEnabled()) { + m_autoplayUmaHelper->recordCrossOriginAutoplayResult( + CrossOriginAutoplayResult::AutoplayBlocked); + } else { + m_autoplayUmaHelper->recordCrossOriginAutoplayResult( + CrossOriginAutoplayResult::AutoplayAllowed); + } if (isHTMLVideoElement() && muted() && RuntimeEnabledFeatures::autoplayMutedVideosEnabled()) { // We might end up in a situation where the previous @@ -1709,6 +1725,9 @@ scheduleNotifyPlaying(); m_autoplaying = false; } + } else { + m_autoplayUmaHelper->recordCrossOriginAutoplayResult( + CrossOriginAutoplayResult::AutoplayBlocked); } } @@ -2185,14 +2204,26 @@ return nullptr; } + m_autoplayUmaHelper->recordCrossOriginAutoplayResult( + CrossOriginAutoplayResult::AutoplayBlocked); String message = ExceptionMessages::failedToExecute( "play", "HTMLMediaElement", "API can only be initiated by a user gesture."); document().addConsoleMessage(ConsoleMessage::create( JSMessageSource, WarningMessageLevel, message)); return NotAllowedError; + } else { + if (isGestureNeededForPlaybackIfCrossOriginExperimentEnabled()) { + m_autoplayUmaHelper->recordCrossOriginAutoplayResult( + CrossOriginAutoplayResult::AutoplayBlocked); + } else { + m_autoplayUmaHelper->recordCrossOriginAutoplayResult( + CrossOriginAutoplayResult::AutoplayAllowed); + } } } else { + m_autoplayUmaHelper->recordCrossOriginAutoplayResult( + CrossOriginAutoplayResult::PlayedWithGesture); UserGestureIndicator::utilizeUserGesture(); unlockUserGesture(); } @@ -3786,12 +3817,26 @@ void HTMLMediaElement::unlockUserGesture() { m_lockedPendingUserGesture = false; + m_lockedPendingUserGestureIfCrossOriginExperimentEnabled = false; } bool HTMLMediaElement::isGestureNeededForPlayback() const { if (!m_lockedPendingUserGesture) return false; + return isGestureNeededForPlaybackIfPendingUserGestureIsLocked(); +} + +bool HTMLMediaElement:: + isGestureNeededForPlaybackIfCrossOriginExperimentEnabled() const { + if (!m_lockedPendingUserGestureIfCrossOriginExperimentEnabled) + return false; + + return isGestureNeededForPlaybackIfPendingUserGestureIsLocked(); +} + +bool HTMLMediaElement::isGestureNeededForPlaybackIfPendingUserGestureIsLocked() + const { if (loadType() == WebMediaPlayer::LoadTypeMediaStream) return false;
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.h b/third_party/WebKit/Source/core/html/HTMLMediaElement.h index 540c9271..d4860f3 100644 --- a/third_party/WebKit/Source/core/html/HTMLMediaElement.h +++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.h
@@ -293,6 +293,9 @@ // specified origin. bool isMediaDataCORSSameOrigin(SecurityOrigin*) const; + // Returns this media element is in a cross-origin frame. + bool isInCrossOriginFrame() const; + void scheduleEvent(Event*); void scheduleTimeupdateEvent(bool periodicEvent); @@ -510,6 +513,8 @@ // should use, if checking to see if an action is allowed. bool isLockedPendingUserGesture() const; + bool isLockedPendingUserGestureIfCrossOriginExperimentEnabled() const; + // If the user gesture is required, then this will remove it. Note that // one should not generally call this method directly; use the one on // m_helper and give it a reason. @@ -521,6 +526,10 @@ // gesture is currently being processed. bool isGestureNeededForPlayback() const; + bool isGestureNeededForPlaybackIfCrossOriginExperimentEnabled() const; + + bool isGestureNeededForPlaybackIfPendingUserGestureIsLocked() const; + // Return true if and only if the settings allow autoplay of media on this // frame. bool isAutoplayAllowedPerSettings() const; @@ -626,6 +635,7 @@ // FIXME: HTMLMediaElement has way too many state bits. bool m_lockedPendingUserGesture : 1; + bool m_lockedPendingUserGestureIfCrossOriginExperimentEnabled : 1; bool m_playing : 1; bool m_shouldDelayLoadEvent : 1; bool m_haveFiredLoadedData : 1;
diff --git a/third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp b/third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp index 5c926be..3fcc3ca5 100644 --- a/third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp +++ b/third_party/WebKit/Source/core/layout/ImageQualityControllerTest.cpp
@@ -60,8 +60,11 @@ const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum, - ImageClampingMode) override {} - sk_sp<SkImage> imageForCurrentFrame() override { return nullptr; } + ImageClampingMode, + const ColorBehavior&) override {} + sk_sp<SkImage> imageForCurrentFrame(const ColorBehavior&) override { + return nullptr; + } }; TEST_F(ImageQualityControllerTest, ImageMaybeAnimated) { @@ -88,10 +91,13 @@ const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum, - ImageClampingMode) override {} + ImageClampingMode, + const ColorBehavior&) override {} bool isBitmapImage() const override { return true; } - sk_sp<SkImage> imageForCurrentFrame() override { return nullptr; } + sk_sp<SkImage> imageForCurrentFrame(const ColorBehavior&) override { + return nullptr; + } }; TEST_F(ImageQualityControllerTest, LowQualityFilterForContrast) { @@ -120,10 +126,13 @@ const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum, - ImageClampingMode) override {} + ImageClampingMode, + const ColorBehavior&) override {} bool isBitmapImage() const override { return true; } - sk_sp<SkImage> imageForCurrentFrame() override { return nullptr; } + sk_sp<SkImage> imageForCurrentFrame(const ColorBehavior&) override { + return nullptr; + } }; TEST_F(ImageQualityControllerTest, MediumQualityFilterForUnscaledImage) {
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp index c831a26..24332fe 100644 --- a/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp +++ b/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp
@@ -102,7 +102,8 @@ layer->updateAncestorOverflowLayer(info.lastOverflowClipLayer); if (info.lastOverflowClipLayer && layer->needsCompositingInputsUpdate() && layer->layoutObject()->style()->position() == StickyPosition) { - if (info.lastOverflowClipLayer != previousOverflowLayer) { + if (info.lastOverflowClipLayer != previousOverflowLayer && + !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { // Old ancestor scroller should no longer have these constraints. ASSERT(!previousOverflowLayer || !previousOverflowLayer->getScrollableArea()
diff --git a/third_party/WebKit/Source/core/layout/ng/layout_ng_block_flow.cc b/third_party/WebKit/Source/core/layout/ng/layout_ng_block_flow.cc index 1153b6b..6752c49 100644 --- a/third_party/WebKit/Source/core/layout/ng/layout_ng_block_flow.cc +++ b/third_party/WebKit/Source/core/layout/ng/layout_ng_block_flow.cc
@@ -18,8 +18,7 @@ void LayoutNGBlockFlow::layoutBlock(bool relayoutChildren) { LayoutAnalyzer::BlockScope analyzer(*this); - const auto* constraint_space = - NGConstraintSpace::CreateFromLayoutObject(*this); + auto* constraint_space = NGConstraintSpace::CreateFromLayoutObject(*this); // TODO(layout-dev): This should be created in the constructor once instead. // There is some internal state which needs to be cleared between layout
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc index 4369972..039ca524 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
@@ -270,10 +270,9 @@ current_child_->UpdateLayoutBox(toNGPhysicalFragment(child_fragment), space_for_current_child_); - FinishCurrentChildLayout( - new NGFragment(space_for_current_child_->WritingMode(), - current_child_->Style()->direction(), - toNGPhysicalFragment(child_fragment))); + FinishCurrentChildLayout(new NGFragment( + ConstraintSpace().WritingMode(), ConstraintSpace().Direction(), + toNGPhysicalFragment(child_fragment))); current_child_ = current_child_->NextSibling(); state_ = kStatePrepareForChildLayout; return kNotFinished; @@ -444,9 +443,13 @@ NGConstraintSpace* NGBlockLayoutAlgorithm::CreateConstraintSpaceForCurrentChild() const { DCHECK(current_child_); - space_builder_->SetIsNewFormattingContext( - IsNewFormattingContextForInFlowBlockLevelChild(ConstraintSpace(), - CurrentChildStyle())); + space_builder_ + ->SetIsNewFormattingContext( + IsNewFormattingContextForInFlowBlockLevelChild(ConstraintSpace(), + CurrentChildStyle())) + .SetWritingMode( + FromPlatformWritingMode(CurrentChildStyle().getWritingMode())) + .SetTextDirection(CurrentChildStyle().direction()); NGConstraintSpace* child_space = space_builder_->ToConstraintSpace(); // TODO(layout-ng): Set offset through the space builder.
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc index 195b4b0a..1edba9c 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc
@@ -25,6 +25,7 @@ .SetAvailableSize(size) .SetPercentageResolutionSize(size) .SetTextDirection(direction) + .SetWritingMode(writing_mode) .ToConstraintSpace(); } @@ -387,7 +388,7 @@ // </div> TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase5) { const int kVerticalDivMarginRight = 60; - const int kVerticalDivWidth = 60; + const int kVerticalDivWidth = 50; const int kHorizontalDivMarginLeft = 100; style_->setWidth(Length(500, Fixed));
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc index 38a1351a..b097278 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc
@@ -39,7 +39,7 @@ // included from a compilation unit that lacks the ComputedStyle definition. NGBlockNode::~NGBlockNode() {} -bool NGBlockNode::Layout(const NGConstraintSpace* constraint_space, +bool NGBlockNode::Layout(NGConstraintSpace* constraint_space, NGFragmentBase** out) { DCHECK(!minmax_algorithm_) << "Can't interleave Layout and ComputeMinAndMaxContentSizes"; @@ -66,8 +66,8 @@ DCHECK(layout_box_); fragment_ = RunOldLayout(*constraint_space); } - *out = new NGFragment(constraint_space->WritingMode(), Style()->direction(), - fragment_.get()); + *out = new NGFragment(FromPlatformWritingMode(Style()->getWritingMode()), + Style()->direction(), fragment_.get()); // Reset coordinator for future use layout_coordinator_ = nullptr; return true;
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_node.h b/third_party/WebKit/Source/core/layout/ng/ng_block_node.h index 49513cd..2597ff8 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_block_node.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_block_node.h
@@ -33,7 +33,7 @@ ~NGBlockNode() override; - bool Layout(const NGConstraintSpace*, NGFragmentBase**) override; + bool Layout(NGConstraintSpace*, NGFragmentBase**) override; NGBlockNode* NextSibling() override; // Computes the value of min-content and max-content for this box.
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_inline_node.cc b/third_party/WebKit/Source/core/layout/ng/ng_inline_node.cc index c4b588e..6a6361c40 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_inline_node.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_inline_node.cc
@@ -198,7 +198,7 @@ } } -bool NGInlineNode::Layout(const NGConstraintSpace* constraint_space, +bool NGInlineNode::Layout(NGConstraintSpace* constraint_space, NGFragmentBase** out) { // TODO(layout-dev): Perform pre-layout text step.
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_inline_node.h b/third_party/WebKit/Source/core/layout/ng/ng_inline_node.h index 8c653fb..b16526d0 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_inline_node.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_inline_node.h
@@ -31,7 +31,7 @@ NGInlineNode(LayoutObject* start_inline, ComputedStyle* block_style); ~NGInlineNode() override; - bool Layout(const NGConstraintSpace*, NGFragmentBase**) override; + bool Layout(NGConstraintSpace*, NGFragmentBase**) override; NGInlineNode* NextSibling() override; // Prepare inline and text content for layout. Must be called before
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_layout_coordinator.cc b/third_party/WebKit/Source/core/layout/ng/ng_layout_coordinator.cc index 3876200..9528a97d35 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_layout_coordinator.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_layout_coordinator.cc
@@ -9,9 +9,8 @@ namespace blink { -NGLayoutCoordinator::NGLayoutCoordinator( - NGLayoutInputNode* input_node, - const NGConstraintSpace* constraint_space) { +NGLayoutCoordinator::NGLayoutCoordinator(NGLayoutInputNode* input_node, + NGConstraintSpace* constraint_space) { layout_algorithms_.append( NGLayoutInputNode::AlgorithmForInputNode(input_node, constraint_space)); }
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_layout_coordinator.h b/third_party/WebKit/Source/core/layout/ng/ng_layout_coordinator.h index 6926e1d..bf2615da 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_layout_coordinator.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_layout_coordinator.h
@@ -18,7 +18,7 @@ class CORE_EXPORT NGLayoutCoordinator final : public GarbageCollectedFinalized<NGLayoutCoordinator> { public: - NGLayoutCoordinator(NGLayoutInputNode*, const NGConstraintSpace*); + NGLayoutCoordinator(NGLayoutInputNode*, NGConstraintSpace*); bool Tick(NGPhysicalFragmentBase**);
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.cc b/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.cc index 6a0798d..daa83de 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.cc +++ b/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.cc
@@ -17,7 +17,7 @@ NGLayoutAlgorithm* NGLayoutInputNode::AlgorithmForInputNode( NGLayoutInputNode* input_node, - const NGConstraintSpace* constraint_space) { + NGConstraintSpace* constraint_space) { // At least for now, this should never be called on LegacyInline // children. However, there will be other kinds of input_node so // it makes sense to do this here. @@ -26,12 +26,11 @@ if (block->CanUseNewLayout()) { if (block->HasInlineChildren()) - return new NGInlineLayoutAlgorithm( - block->Style(), toNGInlineNode(block->FirstChild()), - constraint_space->ChildSpace(block->Style())); + return new NGInlineLayoutAlgorithm(block->Style(), + toNGInlineNode(block->FirstChild()), + constraint_space); return new NGBlockLayoutAlgorithm( - block->Style(), toNGBlockNode(block->FirstChild()), - constraint_space->ChildSpace(block->Style())); + block->Style(), toNGBlockNode(block->FirstChild()), constraint_space); } return new NGLegacyBlockLayoutAlgorithm(block, constraint_space);
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.h b/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.h index 45fa2bc3..7bb5742 100644 --- a/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.h +++ b/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.h
@@ -27,7 +27,7 @@ // Returns true when done; when this function returns false, it has to be // called again. The out parameter will only be set when this function // returns true. The same constraint space has to be passed each time. - virtual bool Layout(const NGConstraintSpace*, NGFragmentBase**) = 0; + virtual bool Layout(NGConstraintSpace*, NGFragmentBase**) = 0; // Returns the next sibling. virtual NGLayoutInputNode* NextSibling() = 0; @@ -37,7 +37,7 @@ } static NGLayoutAlgorithm* AlgorithmForInputNode(NGLayoutInputNode*, - const NGConstraintSpace*); + NGConstraintSpace*); DEFINE_INLINE_VIRTUAL_TRACE() {}
diff --git a/third_party/WebKit/Source/core/layout/shapes/Shape.cpp b/third_party/WebKit/Source/core/layout/shapes/Shape.cpp index 34a98d8..364fe581 100644 --- a/third_party/WebKit/Source/core/layout/shapes/Shape.cpp +++ b/third_party/WebKit/Source/core/layout/shapes/Shape.cpp
@@ -243,9 +243,11 @@ SkPaint paint; IntRect imageSourceRect(IntPoint(), image->size()); IntRect imageDestRect(IntPoint(), imageRect.size()); + // TODO(ccameron): No color conversion is required here. image->draw(imageBuffer->canvas(), paint, imageDestRect, imageSourceRect, DoNotRespectImageOrientation, - Image::DoNotClampImageToSourceRect); + Image::DoNotClampImageToSourceRect, + ColorBehavior::transformToGlobalTarget()); WTF::ArrayBufferContents contents; imageBuffer->getImageData(Unmultiplied,
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp index 565ccb1..98742cb 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
@@ -1036,11 +1036,16 @@ void PaintLayer::setNeedsCompositingInputsUpdate() { setNeedsCompositingInputsUpdateInternal(); - // TODO(chrishtr): This is a bit of a heavy hammer, because not all + // TODO(chrishtr): These are a bit of a heavy hammer, because not all // things which require compositing inputs update require a descendant- // dependent flags udpate. Reduce call sites after SPv2 launch allows /// removal of CompositingInputsUpdater. markAncestorChainForDescendantDependentFlagsUpdate(); + if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { + // This update is needed in order to re-compute sticky position constraints, + // not for any other reason. + layoutObject()->setNeedsPaintPropertyUpdate(); + } } void PaintLayer::setNeedsCompositingInputsUpdateInternal() {
diff --git a/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp b/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp index f122464..42f00c521 100644 --- a/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp +++ b/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.cpp
@@ -10,18 +10,27 @@ #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h" #include "core/layout/LayoutPart.h" #include "core/layout/LayoutView.h" +#include "core/paint/PaintLayer.h" namespace blink { struct PrePaintTreeWalkContext { - PrePaintTreeWalkContext() : paintInvalidatorContext(treeBuilderContext) {} + PrePaintTreeWalkContext() + : paintInvalidatorContext(treeBuilderContext), + ancestorOverflowPaintLayer(nullptr) {} PrePaintTreeWalkContext(const PrePaintTreeWalkContext& parentContext) : treeBuilderContext(parentContext.treeBuilderContext), paintInvalidatorContext(treeBuilderContext, - parentContext.paintInvalidatorContext) {} + parentContext.paintInvalidatorContext), + ancestorOverflowPaintLayer(parentContext.ancestorOverflowPaintLayer) {} PaintPropertyTreeBuilderContext treeBuilderContext; PaintInvalidatorContext paintInvalidatorContext; + + // The ancestor in the PaintLayer tree which has overflow clip, or + // is the root layer. Note that it is tree ancestor, not containing + // block or stacking ancestor. + PaintLayer* ancestorOverflowPaintLayer; }; void PrePaintTreeWalk::walk(FrameView& rootFrame) { @@ -62,6 +71,36 @@ return descendantsFullyUpdated; } +static void updateAuxiliaryObjectProperties( + const LayoutObject& object, + PrePaintTreeWalkContext& localContext) { + PaintLayer* paintLayer = nullptr; + + if (object.isBoxModelObject() && object.hasLayer()) + paintLayer = object.enclosingLayer(); + + if (paintLayer) { + paintLayer->updateAncestorOverflowLayer( + localContext.ancestorOverflowPaintLayer); + } + + if (object.styleRef().position() == StickyPosition && paintLayer) { + paintLayer->layoutObject()->updateStickyPositionConstraints(); + + // Sticky position constraints and ancestor overflow scroller affect + // the sticky layer position, so we need to update it again here. + // TODO(flackr): This should be refactored in the future to be clearer + // (i.e. update layer position and ancestor inputs updates in the + // same walk) + paintLayer->updateLayerPosition(); + } + + if (object.hasOverflowClip() || (paintLayer && paintLayer->isRootLayer())) { + DCHECK(paintLayer); + localContext.ancestorOverflowPaintLayer = paintLayer; + } +} + bool PrePaintTreeWalk::walk(const LayoutObject& object, const PrePaintTreeWalkContext& context) { PrePaintTreeWalkContext localContext(context); @@ -87,6 +126,10 @@ return descendantsFullyUpdated; } + // This must happen before updateContextForBoxPosition, because the + // latter reads some of the state computed uere. + updateAuxiliaryObjectProperties(object, localContext); + // Ensure the current context takes into account the box position. This can // change the current context's paint offset so it must proceed the paint // offset property update check.
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp index 676a7ed..768f101 100644 --- a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp +++ b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
@@ -262,7 +262,10 @@ ClampImageToSourceRect, url); } -sk_sp<SkImage> SVGImage::imageForCurrentFrame() { +sk_sp<SkImage> SVGImage::imageForCurrentFrame( + const ColorBehavior& colorBehavior) { + // TODO(ccameron): This function should not ignore |colorBehavior|. + // https://crbug.com/667431 return imageForCurrentFrameForContainer(KURL(), size()); } @@ -342,7 +345,10 @@ const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum shouldRespectImageOrientation, - ImageClampingMode clampMode) { + ImageClampingMode clampMode, + const ColorBehavior& colorBehavior) { + // TODO(ccameron): This function should not ignore |colorBehavior|. + // https://crbug.com/667431 if (!m_page) return;
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImage.h b/third_party/WebKit/Source/core/svg/graphics/SVGImage.h index 77657e2..3abec1c5 100644 --- a/third_party/WebKit/Source/core/svg/graphics/SVGImage.h +++ b/third_party/WebKit/Source/core/svg/graphics/SVGImage.h
@@ -78,7 +78,7 @@ void advanceAnimationForTesting() override; SVGImageChromeClient& chromeClientForTesting(); - sk_sp<SkImage> imageForCurrentFrame() override; + sk_sp<SkImage> imageForCurrentFrame(const ColorBehavior&) override; // Does the SVG image/document contain any animations? bool hasAnimations() const; @@ -125,7 +125,8 @@ const FloatRect& fromRect, const FloatRect& toRect, RespectImageOrientationEnum, - ImageClampingMode) override; + ImageClampingMode, + const ColorBehavior&) override; void drawForContainer(SkCanvas*, const SkPaint&, const FloatSize,
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImageForContainer.cpp b/third_party/WebKit/Source/core/svg/graphics/SVGImageForContainer.cpp index 9751be6..0bd7db6 100644 --- a/third_party/WebKit/Source/core/svg/graphics/SVGImageForContainer.cpp +++ b/third_party/WebKit/Source/core/svg/graphics/SVGImageForContainer.cpp
@@ -42,7 +42,10 @@ const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum, - ImageClampingMode) { + ImageClampingMode, + const ColorBehavior& colorBehavior) { + // TODO(ccameron): This function should not ignore |colorBehavior|. + // https://crbug.com/667431 m_image->drawForContainer(canvas, paint, m_containerSize, m_zoom, dstRect, srcRect, m_url); } @@ -54,12 +57,17 @@ SkBlendMode op, const FloatRect& dstRect, const FloatSize& repeatSpacing) { + // TODO(ccameron): This function should not ignore |context|'s color behavior. + // https://crbug.com/667431 m_image->drawPatternForContainer(context, m_containerSize, m_zoom, srcRect, scale, phase, op, dstRect, repeatSpacing, m_url); } -sk_sp<SkImage> SVGImageForContainer::imageForCurrentFrame() { +sk_sp<SkImage> SVGImageForContainer::imageForCurrentFrame( + const ColorBehavior& colorBehavior) { + // TODO(ccameron): This function should not ignore |colorBehavior|. + // https://crbug.com/667431 return m_image->imageForCurrentFrameForContainer(m_url, size()); }
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImageForContainer.h b/third_party/WebKit/Source/core/svg/graphics/SVGImageForContainer.h index 6800d4c..61d4e729 100644 --- a/third_party/WebKit/Source/core/svg/graphics/SVGImageForContainer.h +++ b/third_party/WebKit/Source/core/svg/graphics/SVGImageForContainer.h
@@ -81,7 +81,8 @@ const FloatRect&, const FloatRect&, RespectImageOrientationEnum, - ImageClampingMode) override; + ImageClampingMode, + const ColorBehavior&) override; void drawPattern(GraphicsContext&, const FloatRect&, @@ -96,7 +97,7 @@ return false; } - sk_sp<SkImage> imageForCurrentFrame() override; + sk_sp<SkImage> imageForCurrentFrame(const ColorBehavior&) override; private: SVGImageForContainer(SVGImage* image,
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImageTest.cpp b/third_party/WebKit/Source/core/svg/graphics/SVGImageTest.cpp index b91c39d0..123c7e29 100644 --- a/third_party/WebKit/Source/core/svg/graphics/SVGImageTest.cpp +++ b/third_party/WebKit/Source/core/svg/graphics/SVGImageTest.cpp
@@ -32,7 +32,8 @@ FloatRect dummyRect(0, 0, 100, 100); image->draw(nullCanvas.get(), paint, dummyRect, dummyRect, DoNotRespectImageOrientation, - Image::DoNotClampImageToSourceRect); + Image::DoNotClampImageToSourceRect, + ColorBehavior::transformToGlobalTarget()); } private:
diff --git a/third_party/WebKit/Source/core/svg/graphics/filters/SVGFEImage.cpp b/third_party/WebKit/Source/core/svg/graphics/filters/SVGFEImage.cpp index 3752a99c..0f9629f 100644 --- a/third_party/WebKit/Source/core/svg/graphics/filters/SVGFEImage.cpp +++ b/third_party/WebKit/Source/core/svg/graphics/filters/SVGFEImage.cpp
@@ -192,7 +192,12 @@ if (auto* layoutObject = referencedLayoutObject()) return createImageFilterForLayoutObject(*layoutObject); - sk_sp<SkImage> image = m_image ? m_image->imageForCurrentFrame() : nullptr; + // TODO(ccameron): Determine the correct color behavior for this function. + // https://crbug.com/667431 + sk_sp<SkImage> image = m_image + ? m_image->imageForCurrentFrame( + ColorBehavior::transformToGlobalTarget()) + : nullptr; if (!image) { // "A href reference that is an empty image (zero width or zero height), // that fails to download, is non-existent, or that cannot be displayed
diff --git a/third_party/WebKit/Source/devtools/.eslintrc.js b/third_party/WebKit/Source/devtools/.eslintrc.js index 7eafe914..1e9bf34 100644 --- a/third_party/WebKit/Source/devtools/.eslintrc.js +++ b/third_party/WebKit/Source/devtools/.eslintrc.js
@@ -55,6 +55,7 @@ "no-shadow-restricted-names": 2, "no-cond-assign": 2, "no-debugger": 2, + "no-console": [2, { "allow": ["warn", "error", "assert", "timeStamp", "time", "timeEnd"] }], "no-dupe-keys": 2, "no-duplicate-case": 2, "no-empty-character-class": 2, @@ -94,7 +95,6 @@ "no-trailing-spaces": 2, "linebreak-style": [ 2, "unix" ], - /** * Disabled, aspirational rules */
diff --git a/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilityModel.js b/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilityModel.js index a0951b2..e9df1ec1 100644 --- a/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilityModel.js +++ b/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilityModel.js
@@ -302,7 +302,7 @@ var rootNode = inspectedNode; while (rootNode.parentNode()) rootNode = rootNode.parentNode(); - console.log(rootNode.printSelfAndChildren(inspectedNode)); + console.log(rootNode.printSelfAndChildren(inspectedNode)); // eslint-disable-line no-console } };
diff --git a/third_party/WebKit/Source/devtools/front_end/extensions/ExtensionServer.js b/third_party/WebKit/Source/devtools/front_end/extensions/ExtensionServer.js index 4d930b63..1410c0ba 100644 --- a/third_party/WebKit/Source/devtools/front_end/extensions/ExtensionServer.js +++ b/third_party/WebKit/Source/devtools/front_end/extensions/ExtensionServer.js
@@ -1014,7 +1014,7 @@ var status = {code: code, description: description, details: details}; if (code !== 'OK') { status.isError = true; - console.log('Extension server error: ' + String.vsprintf(description, details)); + console.error('Extension server error: ' + String.vsprintf(description, details)); } return status; }
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/CookieParser.js b/third_party/WebKit/Source/devtools/front_end/sdk/CookieParser.js index aa63d0b..9554d69 100644 --- a/third_party/WebKit/Source/devtools/front_end/sdk/CookieParser.js +++ b/third_party/WebKit/Source/devtools/front_end/sdk/CookieParser.js
@@ -141,7 +141,7 @@ // cookie values, though. var keyValueMatch = /^[ \t]*([^\s=;]+)[ \t]*(?:=[ \t]*([^;\n]*))?/.exec(this._input); if (!keyValueMatch) { - console.log('Failed parsing cookie header before: ' + this._input); + console.error('Failed parsing cookie header before: ' + this._input); return null; }
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/InspectorBackend.js b/third_party/WebKit/Source/devtools/front_end/sdk/InspectorBackend.js index 1e5b329..3b03735e 100644 --- a/third_party/WebKit/Source/devtools/front_end/sdk/InspectorBackend.js +++ b/third_party/WebKit/Source/devtools/front_end/sdk/InspectorBackend.js
@@ -337,19 +337,16 @@ return; } - var processingStartTime; + var timingLabel = 'time-stats: ' + callback.methodName; if (InspectorBackendClass.Options.dumpInspectorTimeStats) - processingStartTime = Date.now(); + console.time(timingLabel); this._agent(callback.domain).dispatchResponse(messageObject, callback.methodName, callback); --this._pendingResponsesCount; delete this._callbacks[messageObject.id]; - if (InspectorBackendClass.Options.dumpInspectorTimeStats) { - console.log( - 'time-stats: ' + callback.methodName + ' = ' + (processingStartTime - callback.sendRequestTime) + ' + ' + - (Date.now() - processingStartTime)); - } + if (InspectorBackendClass.Options.dumpInspectorTimeStats) + console.timeEnd(timingLabel); if (this._scripts && !this._pendingResponsesCount) this._deprecatedRunAfterPendingDispatches(); @@ -416,7 +413,7 @@ * @param {string} message */ _dumpProtocolMessage(message) { - console.log(message); + console.log(message); // eslint-disable-line no-console } /** @@ -713,14 +710,14 @@ params.push(messageObject.params[paramNames[i]]); } - var processingStartTime; + var timingLabel = 'time-stats: ' + messageObject.method; if (InspectorBackendClass.Options.dumpInspectorTimeStats) - processingStartTime = Date.now(); + console.time(timingLabel); this._dispatcher[functionName].apply(this._dispatcher, params); if (InspectorBackendClass.Options.dumpInspectorTimeStats) - console.log('time-stats: ' + messageObject.method + ' = ' + (Date.now() - processingStartTime)); + console.timeEnd(timingLabel); } };
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/ResourceTreeModel.js b/third_party/WebKit/Source/devtools/front_end/sdk/ResourceTreeModel.js index 606fd98..a6fea2b 100644 --- a/third_party/WebKit/Source/devtools/front_end/sdk/ResourceTreeModel.js +++ b/third_party/WebKit/Source/devtools/front_end/sdk/ResourceTreeModel.js
@@ -204,8 +204,6 @@ this.dispatchEventToListeners(SDK.ResourceTreeModel.Events.MainFrameNavigated, frame); if (Common.moduleSetting('preserveConsoleLog').get()) Common.console.log(Common.UIString('Navigated to %s', frame.url)); - else - this.target().consoleModel.clear(); } if (addedOrigin) this._securityOriginManager.addSecurityOrigin(addedOrigin); @@ -239,6 +237,21 @@ } /** + * @param {!Protocol.Page.FrameId} frameId + */ + _frameStartedLoading(frameId) { + // Do nothing unless cached resource tree is processed - it will overwrite everything. + if (!this._cachedResourcesProcessed) + return; + + var frame = this._frames.get(frameId); + if (frame && !frame.isMainFrame()) + return; + if (!Common.moduleSetting('preserveConsoleLog').get()) + this.target().consoleModel.clear(); + } + + /** * @param {!Common.Event} event */ _onRequestFinished(event) { @@ -788,6 +801,7 @@ * @param {!Protocol.Page.FrameId} frameId */ frameStartedLoading(frameId) { + this._resourceTreeModel._frameStartedLoading(frameId); } /**
diff --git a/third_party/WebKit/Source/devtools/front_end/test_runner/TestRunner.js b/third_party/WebKit/Source/devtools/front_end/test_runner/TestRunner.js index e45f29df..a69ae52 100644 --- a/third_party/WebKit/Source/devtools/front_end/test_runner/TestRunner.js +++ b/third_party/WebKit/Source/devtools/front_end/test_runner/TestRunner.js
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +/* eslint-disable no-console */ + /** @type {!{notifyDone: function()}|undefined} */ self.testRunner;
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline_model/TimelineProfileTree.js b/third_party/WebKit/Source/devtools/front_end/timeline_model/TimelineProfileTree.js index 6595c34..3f15899c 100644 --- a/third_party/WebKit/Source/devtools/front_end/timeline_model/TimelineProfileTree.js +++ b/third_party/WebKit/Source/devtools/front_end/timeline_model/TimelineProfileTree.js
@@ -81,7 +81,7 @@ } parent.selfTime -= time; if (parent.selfTime < 0) { - console.log('Error: Negative self of ' + parent.selfTime, e); + console.error('Error: Negative self of ' + parent.selfTime, e); parent.selfTime = 0; } if (e.endTime)
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Widget.js b/third_party/WebKit/Source/devtools/front_end/ui/Widget.js index 9ffce99..b355d80f 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/Widget.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/Widget.js
@@ -76,10 +76,8 @@ } static __assert(condition, message) { - if (!condition) { - console.trace(); + if (!condition) throw new Error(message); - } } /** @@ -438,7 +436,7 @@ printWidgetHierarchy() { var lines = []; this._collectWidgetHierarchy('', lines); - console.log(lines.join('\n')); + console.log(lines.join('\n')); // eslint-disable-line no-console } _collectWidgetHierarchy(prefix, lines) {
diff --git a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp index ef53fd5..63308e4c8 100644 --- a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp +++ b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp
@@ -888,7 +888,9 @@ if (!imageBitmap) return String(); - sk_sp<SkImage> image = imageBitmap->bitmapImage()->imageForCurrentFrame(); + // TODO(ccameron): AXLayoutObject::imageDataUrl should create sRGB images. + sk_sp<SkImage> image = imageBitmap->bitmapImage()->imageForCurrentFrame( + ColorBehavior::transformToGlobalTarget()); if (!image || image->width() <= 0 || image->height() <= 0) return String();
diff --git a/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp index d3fb0e2..ddafd62 100644 --- a/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp +++ b/third_party/WebKit/Source/modules/canvas2d/BaseRenderingContext2D.cpp
@@ -1078,8 +1078,11 @@ if (!imageSource->isVideoElement()) { imagePaint.setAntiAlias(shouldDrawImageAntialiased(dstRect)); + // TODO(ccameron): Canvas should draw in sRGB by default. + // https://crbug.com/672299 image->draw(c, imagePaint, dstRect, srcRect, DoNotRespectImageOrientation, - Image::DoNotClampImageToSourceRect); + Image::DoNotClampImageToSourceRect, + ColorBehavior::transformToGlobalTarget()); } else { c->save(); c->clipRect(dstRect);
diff --git a/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapRenderingContext.cpp b/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapRenderingContext.cpp index 266a97d..e3a7c549 100644 --- a/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapRenderingContext.cpp +++ b/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapRenderingContext.cpp
@@ -44,7 +44,11 @@ if (!m_image) return; - sk_sp<SkImage> skImage = m_image->imageForCurrentFrame(); + // TODO(ccameron): Determine the correct color behavior here. + // ImageBitmapRenderingContext. + // https://crbug.com/672306 + sk_sp<SkImage> skImage = + m_image->imageForCurrentFrame(ColorBehavior::transformToGlobalTarget()); if (skImage->isTextureBacked()) { // TODO(junov): crbug.com/585607 Eliminate this readback and use an // ExternalTextureLayer @@ -68,7 +72,9 @@ return true; // With impl-side painting, it is unsafe to use a gpu-backed SkImage - ASSERT(!m_image->imageForCurrentFrame()->isTextureBacked()); + DCHECK( + !m_image->imageForCurrentFrame(ColorBehavior::transformToGlobalTarget()) + ->isTextureBacked()); gc.drawImage(m_image.get(), r, nullptr, creationAttributes().alpha() ? SkBlendMode::kSrcOver : SkBlendMode::kSrc);
diff --git a/third_party/WebKit/Source/modules/shapedetection/ShapeDetector.cpp b/third_party/WebKit/Source/modules/shapedetection/ShapeDetector.cpp index 4da8d7c0..52c1d831 100644 --- a/third_party/WebKit/Source/modules/shapedetection/ShapeDetector.cpp +++ b/third_party/WebKit/Source/modules/shapedetection/ShapeDetector.cpp
@@ -109,7 +109,9 @@ uint8_t* pixelDataPtr = nullptr; WTF::CheckedNumeric<int> allocationSize = 0; - sk_sp<SkImage> skImage = image->imageForCurrentFrame(); + // TODO(ccameron): ShapeDetector can ignore color conversion. + sk_sp<SkImage> skImage = + image->imageForCurrentFrame(ColorBehavior::transformToGlobalTarget()); // Use |skImage|'s pixels if it has direct access to them. if (skImage->peekPixels(&pixmap)) { pixelDataPtr = static_cast<uint8_t*>(pixmap.writable_addr()); @@ -163,7 +165,9 @@ return promise; } - const sk_sp<SkImage> image = blinkImage->imageForCurrentFrame(); + // TODO(ccameron): ShapeDetector can ignore color conversion. + const sk_sp<SkImage> image = blinkImage->imageForCurrentFrame( + ColorBehavior::transformToGlobalTarget()); DCHECK_EQ(img->naturalWidth(), static_cast<unsigned>(image->width())); DCHECK_EQ(img->naturalHeight(), static_cast<unsigned>(image->height()));
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp index e9ed5ab..ce833cad 100644 --- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp +++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -773,10 +773,13 @@ // TODO: Furnish toImageData in webgl renderingcontext for jpeg and webp // images. See crbug.com/657531. ImageData* imageData = nullptr; + // TODO(ccameron): WebGL should produce sRGB images. + // https://crbug.com/672299 if (this->drawingBuffer()) { - sk_sp<SkImage> snapshot = this->drawingBuffer() - ->transferToStaticBitmapImage() - ->imageForCurrentFrame(); + sk_sp<SkImage> snapshot = + this->drawingBuffer() + ->transferToStaticBitmapImage() + ->imageForCurrentFrame(ColorBehavior::transformToGlobalTarget()); if (snapshot) { imageData = ImageData::create(this->getOffscreenCanvas()->size()); SkImageInfo imageInfo = SkImageInfo::Make( @@ -4527,8 +4530,11 @@ IntRect srcRect(IntPoint(), image->size()); IntRect destRect(0, 0, size.width(), size.height()); SkPaint paint; + // TODO(ccameron): WebGL should produce sRGB images. + // https://crbug.com/672299 image->draw(buf->canvas(), paint, destRect, srcRect, - DoNotRespectImageOrientation, Image::DoNotClampImageToSourceRect); + DoNotRespectImageOrientation, Image::DoNotClampImageToSourceRect, + ColorBehavior::transformToGlobalTarget()); return buf->newImageSnapshot(PreferNoAcceleration, SnapshotReasonWebGLDrawImageIntoBuffer); } @@ -5292,7 +5298,10 @@ } return; } - sk_sp<SkImage> skImage = bitmap->bitmapImage()->imageForCurrentFrame(); + // TODO(ccameron): WebGL should produce sRGB images. + // https://crbug.com/672299 + sk_sp<SkImage> skImage = bitmap->bitmapImage()->imageForCurrentFrame( + ColorBehavior::transformToGlobalTarget()); SkPixmap pixmap; uint8_t* pixelDataPtr = nullptr; RefPtr<Uint8Array> pixelData;
diff --git a/third_party/WebKit/Source/platform/DragImage.cpp b/third_party/WebKit/Source/platform/DragImage.cpp index c4cbd565..76047fa1 100644 --- a/third_party/WebKit/Source/platform/DragImage.cpp +++ b/third_party/WebKit/Source/platform/DragImage.cpp
@@ -150,7 +150,10 @@ if (!image) return nullptr; - sk_sp<SkImage> skImage = image->imageForCurrentFrame(); + // TODO(ccameron): DragImage needs to be color space aware. + // https://crbug.com/672316 + sk_sp<SkImage> skImage = + image->imageForCurrentFrame(ColorBehavior::transformToGlobalTarget()); if (!skImage) return nullptr;
diff --git a/third_party/WebKit/Source/platform/DragImageTest.cpp b/third_party/WebKit/Source/platform/DragImageTest.cpp index 8dc491a4..3b88abeb 100644 --- a/third_party/WebKit/Source/platform/DragImageTest.cpp +++ b/third_party/WebKit/Source/platform/DragImageTest.cpp
@@ -65,7 +65,9 @@ return IntSize(m_image->width(), m_image->height()); } - sk_sp<SkImage> imageForCurrentFrame() override { return m_image; } + sk_sp<SkImage> imageForCurrentFrame(const ColorBehavior&) override { + return m_image; + } bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) override { return false; @@ -80,7 +82,8 @@ const FloatRect&, const FloatRect&, RespectImageOrientationEnum, - ImageClampingMode) override { + ImageClampingMode, + const ColorBehavior&) override { // Image pure virtual stub. }
diff --git a/third_party/WebKit/Source/platform/exported/WebImage.cpp b/third_party/WebKit/Source/platform/exported/WebImage.cpp index 86c6835..bf86aad 100644 --- a/third_party/WebKit/Source/platform/exported/WebImage.cpp +++ b/third_party/WebKit/Source/platform/exported/WebImage.cpp
@@ -132,7 +132,10 @@ if (!image) return; - if (sk_sp<SkImage> skImage = image->imageForCurrentFrame()) + // TODO(ccameron): WebImage needs to be consistent about color spaces. + // https://crbug.com/672315 + if (sk_sp<SkImage> skImage = + image->imageForCurrentFrame(ColorBehavior::transformToGlobalTarget())) skImage->asLegacyBitmap(&m_bitmap, SkImage::kRO_LegacyBitmapMode); }
diff --git a/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.cpp index ea19b66..cd6c85f 100644 --- a/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.cpp +++ b/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.cpp
@@ -89,7 +89,10 @@ destGL->DeleteTextures(1, &sourceTextureId); } -sk_sp<SkImage> AcceleratedStaticBitmapImage::imageForCurrentFrame() { +sk_sp<SkImage> AcceleratedStaticBitmapImage::imageForCurrentFrame( + const ColorBehavior& colorBehavior) { + // TODO(ccameron): This function should not ignore |colorBehavior|. + // https://crbug.com/672306 checkThread(); if (!isValid()) return nullptr; @@ -102,7 +105,10 @@ const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum, - ImageClampingMode imageClampingMode) { + ImageClampingMode imageClampingMode, + const ColorBehavior& colorBehavior) { + // TODO(ccameron): This function should not ignore |colorBehavior|. + // https://crbug.com/672306 checkThread(); if (!isValid()) return;
diff --git a/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.h b/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.h index 873f98d7..ae160a16 100644 --- a/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.h +++ b/third_party/WebKit/Source/platform/graphics/AcceleratedStaticBitmapImage.h
@@ -38,7 +38,7 @@ bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) override; IntSize size() const override; - sk_sp<SkImage> imageForCurrentFrame() override; + sk_sp<SkImage> imageForCurrentFrame(const ColorBehavior&) override; bool isTextureBacked() final { return true; } void draw(SkCanvas*, @@ -46,7 +46,8 @@ const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum, - ImageClampingMode) override; + ImageClampingMode, + const ColorBehavior&) override; void copyToTexture(WebGraphicsContext3DProvider*, GLuint destTextureId,
diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp index d10753d..d5570f31 100644 --- a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp +++ b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp
@@ -264,10 +264,11 @@ const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum shouldRespectImageOrientation, - ImageClampingMode clampMode) { + ImageClampingMode clampMode, + const ColorBehavior& colorBehavior) { TRACE_EVENT0("skia", "BitmapImage::draw"); - sk_sp<SkImage> image = imageForCurrentFrame(); + sk_sp<SkImage> image = imageForCurrentFrame(colorBehavior); if (!image) return; // It's too early and we don't have an image yet. @@ -370,11 +371,8 @@ return m_source.frameDurationAtIndex(index); } -sk_sp<SkImage> BitmapImage::imageForCurrentFrame() { - // TODO(ccameron): Allow the caller of imageForCurrentFrame to specify the - // the desired ColorBehavior. - // https://crbug.com/667420 - const ColorBehavior& colorBehavior = m_cachedFrameColorBehavior; +sk_sp<SkImage> BitmapImage::imageForCurrentFrame( + const ColorBehavior& colorBehavior) { return frameAtIndex(currentFrame(), colorBehavior); }
diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImage.h b/third_party/WebKit/Source/platform/graphics/BitmapImage.h index bde1926..2521889f 100644 --- a/third_party/WebKit/Source/platform/graphics/BitmapImage.h +++ b/third_party/WebKit/Source/platform/graphics/BitmapImage.h
@@ -82,7 +82,7 @@ ImageAnimationPolicy animationPolicy() override { return m_animationPolicy; } void advanceTime(double deltaTimeInSeconds) override; - sk_sp<SkImage> imageForCurrentFrame() override; + sk_sp<SkImage> imageForCurrentFrame(const ColorBehavior&) override; PassRefPtr<Image> imageForDefaultFrame() override; bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) override; @@ -115,7 +115,8 @@ const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum, - ImageClampingMode) override; + ImageClampingMode, + const ColorBehavior&) override; size_t currentFrame() const { return m_currentFrame; } size_t frameCount();
diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp b/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp index 9bcb80f7..05a8b87 100644 --- a/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/BitmapImageTest.cpp
@@ -251,7 +251,7 @@ m_image->dataChanged(true); EXPECT_EQ(0, lastDecodedSizeChange()); // Recaching the first frame also shouldn't affect decoded size. - m_image->imageForCurrentFrame(); + m_image->imageForCurrentFrame(ColorBehavior::transformToTargetForTesting()); EXPECT_EQ(0, lastDecodedSizeChange()); }
diff --git a/third_party/WebKit/Source/platform/graphics/CrossfadeGeneratedImage.cpp b/third_party/WebKit/Source/platform/graphics/CrossfadeGeneratedImage.cpp index 453ce6a4..157544d 100644 --- a/third_party/WebKit/Source/platform/graphics/CrossfadeGeneratedImage.cpp +++ b/third_party/WebKit/Source/platform/graphics/CrossfadeGeneratedImage.cpp
@@ -41,9 +41,11 @@ m_percentage(percentage), m_crossfadeSize(crossfadeSize) {} -void CrossfadeGeneratedImage::drawCrossfade(SkCanvas* canvas, - const SkPaint& paint, - ImageClampingMode clampMode) { +void CrossfadeGeneratedImage::drawCrossfade( + SkCanvas* canvas, + const SkPaint& paint, + ImageClampingMode clampMode, + const ColorBehavior& colorBehavior) { FloatRect fromImageRect(FloatPoint(), FloatSize(m_fromImage->size())); FloatRect toImageRect(FloatPoint(), FloatSize(m_toImage->size())); FloatRect destRect((FloatPoint()), FloatSize(m_crossfadeSize)); @@ -67,12 +69,12 @@ // written this way during refactoring to avoid modifying existing behavior, // but this warrants further investigation. crbug.com/472634 m_fromImage->draw(canvas, imagePaint, destRect, fromImageRect, - DoNotRespectImageOrientation, clampMode); + DoNotRespectImageOrientation, clampMode, colorBehavior); imagePaint.setBlendMode(SkBlendMode::kPlus); imageAlpha = clampedAlphaForBlending(m_percentage); imagePaint.setAlpha(imageAlpha > 255 ? 255 : imageAlpha); m_toImage->draw(canvas, imagePaint, destRect, toImageRect, - DoNotRespectImageOrientation, clampMode); + DoNotRespectImageOrientation, clampMode, colorBehavior); } void CrossfadeGeneratedImage::draw(SkCanvas* canvas, @@ -80,7 +82,8 @@ const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum, - ImageClampingMode clampMode) { + ImageClampingMode clampMode, + const ColorBehavior& colorBehavior) { // Draw nothing if either of the images hasn't loaded yet. if (m_fromImage == Image::nullImage() || m_toImage == Image::nullImage()) return; @@ -93,7 +96,7 @@ dstRect.height() / srcRect.height()); canvas->translate(-srcRect.x(), -srcRect.y()); - drawCrossfade(canvas, paint, clampMode); + drawCrossfade(canvas, paint, clampMode, colorBehavior); } void CrossfadeGeneratedImage::drawTile(GraphicsContext& context, @@ -107,7 +110,8 @@ paint.setAntiAlias(context.shouldAntialias()); FloatRect destRect((FloatPoint()), FloatSize(m_crossfadeSize)); paint.setFilterQuality(context.computeFilterQuality(this, destRect, srcRect)); - drawCrossfade(context.canvas(), paint, ClampImageToSourceRect); + drawCrossfade(context.canvas(), paint, ClampImageToSourceRect, + context.getColorBehavior()); } } // namespace blink
diff --git a/third_party/WebKit/Source/platform/graphics/CrossfadeGeneratedImage.h b/third_party/WebKit/Source/platform/graphics/CrossfadeGeneratedImage.h index 2450090..0d777aea 100644 --- a/third_party/WebKit/Source/platform/graphics/CrossfadeGeneratedImage.h +++ b/third_party/WebKit/Source/platform/graphics/CrossfadeGeneratedImage.h
@@ -57,7 +57,8 @@ const FloatRect&, const FloatRect&, RespectImageOrientationEnum, - ImageClampingMode) override; + ImageClampingMode, + const ColorBehavior&) override; void drawTile(GraphicsContext&, const FloatRect&) final; CrossfadeGeneratedImage(PassRefPtr<Image> fromImage, @@ -67,7 +68,10 @@ const IntSize&); private: - void drawCrossfade(SkCanvas*, const SkPaint&, ImageClampingMode); + void drawCrossfade(SkCanvas*, + const SkPaint&, + ImageClampingMode, + const ColorBehavior&); RefPtr<Image> m_fromImage; RefPtr<Image> m_toImage;
diff --git a/third_party/WebKit/Source/platform/graphics/GeneratedImage.cpp b/third_party/WebKit/Source/platform/graphics/GeneratedImage.cpp index 1136648..abc55453 100644 --- a/third_party/WebKit/Source/platform/graphics/GeneratedImage.cpp +++ b/third_party/WebKit/Source/platform/graphics/GeneratedImage.cpp
@@ -69,7 +69,8 @@ destContext.drawRect(destRect, fillPaint); } -sk_sp<SkImage> GeneratedImage::imageForCurrentFrame() { +sk_sp<SkImage> GeneratedImage::imageForCurrentFrame( + const ColorBehavior& colorBehavior) { return nullptr; }
diff --git a/third_party/WebKit/Source/platform/graphics/GeneratedImage.h b/third_party/WebKit/Source/platform/graphics/GeneratedImage.h index 4db59e4..a09a433 100644 --- a/third_party/WebKit/Source/platform/graphics/GeneratedImage.h +++ b/third_party/WebKit/Source/platform/graphics/GeneratedImage.h
@@ -44,7 +44,7 @@ // Assume that generated content has no decoded data we need to worry about void destroyDecodedData() override {} - sk_sp<SkImage> imageForCurrentFrame() override; + sk_sp<SkImage> imageForCurrentFrame(const ColorBehavior&) override; protected: void drawPattern(GraphicsContext&,
diff --git a/third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.cpp b/third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.cpp index 203bfc8..d8d0834b 100644 --- a/third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.cpp +++ b/third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.cpp
@@ -36,7 +36,10 @@ const FloatRect& destRect, const FloatRect& srcRect, RespectImageOrientationEnum, - ImageClampingMode) { + ImageClampingMode, + const ColorBehavior& colorBehavior) { + // TODO(ccameron): This function should not ignore |colorBehavior|. + // https://crbug.com/672306 SkRect visibleSrcRect = srcRect; if (!visibleSrcRect.intersect( SkRect::MakeIWH(m_size.width(), m_size.height()))) @@ -54,6 +57,8 @@ void GradientGeneratedImage::drawTile(GraphicsContext& context, const FloatRect& srcRect) { + // TODO(ccameron): This function should not ignore |context|'s color behavior. + // https://crbug.com/672306 SkPaint gradientPaint(context.fillPaint()); m_gradient->applyToPaint(gradientPaint, SkMatrix::I()); @@ -61,7 +66,10 @@ } bool GradientGeneratedImage::applyShader(SkPaint& paint, - const SkMatrix& localMatrix) { + const SkMatrix& localMatrix, + const ColorBehavior& colorBehavior) { + // TODO(ccameron): This function should not ignore |colorBehavior|. + // https://crbug.com/672306 DCHECK(m_gradient); m_gradient->applyToPaint(paint, localMatrix);
diff --git a/third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.h b/third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.h index bf1ad2f..7af566e 100644 --- a/third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.h +++ b/third_party/WebKit/Source/platform/graphics/GradientGeneratedImage.h
@@ -44,7 +44,7 @@ ~GradientGeneratedImage() override {} - bool applyShader(SkPaint&, const SkMatrix&) override; + bool applyShader(SkPaint&, const SkMatrix&, const ColorBehavior&) override; protected: void draw(SkCanvas*, @@ -52,7 +52,8 @@ const FloatRect&, const FloatRect&, RespectImageOrientationEnum, - ImageClampingMode) override; + ImageClampingMode, + const ColorBehavior&) override; void drawTile(GraphicsContext&, const FloatRect&) override; GradientGeneratedImage(PassRefPtr<Gradient> generator, const IntSize& size)
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp index 96cbd75..710b139 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp +++ b/third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp
@@ -812,7 +812,7 @@ imagePaint.setFilterQuality(computeFilterQuality(image, dest, src)); imagePaint.setAntiAlias(shouldAntialias()); image->draw(m_canvas, imagePaint, dest, src, shouldRespectImageOrientation, - Image::ClampImageToSourceRect); + Image::ClampImageToSourceRect, m_colorBehavior); m_paintController.setImagePainted(); } @@ -848,7 +848,7 @@ if (useShader) { const SkMatrix localMatrix = SkMatrix::MakeRectToRect( visibleSrc, dest.rect(), SkMatrix::kFill_ScaleToFit); - useShader = image->applyShader(imagePaint, localMatrix); + useShader = image->applyShader(imagePaint, localMatrix, m_colorBehavior); } if (useShader) { @@ -859,7 +859,7 @@ SkAutoCanvasRestore autoRestore(m_canvas, true); m_canvas->clipRRect(dest, imagePaint.isAntiAlias()); image->draw(m_canvas, imagePaint, dest.rect(), srcRect, respectOrientation, - Image::ClampImageToSourceRect); + Image::ClampImageToSourceRect, m_colorBehavior); } m_paintController.setImagePainted();
diff --git a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp index bd249cf..d2a9211 100644 --- a/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp +++ b/third_party/WebKit/Source/platform/graphics/GraphicsLayer.cpp
@@ -1092,7 +1092,8 @@ void GraphicsLayer::setContentsToImage( Image* image, RespectImageOrientationEnum respectImageOrientation) { - sk_sp<SkImage> skImage = image ? image->imageForCurrentFrame() : nullptr; + sk_sp<SkImage> skImage = + image ? image->imageForCurrentFrame(m_colorBehavior) : nullptr; if (image && skImage && image->isBitmapImage()) { if (respectImageOrientation == RespectImageOrientation) {
diff --git a/third_party/WebKit/Source/platform/graphics/Image.cpp b/third_party/WebKit/Source/platform/graphics/Image.cpp index b04a53b..5e5a236 100644 --- a/third_party/WebKit/Source/platform/graphics/Image.cpp +++ b/third_party/WebKit/Source/platform/graphics/Image.cpp
@@ -255,7 +255,7 @@ const FloatSize& repeatSpacing) { TRACE_EVENT0("skia", "Image::drawPattern"); - sk_sp<SkImage> image = imageForCurrentFrame(); + sk_sp<SkImage> image = imageForCurrentFrame(context.getColorBehavior()); if (!image) return; @@ -311,14 +311,19 @@ } bool Image::isTextureBacked() { - sk_sp<SkImage> image = imageForCurrentFrame(); + // TODO(ccameron): It should not be necessary to specify color conversion for + // this query. + sk_sp<SkImage> image = + imageForCurrentFrame(ColorBehavior::transformToGlobalTarget()); return image ? image->isTextureBacked() : false; } -bool Image::applyShader(SkPaint& paint, const SkMatrix& localMatrix) { +bool Image::applyShader(SkPaint& paint, + const SkMatrix& localMatrix, + const ColorBehavior& colorBehavior) { // Default shader impl: attempt to build a shader based on the current frame // SkImage. - sk_sp<SkImage> image = imageForCurrentFrame(); + sk_sp<SkImage> image = imageForCurrentFrame(colorBehavior); if (!image) return false;
diff --git a/third_party/WebKit/Source/platform/graphics/Image.h b/third_party/WebKit/Source/platform/graphics/Image.h index dfbfe4e..f6819a70 100644 --- a/third_party/WebKit/Source/platform/graphics/Image.h +++ b/third_party/WebKit/Source/platform/graphics/Image.h
@@ -31,6 +31,7 @@ #include "platform/SharedBuffer.h" #include "platform/geometry/IntRect.h" #include "platform/graphics/Color.h" +#include "platform/graphics/ColorBehavior.h" #include "platform/graphics/GraphicsTypes.h" #include "platform/graphics/ImageAnimationPolicy.h" #include "platform/graphics/ImageObserver.h" @@ -152,7 +153,7 @@ enum TileRule { StretchTile, RoundTile, SpaceTile, RepeatTile }; - virtual sk_sp<SkImage> imageForCurrentFrame() = 0; + virtual sk_sp<SkImage> imageForCurrentFrame(const ColorBehavior&) = 0; virtual PassRefPtr<Image> imageForDefaultFrame(); virtual void drawPattern(GraphicsContext&, @@ -173,9 +174,12 @@ const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum, - ImageClampingMode) = 0; + ImageClampingMode, + const ColorBehavior&) = 0; - virtual bool applyShader(SkPaint&, const SkMatrix& localMatrix); + virtual bool applyShader(SkPaint&, + const SkMatrix& localMatrix, + const ColorBehavior&); // Compute the tile which contains a given point (assuming a repeating tile // grid). The point and returned value are in destination grid space.
diff --git a/third_party/WebKit/Source/platform/graphics/ImageLayerChromiumTest.cpp b/third_party/WebKit/Source/platform/graphics/ImageLayerChromiumTest.cpp index f0af1a2..ab1449d 100644 --- a/third_party/WebKit/Source/platform/graphics/ImageLayerChromiumTest.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImageLayerChromiumTest.cpp
@@ -50,7 +50,9 @@ IntSize size() const override { return m_size; } - sk_sp<SkImage> imageForCurrentFrame() override { return m_image; } + sk_sp<SkImage> imageForCurrentFrame(const ColorBehavior&) override { + return m_image; + } void destroyDecodedData() override { // Image pure virtual stub. @@ -61,7 +63,8 @@ const FloatRect&, const FloatRect&, RespectImageOrientationEnum, - ImageClampingMode) override { + ImageClampingMode, + const ColorBehavior&) override { // Image pure virtual stub. }
diff --git a/third_party/WebKit/Source/platform/graphics/ImagePattern.cpp b/third_party/WebKit/Source/platform/graphics/ImagePattern.cpp index 5e10826..9ae1fd60 100644 --- a/third_party/WebKit/Source/platform/graphics/ImagePattern.cpp +++ b/third_party/WebKit/Source/platform/graphics/ImagePattern.cpp
@@ -18,8 +18,12 @@ return adoptRef(new ImagePattern(std::move(image), repeatMode)); } +// TODO(ccameron): ImagePattern should not draw to a globally set color space. +// https://crbug.com/672306 ImagePattern::ImagePattern(PassRefPtr<Image> image, RepeatMode repeatMode) - : Pattern(repeatMode), m_tileImage(image->imageForCurrentFrame()) { + : Pattern(repeatMode), + m_tileImage(image->imageForCurrentFrame( + ColorBehavior::transformToGlobalTarget())) { m_previousLocalMatrix.setIdentity(); if (m_tileImage) { // TODO(fmalita): mechanism to extract the actual SkImageInfo from an
diff --git a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp index fa2e5d4..512f9b42 100644 --- a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp +++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
@@ -70,8 +70,10 @@ // TODO(xlai): Optimize to avoid copying pixels. See crbug.com/651456. // However, in the case when |image| is texture backed, this function call // does a GPU readback which is required. - image->imageForCurrentFrame()->readPixels(imageInfo, pixels, - imageInfo.minRowBytes(), 0, 0); + // TODO(ccameron): Canvas should produce sRGB images. + // https://crbug.com/672299 + image->imageForCurrentFrame(ColorBehavior::transformToGlobalTarget()) + ->readPixels(imageInfo, pixels, imageInfo.minRowBytes(), 0, 0); resource.mailbox_holder.mailbox = bitmap->id(); resource.mailbox_holder.texture_target = 0; resource.is_software = true; @@ -105,8 +107,10 @@ return; RefPtr<Uint8Array> dstPixels = Uint8Array::create(dstBuffer, 0, dstBuffer->byteLength()); - image->imageForCurrentFrame()->readPixels(info, dstPixels->data(), - info.minRowBytes(), 0, 0); + // TODO(ccameron): Canvas should produce sRGB images. + // https://crbug.com/672299 + image->imageForCurrentFrame(ColorBehavior::transformToGlobalTarget()) + ->readPixels(info, dstPixels->data(), info.minRowBytes(), 0, 0); GLuint textureId = 0u; gl->GenTextures(1, &textureId);
diff --git a/third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.cpp b/third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.cpp index f46047d..80212ac 100644 --- a/third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.cpp +++ b/third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.cpp
@@ -15,7 +15,10 @@ const FloatRect& destRect, const FloatRect& srcRect, RespectImageOrientationEnum, - ImageClampingMode) { + ImageClampingMode, + const ColorBehavior& colorBehavior) { + // TODO(ccameron): This function should not ignore |colorBehavior|. + // https://crbug.com/672306 SkAutoCanvasRestore ar(canvas, true); canvas->clipRect(destRect); canvas->translate(destRect.x(), destRect.y()); @@ -28,6 +31,8 @@ void PaintGeneratedImage::drawTile(GraphicsContext& context, const FloatRect& srcRect) { + // TODO(ccameron): This function should not ignore |context|'s color behavior. + // https://crbug.com/672306 context.drawPicture(m_picture.get()); }
diff --git a/third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.h b/third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.h index dc84dc2..e82e2b0 100644 --- a/third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.h +++ b/third_party/WebKit/Source/platform/graphics/PaintGeneratedImage.h
@@ -27,7 +27,8 @@ const FloatRect&, const FloatRect&, RespectImageOrientationEnum, - ImageClampingMode) override; + ImageClampingMode, + const ColorBehavior&) override; void drawTile(GraphicsContext&, const FloatRect&) final; PaintGeneratedImage(sk_sp<SkPicture> picture, const IntSize& size)
diff --git a/third_party/WebKit/Source/platform/graphics/PlaceholderImage.cpp b/third_party/WebKit/Source/platform/graphics/PlaceholderImage.cpp index a2df199..3939060 100644 --- a/third_party/WebKit/Source/platform/graphics/PlaceholderImage.cpp +++ b/third_party/WebKit/Source/platform/graphics/PlaceholderImage.cpp
@@ -27,7 +27,10 @@ PlaceholderImage::~PlaceholderImage() {} -sk_sp<SkImage> PlaceholderImage::imageForCurrentFrame() { +sk_sp<SkImage> PlaceholderImage::imageForCurrentFrame( + const ColorBehavior& colorBehavior) { + // TODO(ccameron): This function should not ignore |colorBehavior|. + // https://crbug.com/672306 if (m_imageForCurrentFrame) return m_imageForCurrentFrame; @@ -52,7 +55,10 @@ const FloatRect& destRect, const FloatRect& srcRect, RespectImageOrientationEnum, - ImageClampingMode) { + ImageClampingMode, + const ColorBehavior& colorBehavior) { + // TODO(ccameron): This function should not ignore |colorBehavior|. + // https://crbug.com/672306 if (!srcRect.intersects(FloatRect(0.0f, 0.0f, static_cast<float>(m_size.width()), static_cast<float>(m_size.height())))) {
diff --git a/third_party/WebKit/Source/platform/graphics/PlaceholderImage.h b/third_party/WebKit/Source/platform/graphics/PlaceholderImage.h index 7d32232..c32cd77 100644 --- a/third_party/WebKit/Source/platform/graphics/PlaceholderImage.h +++ b/third_party/WebKit/Source/platform/graphics/PlaceholderImage.h
@@ -33,14 +33,15 @@ IntSize size() const override { return m_size; } - sk_sp<SkImage> imageForCurrentFrame() override; + sk_sp<SkImage> imageForCurrentFrame(const ColorBehavior&) override; void draw(SkCanvas*, const SkPaint&, const FloatRect& destRect, const FloatRect& srcRect, RespectImageOrientationEnum, - ImageClampingMode) override; + ImageClampingMode, + const ColorBehavior&) override; void destroyDecodedData() override;
diff --git a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h index 7753fa8..0cf233cc 100644 --- a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h +++ b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h
@@ -22,14 +22,15 @@ // Methods overrided by all sub-classes virtual ~StaticBitmapImage() {} bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) = 0; - sk_sp<SkImage> imageForCurrentFrame() = 0; + sk_sp<SkImage> imageForCurrentFrame(const ColorBehavior&) = 0; bool isTextureBacked() = 0; void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum, - ImageClampingMode) = 0; + ImageClampingMode, + const ColorBehavior&) = 0; // Methods have common implementation for all sub-classes bool currentFrameIsComplete() override { return true; }
diff --git a/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.cpp index 7b20716..87f32a8 100644 --- a/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.cpp +++ b/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.cpp
@@ -34,12 +34,18 @@ const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum, - ImageClampingMode clampMode) { + ImageClampingMode clampMode, + const ColorBehavior& colorBehavior) { + // TODO(ccameron): This function should not ignore |colorBehavior|. + // https://crbug.com/672306 StaticBitmapImage::drawHelper(canvas, paint, dstRect, srcRect, clampMode, m_image); } -sk_sp<SkImage> UnacceleratedStaticBitmapImage::imageForCurrentFrame() { +sk_sp<SkImage> UnacceleratedStaticBitmapImage::imageForCurrentFrame( + const ColorBehavior& colorBehavior) { + // TODO(ccameron): This function should not ignore |colorBehavior|. + // https://crbug.com/672306 return m_image; }
diff --git a/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.h b/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.h index dce442b..ebae528 100644 --- a/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.h +++ b/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.h
@@ -17,7 +17,7 @@ bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) override; IntSize size() const override; - sk_sp<SkImage> imageForCurrentFrame() override; + sk_sp<SkImage> imageForCurrentFrame(const ColorBehavior&) override; // In our current design, the SkImage in this class is always *not* // texture-backed. bool isTextureBacked() { return false; } @@ -27,7 +27,8 @@ const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum, - ImageClampingMode) override; + ImageClampingMode, + const ColorBehavior&) override; private: UnacceleratedStaticBitmapImage(sk_sp<SkImage>);
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp index 03530d5..547c1341 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp
@@ -713,7 +713,11 @@ m_gl->GenSyncTokenCHROMIUM(fenceSync, produceSyncToken.GetData()); } - DCHECK(produceSyncToken.HasData()); + if (!produceSyncToken.HasData()) { + // This should only happen if the context has been lost. + return false; + } + gl->WaitSyncTokenCHROMIUM(produceSyncToken.GetConstData()); GLuint sourceTexture = gl->CreateAndConsumeTextureCHROMIUM(target, mailbox.name);
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp b/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp index 3e005441..35d7661 100644 --- a/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp +++ b/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp
@@ -2739,7 +2739,10 @@ if (!m_image) return; - sk_sp<SkImage> skiaImage = m_image->imageForCurrentFrame(); + // TODO(ccameron): WebGL should operate in sRGB. + // https://crbug.com/672299 + sk_sp<SkImage> skiaImage = + m_image->imageForCurrentFrame(ColorBehavior::transformToGlobalTarget()); SkImageInfo info = skiaImage ? SkImageInfo::MakeN32Premul(m_image->width(), m_image->height()) : SkImageInfo::MakeUnknown();
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 022d46f..d4e86e14 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -64607,6 +64607,13 @@ </summary> </histogram> +<histogram name="Sync.ClearServerDataEvents" enum="ClearServerDataEvents"> + <owner>pavely@chromium.org</owner> + <summary> + Records events encountered during sync's ClearServerData flow. + </summary> +</histogram> + <histogram name="Sync.ConfigureDataTypes" enum="SyncModelTypes"> <owner>zea@chromium.org</owner> <summary> @@ -78969,6 +78976,14 @@ <int value="7" label="Unknown"/> </enum> +<enum name="ClearServerDataEvents" type="int"> + <int value="0" label="Clear server data started"/> + <int value="1" label="Catchup configuration failed"/> + <int value="2" label="Catchup configuration retried after browser restart"/> + <int value="3" label="Clear server data succeeded"/> + <int value="4" label="RESET_LOCAL_SYNC_DATA received"/> +</enum> + <enum name="ClearSiteDataParameters" type="int"> <int value="0" label="No datatypes"/> <int value="1" label="Cookies"/> @@ -92495,7 +92510,6 @@ <int value="-2099035488" label="enable-data-reduction-proxy-bypass-warning"/> <int value="-2098610409" label="disable-lcd-text"/> <int value="-2097515669" label="disable-cast"/> - <int value="-2084492219" label="ComponentFlashOnly:disabled"/> <int value="-2083195884" label="enable-firewall-hole-punching"/> <int value="-2077268643" label="disable-device-enumeration"/> <int value="-2075870708" label="MediaRemotingEncrypted:disabled"/> @@ -92518,7 +92532,7 @@ <int value="-2020024440" label="scroll-end-effect"/> <int value="-2017953534" label="enable-hosted-app-shim-creation"/> <int value="-2013551096" label="ViewsSimplifiedFullscreenUI:disabled"/> - <int value="-2008272679" label="disable-webrtc-hw-encoding"/> + <int value="-2009622663" label="WebRtcHWH264Encoding:enabled"/> <int value="-2005089558" label="BackgroundVideoTrackOptimization:disabled"/> <int value="-2003354337" label="enable-search-button-in-omnibox-for-str-or-iip"/> @@ -92533,6 +92547,7 @@ <int value="-1963402827" label="enable-topchrome-md"/> <int value="-1961648833" label="show_summary"/> <int value="-1956349722" label="disable-smooth-scrolling"/> + <int value="-1948540128" label="disable-webrtc-hw-encoding (deprecated)"/> <int value="-1946595906" label="enable-push-api-background-mode"/> <int value="-1943507605" label="enable-new-video-renderer"/> <int value="-1941852572" label="floating-virtual-keyboard"/> @@ -92571,6 +92586,7 @@ <int value="-1832575380" label="show-saved-copy"/> <int value="-1832221649" label="disable-out-of-process-pac"/> <int value="-1821058653" label="enable-delay-agnostic-aec"/> + <int value="-1811394154" label="disable-webrtc-hw-vp8-encoding"/> <int value="-1804485171" label="disable-fullscreen-tab-detaching"/> <int value="-1802502753" label="enable-manual-password-generation:enabled"/> <int value="-1798337879" label="enable-md-downloads"/> @@ -92647,7 +92663,6 @@ <int value="-1473668019" label="token-binding:disabled"/> <int value="-1473136627" label="enable-web-payments"/> <int value="-1467332609" label="tab-management-experiment-type-anise"/> - <int value="-1466990325" label="CrosCompUpdates:enabled"/> <int value="-1460462432" label="disable-media-source"/> <int value="-1456004000" label="VrShell:disabled"/> <int value="-1443796945" label="OfflinePagesSharing:disabled"/> @@ -92817,7 +92832,6 @@ <int value="-684900739" label="disable-merge-key-char-events"/> <int value="-667517406" label="overscroll-history-navigation"/> <int value="-661978438" label="enable-data-reduction-proxy-lo-fi"/> - <int value="-660182316" label="ComponentFlashOnly:enabled"/> <int value="-660160292" label="enable-apps-show-on-first-paint"/> <int value="-650504533" label="enable-speculative-launch-service-worker"/> <int value="-650176557" label="OfflinePagesSvelteConcurrentLoading:enabled"/> @@ -92826,7 +92840,6 @@ <int value="-641719457" label="disable-compositor-touch-hit-testing"/> <int value="-631740127" label="inert-visual-viewport"/> <int value="-622685174" label="enable-pdf-material-ui"/> - <int value="-620030047" label="CrosCompUpdates:disabled"/> <int value="-617452890" label="media-router"/> <int value="-610411643" label="enable-printer-app-search"/> <int value="-606898702" label="MaterialDesignSettings:disabled"/> @@ -93019,6 +93032,7 @@ <int value="365467768" label="prefetch-search-results"/> <int value="368854020" label="ash-screen-rotation-animation"/> <int value="370486304" label="enable-origin-chip-on-srp"/> + <int value="377093001" label="WebRtcHWH264Encoding:disabled"/> <int value="379326303" label="enable-add-to-shelf"/> <int value="379428799" label="security-chip-animation"/> <int value="385969127" label="disable-win32k-lockdown"/>
diff --git a/tools/metrics/rappor/rappor.xml b/tools/metrics/rappor/rappor.xml index f8a23ed..6675cedd 100644 --- a/tools/metrics/rappor/rappor.xml +++ b/tools/metrics/rappor/rappor.xml
@@ -994,6 +994,75 @@ </summary> </rappor-metric> +<rappor-metric name="Media.Autoplay.CrossOrigin.Allowed.ChildFrame" + type="ETLD_PLUS_ONE"> + <owner>avayvod@chromium.org</owner> + <owner>mlamouri@chromium.org</owner> + <owner>zqzhang@chromium.org</owner> + <summary> + The eTLD+1 of a cross-origin iframe URL containing media that was allowed to + autoplay. + </summary> +</rappor-metric> + +<rappor-metric name="Media.Autoplay.CrossOrigin.Allowed.TopLevelFrame" + type="ETLD_PLUS_ONE"> + <owner>avayvod@chromium.org</owner> + <owner>mlamouri@chromium.org</owner> + <owner>zqzhang@chromium.org</owner> + <summary> + The eTLD+1 of the top-level frame URL that has a cross-origin iframe + containing media that was allowed to autoplay. + </summary> +</rappor-metric> + +<rappor-metric name="Media.Autoplay.CrossOrigin.Blocked.ChildFrame" + type="ETLD_PLUS_ONE"> + <owner>avayvod@chromium.org</owner> + <owner>mlamouri@chromium.org</owner> + <owner>zqzhang@chromium.org</owner> + <summary> + The eTLD+1 of a cross-origin iframe URL containing media that was blocked to + autoplay. + </summary> +</rappor-metric> + +<rappor-metric name="Media.Autoplay.CrossOrigin.Blocked.TopLevelFrame" + type="ETLD_PLUS_ONE"> + <owner>avayvod@chromium.org</owner> + <owner>mlamouri@chromium.org</owner> + <owner>zqzhang@chromium.org</owner> + <summary> + The eTLD+1 of the top-level frame URL that has a cross-origin iframe + containing media that was blocked to autoplay. + </summary> +</rappor-metric> + +<rappor-metric + name="Media.Autoplay.CrossOrigin.PlayedWithGestureAfterBlock.ChildFrame" + type="ETLD_PLUS_ONE"> + <owner>avayvod@chromium.org</owner> + <owner>mlamouri@chromium.org</owner> + <owner>zqzhang@chromium.org</owner> + <summary> + The eTLD+1 of a cross-origin iframe URL containing media that was blocked to + autoplay but the user plays the media by gesture at some point. + </summary> +</rappor-metric> + +<rappor-metric + name="Media.Autoplay.CrossOrigin.PlayedWithGestureAfterBlock.TopLevelFrame" + type="ETLD_PLUS_ONE"> + <owner>avayvod@chromium.org</owner> + <owner>mlamouri@chromium.org</owner> + <owner>zqzhang@chromium.org</owner> + <summary> + The eTLD+1 of the top-level frame URL that has a cross-origin iframe + containing media that was allowed to autoplay but the user plays the media + by gesture at some point. + </summary> +</rappor-metric> + <rappor-metric name="Media.OriginUrl.EME" type="ETLD_PLUS_ONE"> <owner>xhwang@chromium.org</owner> <summary>